This guide is intended for merchants who cannot use the standard Kelkoo Group leadtag.js script and need to reproduce its essential functionality in their own implementation.
For most integrations, we recommend using the standard Kelkoo Lead Tag. Only use the approach described below if you have a specific technical requirement to implement the Lead Tag logic yourself.
Minimal implementation of lead tag
This is the minimal mechanism you need to implement
JavaScript
KELKOO.Tracking._getUrlParamValue = function (name) {
var bareUrlRegex = new RegExp("[\\?&]" + name + "=([\\w\\-]+)", "gi");
var result = bareUrlRegex.exec(document.location.search);
var activeObserveHandle = null;
if (result) {
activeObserveHandle = result[1];
}
return activeObserveHandle;
};
KELKOO.Tracking.setCookieAndStorage = function (name, value) {
var d = new Date;
d.setTime(d.getTime() + 365 * 24 * 60 * 60 * 1E3);
document.cookie = name + "=" + value + "; expires=" + d.toGMTString() + "; path=/; domain=acme.com; SameSite=Strict";
sessionStorage.setItem(name, value);
localStorage.setItem(name, value);
};
var kk = KELKOO.Tracking._getUrlParamValue("kk");
KELKOO.Tracking.setCookieAndStorage("kelkooId", kk);
var gclid = KELKOO.Tracking._getUrlParamValue("gclid");
KELKOO.Tracking.setCookieAndStorage("kk_gclid", gclid);
The kk parameter and kelkooId
The kk URL parameter is automatically added by Kelkoo Group when a user clicks one of your ads.
Your Lead Tag implementation retrieves the value of kk and stores it as kelkooId