Depending on the traffic source you work with (e.g., Facebook, Google Ads, Newsbreak, Snapchat), you may need to send visitors directly to your campaign’s landing page instead of using a 302 redirect.
This is required by some ad networks (such as Google Ads) to improve page load speed and maintain compliance.
This guide explains how to set up direct tracking in ClickFlare so that clicks, conversions, and key campaign metrics are accurately recorded without a redirect.
Setup requirements:
-
A landing page ready to receive traffic.
-
Access to your landing page code (to add the ClickFlare direct tracking script).
-
An offer page (the destination users reach after clicking your CTA).
-
A tracking domain is properly set up in ClickFlare.
Before you start, make sure you have:
Step 1 – Add Your Landing Page to ClickFlare
-
Log in to ClickFlare.
-
From the left menu, go to Landers → click [+ New].
-
Enter the details of your landing page (name, URL, etc.) and save.
Click here for a detailed guide on how to create landing pages.
Step 2 - Add the Direct Tracking Script to Your Landing Page
Direct tracking requires a special JavaScript snippet that allows ClickFlare to capture campaign IDs and user engagement without a redirect.
-
Insert the Script
Copy the full direct tracking script above (including <script> tags, then paste it in the <body> section of your landing page, right before the body closing tag.
<script>!function(){“use strict”;var n=“lp_ref”,t=“cpid”,e=“lpurl”,r=“https://yourtracking.domain”,c=“(?<domain>http(?:s?)://[^/]*)“.concat(“/cf/click”),a=“(?:(?:/(?<cta>[1-9][0-9]*)/?)|(?:/))?“,i=“^”.concat(c).concat(a).concat(“(?:$|(\\?.*))“),o=‘javascript:window.clickflare.l=“(?<original_link>‘.concat(c).concat(a,‘(“|(\\?[^“]*“))).*‘),s=function(){return new RegExp(i,“”)},l=function(){return new RegExp(o,“”)};function u(n){var t=function(n){return n.replace(s(),(function(n){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];var c=t[t.length-1].domain;return n.replace(c,r)}))}(n);return’javascript:window.clickflare.l=“‘.concat(t,‘“; void 0;‘)}function f(n,t){if(t&&n&&t.apply(document,[n]),/loaded|interactive|complete/.test(document.readyState))for(var e=0,r=document.links.length;e<r;e++)if(s().test(document.links[e].href)){var c=document.links[e];window.clickflare.links_replaced.has(c)||(c.href=u(c.href),window.clickflare.links_replaced.add(c))}}!function(c,a){var i=document.onreadystatechange;window.clickflare||(window.clickflare={listeners:{},customParams:{},links_replaced:new Set,addEventListener:function(n,t){var e=this.listeners[n]||[];e.includes(t)||e.push(t),this.listeners[n]=e},dispatchEvent:function(n,t){(this.listeners[n]||[]).forEach((function(n){return n(t)}))},push:function(n,t){(this.listeners[n]||[]).forEach((function(n){return n(t)}))}},document.onreadystatechange=function(n){return f(n,i)},f(null,i),setTimeout((function(){!function(c,a){var i,o=function(c,a){var i=new URL(“”.concat(r).concat(c));a.startsWith(“{{“)||i.searchParams.set(t,a);return i.searchParams.append(n,document.referrer),i.searchParams.append(e,location.href),i.searchParams.append(“lpt”,document.title),i.searchParams.append(“t”,(new Date).getTime().toString()),i.toString()}(c,a),s=document.createElement(“script”),u=document.scripts[0];s.async=1,s.src=o,s.onerror=function(){!function(){for(var n=function(n,t){var e=document.links[n];l().test(e.href)&&setTimeout((function(){e&&e.setAttribute(“href”,function(n){var t=n.match(l());if(t){var e=(t.groups||{}).original_link;return e?e.slice(0,-1):n}return n}(e.href))}))},t=0,e=document.links.length;t<e;t++)n(t)}()},null===(i=u.parentNode)||void 0===i||i.insertBefore(s,u)}(c,a)})))}(“”.concat(“/cf/tags”,“/”).concat(new URL(window.location.href).searchParams.get(“cftmid”)||“{{__CONTAINER_ID__}}“),new URL(window.location.href).searchParams.get(t)||“{{__CAMPAIGN_ID__}}“)}();</script>
-
Replace the Domain
Change:
https://YOUR-TRACKING-DOMAIN
to your actual ClickFlare tracking domain
(e.g., https://webeasyhit.com/cf/click).
-
Update Call-to-Action Links
Your landing page’s CTA buttons/links must use ClickFlare’s click tracking URLs.
Example:
<!doctype html>
<html lang="en">
<head>
<script>!function(){“use strict”;var n=“lp_ref”,t=“cpid”,e=“lpurl”,r=“https://yourtracking.domain”,c=“(?<domain>http(?:s?)://[^/]*)“.concat(“/cf/click”),a=“(?:(?:/(?<cta>[1-9][0-9]*)/?)|(?:/))?“,i=“^”.concat(c).concat(a).concat(“(?:$|(\\?.*))“),o=‘javascript:window.clickflare.l=“(?<original_link>‘.concat(c).concat(a,‘(“|(\\?[^“]*“))).*‘),s=function(){return new RegExp(i,“”)},l=function(){return new RegExp(o,“”)};function u(n){var t=function(n){return n.replace(s(),(function(n){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];var c=t[t.length-1].domain;return n.replace(c,r)}))}(n);return’javascript:window.clickflare.l=“‘.concat(t,‘“; void 0;‘)}function f(n,t){if(t&&n&&t.apply(document,[n]),/loaded|interactive|complete/.test(document.readyState))for(var e=0,r=document.links.length;e<r;e++)if(s().test(document.links[e].href)){var c=document.links[e];window.clickflare.links_replaced.has(c)||(c.href=u(c.href),window.clickflare.links_replaced.add(c))}}!function(c,a){var i=document.onreadystatechange;window.clickflare||(window.clickflare={listeners:{},customParams:{},links_replaced:new Set,addEventListener:function(n,t){var e=this.listeners[n]||[];e.includes(t)||e.push(t),this.listeners[n]=e},dispatchEvent:function(n,t){(this.listeners[n]||[]).forEach((function(n){return n(t)}))},push:function(n,t){(this.listeners[n]||[]).forEach((function(n){return n(t)}))}},document.onreadystatechange=function(n){return f(n,i)},f(null,i),setTimeout((function(){!function(c,a){var i,o=function(c,a){var i=new URL(“”.concat(r).concat(c));a.startsWith(“{{“)||i.searchParams.set(t,a);return i.searchParams.append(n,document.referrer),i.searchParams.append(e,location.href),i.searchParams.append(“lpt”,document.title),i.searchParams.append(“t”,(new Date).getTime().toString()),i.toString()}(c,a),s=document.createElement(“script”),u=document.scripts[0];s.async=1,s.src=o,s.onerror=function(){!function(){for(var n=function(n,t){var e=document.links[n];l().test(e.href)&&setTimeout((function(){e&&e.setAttribute(“href”,function(n){var t=n.match(l());if(t){var e=(t.groups||{}).original_link;return e?e.slice(0,-1):n}return n}(e.href))}))},t=0,e=document.links.length;t<e;t++)n(t)}()},null===(i=u.parentNode)||void 0===i||i.insertBefore(s,u)}(c,a)})))}(“”.concat(“/cf/tags”,“/”).concat(new URL(window.location.href).searchParams.get(“cftmid”)||“{{__CONTAINER_ID__}}“),new URL(window.location.href).searchParams.get(t)||“{{__CAMPAIGN_ID__}}“)}();</script>
</head>
<body>
.
.
<a href="https://your-tracking-domain.com/cf/click/1">Your Call to Action</a>
.
</body>
</html>
If you skip this, ClickFlare cannot track Clicks events.
Step 3 - Creating your Campaign
-
In ClickFlare, go to Campaigns → [+ New].
-
Choose your Traffic Source (Facebook, Google Ads, Newsbreak, Snapchat, etc.).
-
Select a Cost Tracking Model (auto or manual).
-
Name your campaign clearly (e.g., FB-USA-Women-Fitness).
-
Under Transition Type, set it to Direct.
This setting will tell ClickFlare to use the direct tracking script present in your landing page, instead of waiting for users to be redirected through a redirect tracking campaign link.
Step 4 – Set Your Destination
In the campaign’s Destination Settings:
-
Choose the Landing Page where you added the direct tracking script.
-
Add the Offer URL where visitors will go after clicking the CTA.
Click here for more information about campaign destination settings.
Step 5 – Get Your Campaign Tracking URL
Once your campaign is saved:
-
Go to the campaign overview.
-
Copy the Lander Tracking URL (not the regular redirect link).
Example:
The key parameter is cpid, which uniquely identifies the campaign.
🔧 Additional Tips & Best Practices
-
Facebook CAPI Integration: If you have Conversion API set up (like your Meta CAPI integration), you don’t need postback URLs for Facebook; data is sent server-side.
-
Google Ads: Direct tracking is required since Google blocks redirect tracking.
-
Testing: Always open the Lander Tracking URL in a browser to verify that ClickFlare parameters are loading correctly. You can check this by going to Inspect → Network and searching for tags in the network requests.