Tracking code

When should I use tracking mode?

When you can't send traffic though TDS. To use tracking campaign you need to add javascript-code to website.

How to get the tracking code?

There are two ways:

1. Choose type “Tracking” at the campaign settings

2. Choose “Other > Tracking code” at the “Integration Assistant”

How to pass utm-labels and parameters?

In version 7.6 and older all request parameters are passed to Keitaro. You do not need to configure anything.

How to send conversions?

To add a sale:

KTracking.reportConversion(revenue, 'sale');

Insert the profit sum instead of “revenue” or put a “0” there.

To send lead:

KTracking.reportConversion(revenue, 'lead')

To cancel conversion:

KTracking.reportConversion(revenue, 'rejected');

To collect rebills send a unique parameter tid (Transaction ID):

var tid = Math.floor(Math.random() * 1000000000);
KTracking.reportConversion(revenue, 'sale', tid)

How to get SubId?

KTracking.getSubId(function(subid){
    console.log('SubId: ' + subid);
});

How to avoid a duplication of visitors if traffic comes from Keitaro?

Pass the parameter subid at the stream.

http://landing.com/page?subid={subid}

If there is a tracking code on website landing.com then it will use this subid.

1. Add this code under a tracking code:

<script> 
function keitaro_report_conversion(link, revenue, status, tid) { 
   KTracking.reportConversion(revenue, status, tid, function() { 
       window.location = link.href; 
    }); 
    return false; 
} 
</script>

2. Add clicks onclick="keitaro_track_click(this, revenue, status, tid)" to link from which you want to track clicks:

<a onclick="keitaro_report_conversion(this, 0, 'lead')" href="http://google.com">link</a>

How to pass subid in URLs?

For links, where you need to add subid, add the class ktr, in URL the macro {subid}:

<a class="ktr" href="http://offer.com/?id=123123&subid={subid}">переход на оффер</a>