AdvertPRO Click Tracking

Note Note

Providing these code formats to an advertiser or publisher that will run them through a third-party ad server is not recommended. Instead you should use the third-party code wizard to generate code for them. This specialized code wizard is able to output placeholders for click tracking, random number and timestamp macros so you don't have to enter them manually! In fact, if you know the macros used by their ad server you can enter the real macros instead of using placeholders.



AJAX Code


Original Code

You should have received some AJAX code from AdvertPRO that looks like the following:

<!-- BEGIN ADVERTPRO CODE --><scripttype="text/javascript">var _avp = _avp || [];   (function() {var s = document.createElement('script');     s.type = 'text/javascript'; s.async = true; s.src = '/adserver/js/libcode2.js';     var x = document.getElementsByTagName('script')[0];     x.parentNode.insertBefore(s, x);   })(); </script><!-- END ADVERTPRO CODE --><!-- BEGIN ADVERTPRO CODE --><DIVid="avp_zid_7"><SCRIPTtype="text/javascript"> _avp.push({ tagid: 'avp_zid_7', alias: '/adserver', type: 'banner', zid: 7, pid: 0 }); </SCRIPT></DIV><!-- END ADVERTPRO CODE -->


Modified Code

What you need to do is add two variables in the <SCRIPT> code as shown by the highlighted changes:

<!-- BEGIN ADVERTPRO CODE --><scripttype="text/javascript">var _avp = _avp || [];   (function() {var s = document.createElement('script');     s.type = 'text/javascript'; s.async = true; s.src = '/adserver/js/libcode2.js';     var x = document.getElementsByTagName('script')[0];     x.parentNode.insertBefore(s, x);   })(); </script><!-- END ADVERTPRO CODE --><!-- BEGIN ADVERTPRO CODE --><DIVid="avp_zid_7"><SCRIPTtype="text/javascript"> _avp.push({ tagid: 'avp_zid_7', alias: '/adserver', type: 'banner', zid: 7, pid: 0, encode: 1, cturl: '%%C%%?' }); </SCRIPT></DIV><!-- END ADVERTPRO CODE -->

Note Note

For third party ad servers, you will need to replace %%CLICKLINK%% with their click tracking macro. Be aware that some third party ad servers cannot handle redirects being sent back to them in escaped/encoded form. You can deal with this by changing the value of the encode parameter to zero. It may also be changed to a value greater than zero should multiple escaping/encoding passes be required.



HTML Code


Original Code

You should have received some HTML code from AdvertPRO that looks like the following:

<!-- BEGIN ADVERTPRO CODE --><SCRIPTtype="text/javascript"> document.write('<SCR'+'IPT src="http://adserver.example.com/servlet/view/banner/javascript/zone?zid=7&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'&referrer='+encodeURIComponent(document.location)+'" type="text/javascript"></SCR'+'IPT>'); </SCRIPT><NOSCRIPT><IFRAMEsrc="http://adserver.example.com/servlet/view/banner/html/zone?zid=7&pid=0"height="600"width="120"hspace="0"vspace="0"frameborder="0"marginwidth="0"marginheight="0"scrolling="no"><Ahref="http://adserver.example.com/servlet/click/zone?zid=7&pid=0&lookup=true&position=1"rel="nofollow"target="_blank"><IMGsrc="http://adserver.example.com/servlet/view/banner/image/zone?zid=7&pid=0&position=1"height="600"width="120"hspace="0"vspace="0"border="0"alt="Click Here!"></A></IFRAME></NOSCRIPT><!-- END ADVERTPRO CODE -->


Modified Code

What you need to do is modify the URL in the <SCRIPT>, <IFRAME> and <A> tags as shown by the highlighted changes:

<!-- BEGIN ADVERTPRO CODE --><SCRIPTtype="text/javascript"> document.write('<SCR'+'IPT src="http://adserver.example.com/servlet/view/banner/javascript/zone?zid=7&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'&encode=1&referrer='+encodeURIComponent(document.location)+'&cturl=%%C%%?" type="text/javascript"></SCR'+'IPT>'); </SCRIPT><NOSCRIPT><IFRAME src="http://adserver.example.com/servlet/view/banner/html/zone?zid=7&pid=0&encode=1&cturl=%%C%%?"height="600"width="120"hspace="0"vspace="0"frameborder="0"marginwidth="0"marginheight="0"scrolling="no"><A href="http://adserver.example.com/servlet/click/zone?zid=7&pid=0&lookup=true&position=1&encode=1&cturl=%%C%%?"rel="nofollow"target="_blank"><IMGsrc="http://adserver.example.com/servlet/view/banner/image/zone?zid=7&pid=0&position=1"height="600"width="120"hspace="0"vspace="0"border="0"alt="Click Here!"></A></IFRAME></NOSCRIPT><!-- END ADVERTPRO CODE -->

Warning Warning

It is extremely important that the cturl parameter be added to the end of the URLs in every <SCRIPT>, <IFRAME>, and <A> tag. AdvertPRO may misinterpret your click tracking URL if it is not the last parameter. This is due to the fact that AdvertPRO uses methods not standard to the HTTP URL specification to parse parameters in an effort to be compatible with third party ad servers that do not properly URL encode their tracking URLs.

Additionally, if you must also specify referrer or redirect parameters in the URLs, they must be in this order: referrer, cturl, redirect at the end of the URLs.

Note Note

For third party ad servers, you will need to replace %%C%%? with their click tracking macro. Be aware that some third party ad servers cannot handle redirects being sent back to them in escaped/encoded form. You can deal with this by changing the value of the encode parameter to zero. It may also be changed to a value greater than zero should multiple escaping/encoding passes be required.



JavaScript Code


Original Code

You should have received some JavaScript code from AdvertPRO that looks like the following:

<!-- BEGIN ADVERTPRO CODE --><SCRIPTsrc="http://adserver.example.com/js/libcode1_noajax.js"type="text/javascript"></SCRIPT><!-- END ADVERTPRO CODE --><!-- BEGIN ADVERTPRO CODE --><SCRIPTtype="text/javascript">if (document.avp_ready) { avp_zone({ base: 'adserver.example.com', type: 'banner', zid: 7, pid: 0 }); } </SCRIPT><!-- END ADVERTPRO CODE -->


Modified Code

What you need to do is modify the URL in the <A> tag as shown by the highlighted changes:

<!-- BEGIN ADVERTPRO CODE --><SCRIPTsrc="http://adserver.example.com/js/libcode1_noajax.js"type="text/javascript"></SCRIPT><!-- END ADVERTPRO CODE --><!-- BEGIN ADVERTPRO CODE --><SCRIPTtype="text/javascript">if (document.avp_ready) { avp_zone({ base: 'adserver.example.com', type: 'banner', zid: 7, pid: 0, encode: 1, cturl: '%%C%%?' }); } </SCRIPT><!-- END ADVERTPRO CODE -->

Note Note

For third party ad servers, you will need to replace %%C%%? with their click tracking macro. Be aware that some third party ad servers cannot handle redirects being sent back to them in escaped/encoded form. You can deal with this by changing the value of the encode parameter to zero. It may also be changed to a value greater than zero should multiple escaping/encoding passes be required.



Source:  http://www.advertserve.com/docs/3.5/html/manual/thirdparty_advertpro.html