The Google Display Network requires that all certified third-party ad tags that host and serve creatives permit Google to dynamically generate a unique click URL and pass it through the ad tag upon each ad request.
If a user clicks the ad, the third-party vendor makes an HTTP request to the Google click URL from the user's browser. The HTTP request allows Google to track clicks on the ad.
After the vendor creates a key-value pair in the ad tag, Google inserts a placeholder (or click macro) as the value. When the third-party ad tag renders in the user’s browser, Google dynamically replaces the click macro with a unique click URL. The URL contains specific information about the impression. Because the information must be unique, and dynamically generated per impression, it cannot be hard-coded into the creative.
The third-party vendor implements the click URL such that an HTTP request is made when the user clicks the creative. Third-party tags may differ greatly in structure. The following examples demonstrate how the Google click macro can be inserted into the ad tag.
<script language='JavaScript1.1'
src="https://3rdpartydomain?key1=value1&key2=value2&cachebuster=[Cachebuster_Macro_Here]&click=[Google_Click_Macro_Here]">
</script>
<iframe bordercolor="#000000" frameborder="0" height="XXX" hspace="0" marginheight="0" marginwidth="0" scrolling="no" src="http://3rdpartydomain.com?key1=value1&key2=value2&cachebuster=[Cachebuster_Macro_Here]&click=[Google_Click_Macro_Here]" vspace="0" width="XXX">
<script type="text/javascript">
function swfver(){
var v=0;
v = <determine flash version>
return v;
}
var d=new Date();d=d.getDay()+"|"+d.getHours()+":"+d.getMinutes()+"|"+ d.getTimezoneOffset()/60;
var redir="[Google_Click_Macro_Here]";
var host=(("https:"==document.location.protocol)?"https://":"http://");
var url="3rdpartydomain.com/url_path/?flash="+swfver()+"&time="+d+"&redir="+redir+"&r="+Math.random();
document.write("<scr"+"ipt type='text/javascript' src='"+host+url+"'></scr"+"ipt>")
</script>
Types of Google click macros
Google offers different types of click macros. The difference between the click macros is how many times the characters in the click URL (where the click macro renders) has been “escaped”. The Google click URL contains a number of different key-value pairs that are delimited with characters such as “&” and “?”.
Depending on the implementation method, the Google click URL’s key-value pairs can conflict with third-party key-value pairs that use these same delimiters. The Google click URL may need to be “escaped” to eliminate any code conflicts. Here are the different click macro versions that Google offers:
Unescaped click URL: %%CLICK_URL_UNESC%%
Sample of what the macro renders to when passed through the ad tag upon ad request:
http://googleads.g.doubleclick.net/pagead/aclk?sa=l&ai=BsD-iGQbNSun3LJvqjQTg0MWeDOCtkEmu5vD7CsCNtwGQThABGAEg9084AFCAx-HEBGDJhvuGyKOQGYgBAaABzvrC_wOyARN3d3cuY29ycC5nb29nbGUuY29tugEKMzAweDI1MF9hc8gBCdoBWWh0dHA6Ly93d3cuY29ycC5nb29nbGUuY29tL2VuZy90ZXN0aW5nL1RTL2RvY3MvdGVzdHBsYW5zL2NhZmVfdGVzdGluZy90ZXN0XzNyZF9wYXJ0eS5odG1suAIYqAMB9QMAAAAE9QMEAAAA&num=1&client=ca-mongoogle&adurl=
Escaped click URL: %%CLICK_URL_ESC%%
Sample of what the macro renders to when passed through the ad tag upon ad request:
http://googleads.g.doubleclick.net/pagead/aclk%3Fsa%3Dl%26ai%3DBsD-iGQbNSun3LJvqjQTg0MWeDOCtkEmu5vD7CsCNtwGQThABGAEg9084AFCAx-HEBGDJhvuGyKOQGYgBAaABzvrC_wOyARN3d3cuY29ycC5nb29nbGUuY29tugEKMzAweDI1MF9hc8gBCdoBWWh0dHA6Ly93d3cuY29ycC5nb29nbGUuY29tL2VuZy90ZXN0aW5nL1RTL2RvY3MvdGVzdHBsYW5zL2NhZmVfdGVzdGluZy90ZXN0XzNyZF9wYXJ0eS5odG1suAIYqAMB9QMAAAAE9QMEAAAA%26num%3D1%26client%3Dca-mongoogle%26adurl%3D
Double-escaped click URL: %%CLICK_URL_ESC_ESC%%
Sample of what the macro renders to when passed through the ad tag upon ad request:
http://googleads.g.doubleclick.net/pagead/aclk%253Fsa%253Dl%2526ai%253DBsD-iGQbNSun3LJvqjQTg0MWeDOCtk Emu5vD7CsCNtwGQThABGAEg9084AFCAx-HEBGDJhvuGyKOQGYgBAaABzvrC_wOyARN3d3cuY29ycC5nb29nbGUuY29tugEKMzAweDI1MF9hc8gBCdoBWWh0dHA6Ly93d3cuY29ycC5nb29nbGUuY29tL2VuZy90ZXN0aW5nL1RTL2RvY3MvdGVzdHBsYW5zL2NhZmVfdGVzdGluZy90ZXN0XzNyZF9wYXJ0eS5odG1suAIYqAMB9QMAAAAE9QMEAAAA%2526num%253D1%2526client%253Dca-mongoogle%2526adurl%253D
Click URL implementation methods
Method 1: Redirect chain
A third-party vendor can create a chain of click URLs that redirect the user. A click is tracked every time the user hits a specific click URL. By industry standards, click URLs should redirect users to the appended URL.
Here are the options of how the third-party can create redirect chain:
- Third-party-first URL
Third-party click URL [then append] Google click URL [then append] destination URL
Result: Third-party’s Click URL [redirects to] Google click URL [redirects to] destination URL - Google-first URL
Google click URL [then append] third-party’s click URL [then append] destination URL
Result: Google click URL [redirects to] third-party’s click URL [redirects to] destination URL
Pros
Some Google trafficking tools offer a feature that validates the correct implementation of the Google click URL and that clicks are generated in Google reports. This tool only works when using the click redirect chain.
Cons
- There is added latency when sending a user to the destination page after they click the ad because of redirects.
- Different click macro versions are needed for different third-party tags since code conflicts and character-escaping issues may occur when the Google click URLs are passed through various parameters by the third-party’s scripts and when they are appended to the third-party’s URL that contain similar delimiters.
- Browsers (Internet Explorer, especially) have URL length limits. If the redirect string is too long, some of the characters are cut off by the browser, and the entire redirect path does not execute properly.
Method 2: Parallel requests
Instead of forming a long redirect chain of multiple click URLs, the third-party can redirect the user to their own click URL and then to the destination URL. While the user is being redirected to the third-party’s click URL, the third-party makes a separate client-side HTTP request to the Google click URL when the user clicks the creative.
Pros
There is less latency when the user is redirected to the destination page because there are less redirects.
Cons
Some Google trafficking tools offer a feature that validates the correct implementation of the Google click URL and that clicks are generated in Google reports. This tool only works when using the click redirect chain method above, however, so the click validation feature does not work with this method.
More information
- To learn more about click tracking, refer to the IAB Guidelines for Click Measurement.
- For click macro implementation questions, or other issues with click tracking, contact us.