The following presents a guideline on how PhpAdsNew standard and rich media tags should be edited to count clicks in Google Ad Manager. In order to track clicks follow the procedure below:
JavaScript Code
Original Code
You should have received some JavaScript code from PhpAdsNew that looks similar to the following example:
<script language='JavaScript' type='text/javascript'>
<!--
// Insert click tracking URL here
document.phpAds_ct0 = 'Insert_Clicktrack_URL_Here';
var rnd = Math.floor(Math.random()*99999999999);
var protocol = location.protocol.indexOf('https')>-1?'https:':'http:';
if (!document.phpAds_used) document.phpAds_used = ',';
document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
document.write (protocol+"//www.xyz.net/adjs.php?n=9d7w8g1e");
document.write ("&zoneid=875");
document.write ("&exclude=" + document.phpAds_used);
document.write ("&loc=" + escape(window.location));
if (document.referrer)
document.write ("&referer=" + escape(document.referrer));
document.write ('&r=' + awrz_rnd);
document.write ("&ct0=" + escape(document.phpAds_ct0));
document.write ("'><" + "/script>");
//-->
</script>
<noscript>
<a href="https://www.xyz.net/adclick.php?n=9d7w8g1e" target="_blank">
<img src="https://www.xyz.net/adview.php?zoneid=875&n=9d7w8g1e" border="0" alt="">
</a>
</noscript>
Modified Code
What you need to do is modify the URL in the <SCRIPT> and <A> tags as shown by the highlighted changes, The resulting tag should look similar to the following example:
<script language='JavaScript' type='text/javascript'>
<!--
// Insert click tracking URL here
document.phpAds_ct0 = '%%CLICK_URL_UNESC%%';
var rnd = Math.floor(Math.random()*99999999999);
var protocol = location.protocol.indexOf('https')>-1?'https:':'http:';
if (!document.phpAds_used) document.phpAds_used = ',';
document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
document.write (protocol+"//www.xyz.net/adjs.php?n=9d7w8g1e");
document.write ("&zoneid=875");
document.write ("&exclude=" + document.phpAds_used);
document.write ("&loc=" + escape(window.location));
if (document.referrer)
document.write ("&referer=" + escape(document.referrer));
document.write ('&r=' + awrz_rnd);
document.write ("&ct0=" + escape(document.phpAds_ct0));
document.write ("'><" + "/script>");
//-->
</script>
<noscript>
<a href="%%CLICK_URL_UNESC%%https://www.xyz.net/adclick.php?n=9d7w8g1e" target="_blank">
<img src="https://www.xyz.net/adview.php?zoneid=875&n=9d7w8g1e" border="0" alt="">
</a>
</noscript>
Note
The ad server recognises the [timestamp] placeholder and will automatically replace it with a cache buster. It is not necessary to convert it to the %%CACHEBUSTER%% macro manually.
Use %%CLICK_URL_UNESC%%
at the beginning of a link. Use %%CLICK_URL_ESC%%
when the click-tracker is the parameter of another URL.
<a href="%%CLICK_URL_UNESC%%https://www.google.com">link</a>
<a href="https://www.google.com?rd_url=%%CLICK_URL_ESC%%">link</a>