Tracking Instructions for Advertisers

Within the BDA platform, you can track multiple events that precede or follow conversions. For tracking, you need to call the URL from the server (or client):https://{TRACKINGDOMAIN}/rtb2/p/a/{CLICKID}?a={ACTION_NAME}

Domain Management

{CLICKID} is the value of the GET parameter that is inserted when navigating from the platform to your offer. The parameter name is set when configuring the target URL field in the campaign.

{ACTION_NAME} can contain any Latin letters, digits, and the underscore (_).

Examples #

JavaScript #

function trackEvent(clickId, actionName) {
    const trackingDomain = "your.trackingdomain.com";
    const url = `https://${trackingDomain}/rtb2/p/a/${clickId}?a=${actionName}`;
    fetch(url).then(response => {
        if (response.ok) {
            console.log("Event tracked successfully");
        } else {
            console.log("Error tracking event");
        }
    });
}

Node.js #

const https = require('https');

function trackEvent(clickId, actionName) {
    const trackingDomain = "your.trackingdomain.com";
    const url = `https://${trackingDomain}/rtb2/p/a/${clickId}?a=${actionName}`;

    https.get(url, (res) => {
        let data = '';
        res.on('data', (chunk) => { data += chunk; });
        res.on('end', () => { console.log("Event tracked successfully"); });
    }).on('error', (e) => {
        console.error("Error tracking event", e);
    });
}    

Python #

import requests

def track_event(click_id, action_name):
    tracking_domain = "your.trackingdomain.com"
    url = f"https://{tracking_domain}/rtb2/p/a/{click_id}?a={action_name}"
    response = requests.get(url)
    if response.status_code == 200:
        print("Event tracked successfully")
    else:
        print("Error tracking event") 

PHP #

<?php
function trackEvent($clickId, $actionName) {
    $trackingDomain = "your.trackingdomain.com";
    $url = "https://$trackingDomain/rtb2/p/a/$clickId?a=$actionName";
    
    $response = file_get_contents($url);
    if ($response !== FALSE) {
        echo "Event tracked successfully";
    } else {
        echo "Error tracking event";
    }
}
?>

Viewing Event Statistics #

You can view event statistics within the campaign in the “Detailed Statistics by Date” popup, under the “Actions” tab.

Filtering Sources by Event Frequency #

To filter sources by the frequency of events, you need to create a rule in the campaign window under the Optimization and Rules section. Select “Action:new_action” as the condition. After selection, you will be prompted to specify the textual name of the event.

Example Case: Multi-step Registration on Landing Page #

For a multi-step registration on a landing page, you can log the following actions:

  1. visit — Page served by the server.
  2. visible — User viewed the page. (Include link to JS code for visibility tracking and pixel call)
  3. start_reg — User started registration.
  4. step1 — First step of registration.
  5. step2 — Second step of registration.
  6. success — Registration completed.
  7. error — In case of an error.

By using such a case, you can filter traffic sources that do not show interest in the product and monitor the entire sales funnel.

JavaScript Code for Visibility Tracking #

document.addEventListener("DOMContentLoaded", function() {
    const observer = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                trackEvent("your_click_id", "visible");
                observer.disconnect(); // stop observing after tracking
            }
        });
    });
    observer.observe(document.querySelector("#yourElement"));
});

Conversion Tracking Using Postback #

You can read about it here.

  • Using trafficback if traffic fails validation on the landing page. In this case, the impression will not be counted for the advertiser and can be reused:
document.addEventListener("DOMContentLoaded", function() {
    const getClickId = (paramName) => {
        const urlParams = new URLSearchParams(window.location.search);
        return urlParams.get(paramName);
    };

    const clickId = getClickId("click_id_param"); // Specify the GET parameter name
    const trackingDomain = "your.trackingdomain.com";
    const trafficBackUrl = `https://${trackingDomain}/rtb2/p/e/${clickId}`;
    const activeUrl = `https://${trackingDomain}/rtb2/p/a/${clickId}?a=active`;

    let inactiveTimer = setTimeout(function() {
        fetch(trafficBackUrl, { method: 'HEAD' }).then(response => {
            if (response.ok) {
                console.log("Trafficback executed successfully");
                history.back(); // Return to the previous page
            }
        });
    }, 30000); // 30 seconds

    let activeTracked = false;

    function handleActivity() {
        if (!activeTracked) {
            fetch(activeUrl).then(response => {
                if (response.ok) {
                    console.log("Action 'active' tracked successfully");
                }
            });
            activeTracked = true;
            clearTimeout(inactiveTimer);
        }
    }

    const events = ["mousemove", "keypress", "scroll", "touchstart"];

    events.forEach(event => {
        document.addEventListener(event, handleActivity);
    });
});
  • Tracking the maximum number of intermediate actions allows you to effectively monitor the funnel and block sources that do not show interest at early stages.
  • In CPA campaigns, splitting postbacks of conversions into smaller parts, which allows the system to receive data on the financial efficiency of the offer faster, will enable the advertiser to get more traffic.
  • Using a “click pixel” placed on the landing page when a client performs an intermediate target action allows the system to more effectively optimize traffic sources. It also lets you conduct tests and evaluate effectiveness by looking at the CTR parameter, even if the offer is not designed for clicks.
  • To get current links, you can request {ROTATORURL}/rtb2/p/l/{CLICKID}, and in response, you will receive a JSON with a list: {trafficback_pixel, trafficback_url, click_pixel, action_pixel, postback}.