Conversiontracking (Clientsided)

Implementation

Implementation

Overview

This tracking code is responsible for capturing the conversion / order and must be output on the order confirmation page.


JavaScript Code

<script>
(function() { 

    var campaign_id = 'CAMPAIGN_ID';
    var trigger_id = 'TRIGGER_ID';
    var token = 'ORDERTOKEN'; 
    var turnover = 'TURNOVER';
    var descr = 'DESCRIPTION';
    var currency = 'EUR';
    var storageKey = 'emid';
    var trackingDomain = 'SUB-DOMAIN';

    /* Please insert the EMID here that was previously passed to the landing page via the GET parameter */
    /* If it is not possible to store the EMID, please leave this line as it is */
    var emid = null;

    var attribution = '1';

    var trackingUrl = 'https://'+trackingDomain+'/trck/etrack/?campaign_id='+campaign_id+'&trigger_id='+trigger_id+'&token='+token+'&descr='+descr+'&currency='+currency+'&turnover='+turnover+'&attribution='+attribution+'&t=js';

    emid = emid || window.localStorage[storageKey];

    if(emid) {
        trackingUrl += '&emid='+emid;
    }

    var req = new XMLHttpRequest;
    req.withCredentials = true;
    req.open("GET", trackingUrl);
    req.send();
    req.onreadystatechange = function () { 
        (req.readyState === 4) ? eval(req.response) : null 
    };

})();
</script>

Important Note Regarding the emid


Variable Description

The variables are initialized at the beginning of the code.
The placeholder values must be replaced with the corresponding values.

Variable Description
CAMPAIGN_ID Campaign ID
TRIGGER_ID Trigger ID
TOKEN Order number / Order ID
TURNOVER Net order value. This may determine the commission for the publisher.
DESCR Description of the order
CURRENCY Current currency (Default: Affiliate program setting). Example: CHF for Swiss shops that settle in €
STORAGEKEY Key in localStorage where the emid is saved
TRACKINGDOMAIN Domain of the partner platform
ATTRIBUTION Attribution in decimal format using a dot as a separator (e.g., 0.50 for 50%)
EMID Value of the emid parameter passed to the landing page via the click link