Add macros to third-party ad tags
Display & Video 360 is compatible with a wide range of third-party ad servers. A number of click tracking and cache busting macros can be used to allow these third parties to track clicks for creatives served through Display & Video 360.
When you add a recognized third-party ad tag to Display & Video 360, click tracking and cache busting macros will be inserted automatically. If the tag is not recognized, you'll have to insert the macros yourself. Each third party tag looks a little different, but you can use the samples below as a guide.
What is a macro?
A macro is a placeholder (for example: ${CLICK_URL}
) that an ad server replaces with a real value when the creative serves. Use macros in your tags when you want Display & Video 360 to insert information into the tag in real time.
For example, let's say you're using this third-party ad tag:
<script type="text/javascript" src="http://example.com?click="></script>
The third-party ad server expects a Display & Video 360 click tracking URL after "click=
". To get this URL, insert a click tracking macro in the tag:
<script type="text/javascript" src="http://example.com?click=${CLICK_URL}"></script>
Each time the ad is served, the placeholder ${CLICK_URL}
is replaced with the actual click tracking URL from Display & Video 360.
Click tracking and cache busting macros
Click tracking macros are the most commonly used type of macro. These macros allow third-party ad servers to track a click and associate it with the correct creative, line item, and auction in Display & Video 360. Clicking on a creative will first direct users to the Display & Video 360 ad server (to record the click and associated auction information) before redirecting them to the advertiser's URL.
Tag and macro examples
Celtra tags
Before adding click macros:
<div class="celtra-ad-v3">
<img src="data:image/png,celtra" style="display: none" onerror="
(function(img) {
var params = {'clickUrl':'http://www.celtra.com/','preferredClickThroughWindow':'new','clickEvent':'advertiser','externalAdServer':'Custom'};
var req = document.createElement('script');
req.id = params.scriptId = 'celtra-script-' + (window.celtraScriptIndex = (window.celtraScriptIndex||0)+1);
params.clientTimestamp = new Date/1000;
var src = (window.location.protocol == 'https:' ? 'https' : 'http') + '://ads.celtra.com/65fb825c/mraid-ad.js?';
for (var k in params) {
src += '&' + encodeURIComponent(k) + '=' + encodeURIComponent(params[k]);
}
req.src = src;
img.parentNode.insertBefore(req, img.nextSibling);
})(this);
"/></div>
After adding click macros:
<div class="celtra-ad-v3">
<img src="data:image/png,celtra" style="display: none" onerror="
(function(img) {
var params = {'clickUrl':'${CLICK_URL}','preferredClickThroughWindow':'new','clickEvent':'advertiser','externalAdServer':'Custom'};
var req = document.createElement('script');
req.id = params.scriptId = 'celtra-script-' + (window.celtraScriptIndex = (window.celtraScriptIndex||0)+1);
params.clientTimestamp = new Date/1000;
var src = (window.location.protocol == 'https:' ? 'https' : 'http') + '://ads.celtra.com/65fb825c/mraid-ad.js?';
for (var k in params) {
src += '&' + encodeURIComponent(k) + '=' + encodeURIComponent(params[k]);
}
req.src = src;
img.parentNode.insertBefore(req, img.nextSibling);
})(this);
"/></div>
Conversant (formerly Mediaplex) tags
Before adding click macros:
<a href="http://adfarm.mediaplex.com/ad/ck/1091-86796-2738-5?mpt=[CACHEBUSTER]">
<img src="http://adfarm.mediaplex.com/ad/bn/1234-12345-1234-1?mpt=[CACHEBUSTER]"?alt="Click Here" border="0"></a></noscript>
After adding click macros:
<a href="${CLICK_URL}http://adfarm.mediaplex.com/ad/ck/1234-12345-1234-1?mpt=${CACHEBUSTER}"> <img src="http://adfarm.mediaplex.com/ad/bn/1091-86796-2738-5?mpt=${CACHEBUSTER}"alt="Click Here" border="0"></a></noscript>
${CLICK_URL_ENC}
but occasionally need double-encoded click-macros ${CLICK_URL_ENC_ENC}
. If your ad server doesn't indicate which to use, you can verify click tracking through Display & Video 360 during the trafficking process.Campaign Manager JavaScript tags
Before adding click macros:
<SCRIPT language='JavaScript1.1' SRC="https://ad.doubleclick.net/ddm/adj/Nxxxx.site-keyname/Byyyyyyy;sz=widthxheight;dc_expa=URL;ord=[timestamp];dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=?">
After adding click macros:
<SCRIPT language='JavaScript1.1' SRC="https://ad.doubleclick.net/ddm/adj/Nxxxx.site-keyname/Byyyyyyy;sz=widthxheight;dc_expa=URL;ord=${CACHEBUSTER};dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=
${CLICK_URL}?">
Campaign Manager ins tags
When using Campaign Manager's ins tags, add the data-dcm-click-tracker
parameter and set the value to the macro ${CLICK_URL}
. Also, to avoid reporting discrepancies, you must use script rendering mode, not iframe. (Set the data-dcm-rendering-mode attribute to "script": data-dcm-rendering-mode='script'
).
Learn more about the ins tag in the Campaign Manager Help Center
Before adding click macros:
<ins class='dcmads'
style='display:inline-block;width:300px;height:250px'
data-dcm-placement='N7480.1664088DOUBLECLICK.NETTEST/B8299600.114131924'
data-dcm-param-custom_key='custom_value'
data-dcm-rendering-mode='script'>
<script src='https://www.googletagservices.com/dcm/dcmads.js'></script>
</ins>
After adding click macros:
<ins class='dcmads'
style='display:inline-block;width:300px;height:250px'
data-dcm-placement='N7480.1664088DOUBLECLICK.NETTEST/B8299600.114131924'
data-dcm-rendering-mode='script'
data-dcm-click-tracker='${CLICK_URL}'>
<script src='https://www.googletagservices.com/dcm/dcmads.js'></script>
</ins>
Campaign Manager i-frame/JavaScript tags
Before adding click macros:
<IFRAME SRC="https://ad.doubleclick.net/ddm/adi/Nxxxx.site-keyname/Byyyyyyy;sz=widthxheight;ord=[timestamp];dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=?" WIDTH=X HEIGHT=Y MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR='#000000'>
<SCRIPT language='JavaScript1.1' SRC="https://ad.doubleclick.net/ddm/adj/Nxxxx.site-keyname/Byyyyyyy;abr=!ie;sz=widthxheight;ord=[timestamp];dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=?">
</SCRIPT>
</IFRAME>
After adding click macros:
<IFRAME SRC="https://ad.doubleclick.net/ddm/adi/Nxxxx.site-keyname/Byyyyyyy;sz=widthxheight;ord=${CACHEBUSTER};dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=${CLICK_URL}" WIDTH=X HEIGHT=Y MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR='#000000'>
<SCRIPT language='JavaScript1.1' SRC="https://ad.doubleclick.net/ddm/adj/Nxxxx.site-keyname/Byyyyyyy;abr=!ie;sz=widthxheight;ord=${CACHEBUSTER};dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=${CLICK_URL}?">
</SCRIPT>
</IFRAME>
FlashTalking and DoubleVerify tags
Before adding click macros:
<script language="javascript" type="text/javascript">
new function() {
this.rand = Math.floor((Math.random() + "") * 1000000000000);
this.dvparams = 'ctx=12345&cmp=12345&plc=12345&sid=12345';
this.dvregion = '0';
this.tagsrc = '<noscr'+'ipt>\n<a href="http://servedby.flashtalking.com/
click/4/12345;12345;0;12345;0/?url=12345" target="_blank">\n
<img border="0" src="http://servedby.flashtalking.com/imp/4/12345;12345;12345;gif;
FIOS112MDUInviteBT2DallasDMAMPG3160x600FT213to331/?"></a>\n
</noscr'+'ipt>\n<scr'+'ipt language="Javascr'+'ipt1.1" type="text/javascr'+'ipt">
\nvar ftClick = "";\nvar ftX = "";\nvar ftY = "";\nvar ftZ = "";\nvar ftContent = "";
\nvar ftCustom = "";\nvar ft160x600_OOBclickTrack = "";\nvar ftRandom = Math.random()*1000000;
\nvar ftBuildTag1 = "<scr";\nvar ftBuildTag2 = "</";\nvar ftTag = ftBuildTag1 +
'ipt language="javascr'+'ipt1.1" type="text/javascr'+'ipt" ';nftTag +=
'src="http://servedby.flashtalking.com/imp/4/12345;12345;12345;js;
FIOS112MDUInviteBT2DallasDMAMPG3160x600FT213to331/?click='+ftClick+'&
ftx='+ftX+'&fty='+ftY+'&ftadz='+ftZ+'&ftscw='+ftContent+'&
ft_custom='+ftCustomn+'&cachebuster='+ftRandom+'" id="ftscr'+'ipt_160x600"
name="ftscr'+'ipt_160x600"';nftTag += '">' + ftBuildTag2 + 'scr'+'ipt>
';ndocument.write(ftTag);\n</scr'+'ipt>nn';
this.altsrc = '<a href="http://www.example.com/defaultads/comp160x600.gif"
width="160" height="600" border="0"></a>';
this.callbackName = '__dvredirect_callback_' + this.rand;
var thisRedirect = this;
window[this.callbackName] = function () { return thisRedirect; };
var src = 'http://rtbcdn.doubleverify.com/bsredirect5.js?callback=' + this.callbackName;
document.write('<scr' + 'ipt src=' + src + '></scr' + 'ipt>');
}
</script>
After adding click macros:
<script language="javascript" type="text/javascript">
new function() {
this.rand = Math.floor((Math.random() + "") * 1000000000000);
this.dvparams = 'ctx=12345&cmp=12345&plc=12345&sid=12345';
this.dvregion = '0';
this.tagsrc = '<noscr'+'ipt>\n<a href="${CLICK_URL}http://servedby.flashtalking.com/
click/4/12345;12345;0;12345;0/?url=1419304" target="_blank">\n
<img border="0" src="http://servedby.flashtalking.com/imp/4/12345;12345;12345;gif;
FIOS112MDUInviteBT2DallasDMAMPG3160x600FT213to331/?"></a>\n
</noscr'+'ipt>\n<scr'+'ipt language="Javascr'+'ipt1.1" type="text/javascr'+'ipt">
\nvar ftClick = "${CLICK_URL_ENC}";\nvar ftX = "";\nvar ftY = "";\nvar ftZ = "";\nvar ftContent = "";
\nvar ftCustom = "";\nvar ft160x600_OOBclickTrack = "";\nvar ftRandom = Math.random()*1000000;
\nvar ftBuildTag1 = "<scr";\nvar ftBuildTag2 = "</";\nvar ftTag = ftBuildTag1 +
'ipt language="javascr'+'ipt1.1" type="text/javascr'+'ipt" ';nftTag +=
'src="http://servedby.flashtalking.com/imp/4/12345;12345;12345;js;
FIOS112MDUInviteBT2DallasDMAMPG3160x600FT213to331/?click='+ftClick+'&
ftx='+ftX+'&fty='+ftY+'&ftadz='+ftZ+'&ftscw='+ftContent+'&
ft_custom='+ftCustomn+'&cachebuster='+ftRandom+'" id="ftscr'+'ipt_160x600"
name="ftscr'+'ipt_160x600"';nftTag += '">' + ftBuildTag2 + 'scr'+'ipt>
';ndocument.write(ftTag);\n</scr'+'ipt>nn';
this.altsrc = '<a href="http://www.example.com/defaultads/comp160x600.gif"
width="160" height="600" border="0"></a>';
this.callbackName = '__dvredirect_callback_' + this.rand;
var thisRedirect = this;
window[this.callbackName] = function () { return thisRedirect; };
var src = 'http://rtbcdn.doubleverify.com/bsredirect5.js?callback=' + this.callbackName;
document.write('<scr' + 'ipt src=' + src + '></scr' + 'ipt>');
}
</script>
Sizmek tags
Please note, Display & Video 360 will automatically insert click tracking macros into your Sizmek tags for you.
Type I tags
Before click macros:
<noscript>
<a href="http://bs.serving-sys.com/BurstingPipe/BannerRedirect.asp?FlightID=1234567&Page=&PluID=0&Pos=5756" target="_blank"><img src="http://bs.serving-sys.com/BurstingPipe/BannerSource.asp?FlightID=1280098&Page=&PluID=0&Pos=5756" border=0 width=160 height=600></a>
</noscript>
After adding click macros:
<noscript>
<a href="${CLICK_URL}http://bs.serving-sys.com/BurstingPipe/BannerRedirect.asp?FlightID=134567&Page=&PluID=0&Pos=5756" target="_blank"><img src="http://bs.serving-sys.com/BurstingPipe/BannerSource.asp?FlightID=1234567&Page=&PluID=0&Pos=5756" border=0 width=160 height=600></a>
</noscript>
Type II tags
Before adding click macros:
After adding click macros: