3rd-Party Click Tracking

Overview

With 3rd-Party Click Tracking, you can edit the Creative properties to dynamically create click URLs that include tracking codes from 3rd-Parties, such as DoubleClick, Atlas, Sizmek, etc.

This lets your Advertisers use their own services/servers for validating clicks.

3rd-Party Tracking Basics

A typical ad tag from a 3rd-party provides an image source URL and a click destination URL:

<a href="http://advertiser_click_url"><img src="http://advertiser_image_url" /></a>

While not all tags are built this way, all click tags will have a "click URL" that works the same way.

To incorporate this into a Creative, the basic steps are:

  1. Take the destination URL from the click URL and use that as the Creative's Click URL
  2. Enable the Creative to be 'JavaScript/HTML' format
  3. Use the same tracking tag from the 3rd-party, but replace the click URL with this macro: {{URL}}

See the instructions below for handling codes from various well-known trackers.

In the UI, you can also use the "Convert to Kevel Macros" button in a creative to automatically add tracking macros to tags supported in this article. (Currently, Doubleclick, Sizmek, Atlas and Flashtalking tags are supported.) This feature is in Beta.

🚧

For a <noscript> section, you'll need to instead keep the click URL in the creative's code and insert {{url}}&url= before it, like: <a href="{{url}}&url=http://advertiser_click_url">

{{URL}} Macro

The {{url}} macro generates an Kevel tracking URL and replaces the third party's destination URL.

If you append our click tracking URL as a parameter in the creative, use the macro {{url|url_encode}} instead. This will urlencode the click tracking URL when the creative is rendered.

For more information on macros, see Macros/Tokens.

👍

If your creative requires multiple destination URLs, use macros {{urls[1]}}, {{urls[2]}}, and so forth. These will load links in the order that you enter URLs in the clickURL box.

Adding 3rd-Party Tracking - API

To dynamically add click tracking tags to a creative, you'll want to use the Create Creative endpoint.

These are the field you have to edit to enable:

Properties

Description

IsHTMLJS
(boolean)

Set to true

ScriptBody
(string)

Fill with a HTML/JavaScript ad. See below for examples of what various tracker codes look like.

URL

The click URL. If the 3rd party is tracking clicks, it should have the service's domain in it. If the service is only doing impression tracking, it's the standard landing page

See the examples on this page about what the different tags look like, based on company.

For instance, here's an example of a JSON request to create a creative that includes a DFA-click-tracking-URL:

creative={
  "AdvertiserId":123,
  "Title":"Adzerk Blue Creative",
  "Body":"",
  "AdTypeId":5,
  "IsHTMLJS":true,
  "ScriptBody": "<SCRIPT language=\"JavaScript1.1\" SRC=\"http://ad.doubleclick.net/adj/N1234.CompanyName/B123456.3;sz=728x90;click={{url|add(\"&url=\")}};ord={{timestamp}}?\"> </SCRIPT>",
  "Url":"http://ad.doubleclick.net/adj/N1234.CompanyName/B123456.3;sz=728x90;ord={{timestamp}}"
}

🚧

Make sure to add \ before quotation marks within the ScriptBody string to prevent it from breaking

Adding 3rd-Party Tracking - UI

  1. When Setting up a Creative, select "JavaScript/HTML" as the Format
  2. Add in the code snippets as found below
  3. Add in the Click URL you want the ad to go to
  4. Save

Appending URL to Click URL

Some third-party tags require that you append another URL to the end of the click tracking URL that is generated by the click tracking macro.

For example, when these tags are written to a page, they may write the click URL of the creative as a series of redirects: First the tracking URL from the third-party platform, then a redirect to Kevel's click tracking URL, and then another redirect to the advertiser's original click URL.

If this is the case, add the parameter &url= to the end of the click macro, so it becomes {{url}}&url=https://advertiser_click_url, etc. This will enable Kevel's click tracking URL to redirect to another URL after a user clicks on an ad.

For example:

<a href="{{url}}&url=https://advertiser_click_url">

🚧

Examples

The example code snippets provided below are for demonstration purpose only. You'll need to modify whatever code is provided by the Advertiser accordingly.

Adsense

Currently, Kevel cannot track clicks for AdSense creatives because their system is not compatible with our macros.

AppNexus

<!-- BEGIN JS TAG < - DO NOT MODIFY --> 
<SCRIPT SRC="http://ib.adnxs.com/ttj?id=1076663&cb={{timestamp}}&referrer={{request.url.href}}&pubclick={{url|url_encode}}%26url= " TYPE="text/javascript"></SCRIPT> 
<!-- END TAG -->

Atlas

Atlas tags should use the click={{url|add("&url=%u")}} macro instead of {{url}}:

<script language="JavaScript" type="text/javascript" src="http://view.atdmt.com/MRT/jview/123456789/direct/01{{timestamp}}?click={{url|add("&url=%u")}}"> 
</script>

An alternate form of Atlas tags will use `{{url|url_encode}}%26url=:``

<script src="https://ad.atdmt.com/i/a.js;p=1234567890;cache=?click={{url|url_encode}}%26url="><iframe src="https://ad.atdmt.com/i/a.html;p=1234567890;cache=?click={{url|url_encode}}" width="728" height="90" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>

Criteo

<script type='text/javascript'>
<!--//<![CDATA[
document.MAX_ct0 ='{{url|url_encode}}%26url=';
var m3_u = (location.protocol=='https:'?'https://cas.criteo.com/delivery/ajs.php?':'http://cas.criteo.com/delivery/ajs.php?');
var m3_r = Math.floor(Math.random()*99999999999);
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
document.write ("zoneid=123456");document.write("&amp;nodis=1");
document.write ('&amp;cb=' + m3_r);
if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
document.write ("&amp;loc=" + escape(window.location));
if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
if (document.context) document.write ("&context=" + escape(document.context));
if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {
document.write ("&amp;ct0=" + escape(document.MAX_ct0));
}
if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
document.write ("'></scr"+"ipt>");
//]]>--></script>

Doubleclick for Advertisers (DFA)

If the advertiser is using DoubleClick and Javascript, the code will look something like this:

<SCRIPT language="JavaScript1.1" SRC="http://ad.doubleclick.net/adj/N1234.CompanyName/B123456.3;sz=728x90;ord=[timestamp]?"> </SCRIPT>

To enable click-tracking on these creatives within Kevel:

  1. Modify the URL by replacing [timestamp] with {{timestamp}}
  2. Add click={{url|add("&url=")}} before ord=

Ex:

<SCRIPT language='JavaScript1.1' SRC="http://ad.doubleclick.net/adj/N1234.CompanyName/B123456.3;sz=728x90;click={{url|add("&url=")}};ord={{timestamp}}?"> </SCRIPT>

📘

Below works slightly differently than other examples. Here, you'll need to change the Click URL field in the Creative, as well as the "JavaScript/HTML" section.

If the advertiser is using Doubleclick with an image tag, the code will look something like this:

<A HREF="https://ad.doubleclick.net/jump/N123.456789.CompanyName/B123456.1;sz=728x90;ord=[timestamp]" target="_blank">

<IMG SRC="http://ad.doubleclick.net/ad/N123.456789.CompanyName/B123456.1;sz=728x90;ord=[timestamp]?"BORDER=0 WIDTH=728 HEIGHT=90 ALT="Advertisement"></A>

To enable click-tracking on these creatives within Kevel:

  1. Modify the URL by replacing [timestamp] with {{timestamp}}
  2. Copy the URL in the tag, remove the question mark at end (if present), and paste in the Click URL field of the Creative
  3. Cut out the URL from the tag code and replace with {{url}}

Ex:

<A HREF="{{url}}" target="_blank">

<IMG SRC="http://ad.doubleclick.net/ad/N123.456789.CompanyName/B123456.1;sz=728x90;ord={{timestamp}}?" BORDER=0 WIDTH=728 HEIGHT=90 ALT="Advertisement"></A>
http://ad.doubleclick.net/adj/N1234.CompanyName/B123456.3;sz=728x90;ord={{timestamp}}

Doubleclick Campaign Manager Ad Tag

<ins class='dcmads' style='display:inline-block;width:300px;height:250px'
data-dcm-placement='N7480.1664088DOUBLECLICK.NETTEST/B8299600.114071906'
data-dcm-rendering-mode='script'
data-dcm-click-tracker='{{url}}&url='>
<script src='//www.googletagservices.com/dcm/dcmads.js'></script>
</ins>

Flashtalking

<script language="Javascript1.1" type="text/javascript">
var ftClick = "{{url|url_encode}}%26url=";
var ftExpTrack_1258613 = "";
var ftX = "";
var ftY = "";
var ftZ = "";
var ftOBA = 1;
var ftContent = "";
var ftCustom = "";
var ft728x90_OOBclickTrack = "";
var ftRandom = Math.random()*1000000;
var ftBuildTag1 = "<scr";
var ftBuildTag2 = "</";
var ftClick_1155613 = ftClick;
if(typeof(ft_referrer)=="undefined"){var ft_referrer=(function(){var r="";if(window==top){r=window.location.href;}else{try{r=window.parent.location.href;}catch(e){}r=(r)?r:document.referrer;}while(encodeURIComponent(r).length>1000){r=r.substring(0,r.length-1);}return r;}());}
var ftDomain = (window==top)?"":(function(){var d=document.referrer,h=(d)?d.match("(?::q/q/)+([qw-]+(q.[qw-]+)+)(q/)?".replace(/q/g,decodeURIComponent("%"+"5C")))[1]:"";return (h&&h!=location.host)?"&ft_ifb=1&ft_domain="+encodeURIComponent(h):"";}());
var ftTag = ftBuildTag1 + 'ipt language="javascript1.1" type="text/javascript" ';
ftTag += 'src="http://servedby.flashtalking.com/imp/1/42212;1175613;291;js;YourSiteName;728x90Leader/?ftx='+ftX+'&fty='+ftY+'&ftadz='+ftZ+'&ftscw='+ftContent+'&ft_custom='+ftCustom+'&ftOBA='+ftOBA+ftDomain+'&ft_referrer='+encodeURIComponent(ft_referrer)+'&cachebuster='+ftRandom+'" id="ftscript_728x90" name="ftscript_728x90"';
ftTag += '>' + ftBuildTag2 + 'script>';
document.write(ftTag);
</script>

Sizmek / MediaMind

<script src="http://bs.serving-sys.com/BurstingPipe/adServer.bs?cn=rsb&c=28&pli=7417834&PluID=0&w=160&h=600&ord={{timestamp}}&ucm=true&ncu={{url|url_encode}}&click=$$"></script> 
<noscript> 
<a href="http://bs.serving-sys.com/BurstingPipe/adServer.bs?cn=brd&FlightID=7417834&Page=&PluID=0&Pos=256" target="_blank"><img src="http://bs.serving-sys.com/BurstingPipe/adServer.bs?cn=bsr&FlightID=7417834&Page=&PluID=0&Pos=256" border=0 width=160 height=600></a></noscript>

Mediaplex

MediaPlex creatives need to be encoded and redirected to the destination URL.

<!-- JavaScript Only --> 
<script type="text/javascript" src="http://altfarm.mediaplex.com/ad/js/24039-173280-16934-0?mpt={{timestamp}}&mpvc={{url|url_encode}}%26url="> 
</script> 
<noscript> 
<a href="http://altfarm.mediaplex.com/ad/nc/24039-173280-16934-0?mpt={{timestamp}}"> 
<img src="http://altfarm.mediaplex.com/ad/nb/24039-173280-16934-0?mpt={{timestamp}}" 
alt="Click Here" border="0"> 
</a> 
</noscript>

Open Ad Server (OAS) / 24/7 / RealMedia

script language="JavaScript"> 
<!-- 
var RN = new String (Math.random()); 
var RNS = RN.substring (2,11); 
var oas_jx_sitepage = "Etihad_Apr2013_Set_2_FSA" ; 
var oas_jx_pos = "Middle3"; 
var publisher_click = "{{url|add("&url=%u")}}"; 
document.write("<scr" + "ipt language=\"JavaScript\" src=\"http://oas.thedigitalpartnership.com/RealMedia/ads/adstream_jx.ads/" + oas_jx_sitepage + "/1" + RNS + "@" + oas_jx_pos + "?" + publisher_click + "\"></scr" + "ipt>"); // --> 
</script>

OpenX

If you are using OpenX ad code, it should include a placeholder where you can insert the {{URL}} macro. If it doesn't, you'll want to manually add the following line of code after the first line.

document.MAX_ct0 ={{url}};

Here's an example:

<script type='text/javascript'><!--//<![cdata[ 
document.MAX_ct0={{url}}var m3_u = (location.protocol=='https:'?'https://d1.openx.org/ajs.php:'http://d1openx.org/ajs.php');

Zedo

<!-- Javascript tag -->

<!-- begin ZEDO for channel: Adzerk Display , publisher: Adzerk , Ad Dimension: Medium Rectangle - 300 x 250 -->

<script language="JavaScript">

var zflag_nid="1111"; var zflag_cid="3333/3334"; var zflag_sid="19238"; var zflag_width="300"; var zflag_height="250"; var zflag_sz="2"; var zflag_click="{{url}}&url=";

</script>

<script language="JavaScript" src="https://tt3.zedo.com/jsc/tt3/fo.js"></script>

None of the Above

If your code follows some other format, please check with the network or advertiser that sent you the code to learn how it accepts a click tracking macro. If you follow their instructions and clicks are still not tracking, please contact our support team.