Get tracking code

A visitor on your website who followed a referral link shared by a partner is associated with a unique tracking code stored in a first-party cookie (a cookie accessible on your domain). This tracking code is kept for a given period of time and can be used to identify the source partner of a new lead/customer, even days after the his first visit.

If you want to get the current tracking code from you website, use:

var trackingCode = kiflo('getTrackingCode');

Calling Kiflo('getTrackingCode') action is synchronous and will return the value immediately.


It returns a string containing the unique tracking code stored in the cookie, or undefined if no tracking code is stored for the current user's session.


var trackingCode = kiflo('getTrackingCode');
console.log(trackingCode); // Will print "AAAAgCHM5Qk="

In which case should I get the tracking code myself?

If you create your customer using the Kiflo('customer', ...) method the tracking code will be sent automatically. But if you choose to create your customer from your backend code instead of your website, you won't be able to use the JS SDK.

In this case, you can read the unique tracking code and sent it to your backend with the rest of the new customer's information. You can then call the Kiflo API the create the customer and associate it with the source partner. Check the API documentation here.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.