You can track conversions using ClickAdilla’s built-in tools or a third-party tracker. This guide focuses on ClickAdilla’s tools and offers a script you can adapt for your code.
You’ll learn how to capture and store [CLICK_ID] and send a request to ClickAdilla when conversions happen.
If you need to integrate a third-party tracker, see another guide:
How can I integrate trackers? →
Step 1. Copy and Paste the script
Add this script to the <head> of the web pages that get traffic (landing, prelanding, thank-you pages, etc.). If the <head> tag isn’t available, add it to the beginning of the <body>.
{
<script>
// Cookie Handler
(function (environment) {
if (!environment) return;
var SEARCH_QUERIES = ['click_id'];
var COOKIE_EXPIRATION_DAYS = 61;
function setCookie(name, value, days) {
var cookieItem = name + "=" + encodeURIComponent(value);
cookieItem += "; max-age=" + (days * 24 * 60 * 60);
document.cookie = cookieItem;
}
function getQueryParam(name) {
var query = environment.location && environment.location.search ? environment.location.search : '';
if (!query) return null;
if (query.charAt(0) === '?') {
query = query.substring(1);
}
var pairs = query.split('&');
for (var i = 0; i < pairs.length; i++) {
var part = pairs[i];
if (!part) continue;
var eqIndex = part.indexOf('=');
var key, value;
if (eqIndex === -1) {
key = decodeURIComponent(part);
value = '';
} else {
key = decodeURIComponent(part.substring(0, eqIndex));
value = decodeURIComponent(part.substring(eqIndex + 1));
}
if (key === name) {
return value;
}
}
return null;
}
function setCookiesFromSearch() {
for (var i = 0; i < SEARCH_QUERIES.length; i++) {
var query = SEARCH_QUERIES[i];
var queryValue = getQueryParam(query);
if (queryValue) {
setCookie(query, queryValue, COOKIE_EXPIRATION_DAYS);
}
}
}
if (!environment.__postbacks) {
environment.__postbacks = {};
}
environment.__postbacks.setCookiesFromSearch = setCookiesFromSearch;
})(window);
// Postback Handler
(function (environment) {
if (!environment) return;
var SEARCH_QUERIES = ['click_id'];
var TOKEN_NAME = 'token';
var HOST_NAME = 'https://tracking.clickadilla.com/in/postbacks/';
function setCookie(name, value, days) {
var cookieItem = name + "=" + encodeURIComponent(value);
cookieItem += "; max-age=" + (days * 24 * 60 * 60);
document.cookie = cookieItem;
}
function requestHandler(src) {
return new Promise(function (resolve, reject) {
var img = new Image();
img.onload = function () {
resolve(img);
};
img.onerror = function (e) {
reject(e);
};
img.src = src;
});
}
function getCookieByName(allCookies, name) {
for (var i = 0; i < allCookies.length; i++) {
var cookiePair = allCookies[i].split("=");
var cookieName = cookiePair[0].replace(/^\s+|\s+$/g, '');
if (name === cookieName) {
return decodeURIComponent(cookiePair[1] || '');
}
}
return null;
}
function buildQuery(params) {
var parts = [];
for (var key in params) {
if (params.hasOwnProperty(key) && params[key] != null && params[key] !== '') {
parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
}
}
return parts.join('&');
}
function sendPostback(userToken) {
if (typeof document === 'undefined') {
return Promise.reject(new Error('document is not available'));
}
if (!userToken) {
return Promise.reject(new Error('sendPostback error: userToken is not provided'));
}
var documentCookies = document.cookie ? document.cookie.split(";") : [];
var params = {};
var i;
for (i = 0; i < SEARCH_QUERIES.length; i++) {
var query = SEARCH_QUERIES[i];
var queryValue = getCookieByName(documentCookies, query);
if (queryValue) {
params[query] = queryValue;
}
}
var hasParams = false;
for (var key in params) {
if (params.hasOwnProperty(key)) {
hasParams = true;
break;
}
}
if (!hasParams) {
return Promise.resolve();
}
params[TOKEN_NAME] = userToken;
var queryString = buildQuery(params);
var fetchUrl = HOST_NAME;
if (queryString) {
fetchUrl += (HOST_NAME.indexOf('?') === -1 ? '?' : '&') + queryString;
}
return requestHandler(fetchUrl).catch(function () {
}).then(function () {
for (i = 0; i < SEARCH_QUERIES.length; i++) {
setCookie(SEARCH_QUERIES[i], '', 0);
}
});
}
if (!environment.__postbacks) {
environment.__postbacks = {};
}
environment.__postbacks.sendPostback = sendPostback;
})(window);
</script>
What are these functions for?
— to capture [CLICK_ID] from the landing page link,
— to save it in cookies: in this example, cookies last for 61 days (61*24*60*60 seconds),
— to read the stored value and build a Postback URL,
— to send an HTTP GET request to ClickAdilla.
Step 2. Capture and Store CLICK_ID
Call this script every time a page with traffic loads:
{
<script> window.__postbacks.setCookiesFromSearch();
</script>
What is CLICK_ID?
When someone clicks your ad, ClickAdilla adds ‘click_id=...’ to your landing page link. This is the [CLICK_ID] parameter. Example of a link:
https://example.com/?click_id=123abc
Why capture and store it?
Capturing and storing the [CLICK_ID] is needed so you can send it back to ClickAdilla when a conversion happens. Doing so ties each ad click to what happens next — signups, purchases, deposits, or other conversion events on your website. That’s how ClickAdilla gets the amount of conversions to show them in your statistics.
Step 3. Get your unique token
Go to your dashboard → Tracking → Conversion tracking → Your Postback URL. It contains your unique token.

How to use this token?
Copy this token from your Postback URL. This token doesn’t change. It’s unique for you. You'll need it in the function below.
Step 4. Send Postback
Call this function when a conversion happens, such as after a signup or purchase.
{
<script>
window.__postbacks.sendPostback('aAA1aAxxx');
</script>
Why call this function after each conversion?
It sends an HTTP GET request to ClickAdilla, recording the conversion in your statistics.
How to replace aAA1aAxxx?
Change the aAA1aAxxx placeholder to your actual unique token from Step 3.
Need to send multiple postbacks for one campaign?
Learn more: How to set up multiple postbacks for one campaign →