Click tracking in HTML5 / Rich Media banners

Ad Butler uses a variety of macros to facilitate tracking clicks on HTML 5 Rich Media Ads. When an HTML5 ad is served by Ad Butler, any macros present in "index.html" will be replaced. If the ads are incoming from a 3rd-party ad server, read more about serving 3rd Party ad tags ...


View a full list of our macros....

HTML5 Supported Macros

[TRACKING_LINK] Unescaped click tracking macro.
[TRACKING_LINK_ENCODED] Escaped click tracking macro.
[RND] A random number generator.
[TIMESTAMP] The current timestamp.

Click Macro Implementation

JavaScript Method

The most common method of implementing click tracking in an HTML5 ad is inserting the click macro script into the index HTML file of your ad.

In the of the HTML file, add:

<script>window.clickTag = '[TRACKING_LINK]';</script>

In the click handler function of your ad, ensure that window.clickTag is used as the redirect URL:

window.open(window.clickTag, '_blank');

Basic Link Method

A less common method is the "Basic Link Method", which can only be used if JavaScript is not being used for click redirection.

A simple example of how one would introduce the Macro without JavaScript:

<a href="[TRACKING_LINK]", target="_blank">CLICK ME</a>
If you're using a 3rd party creation program you can create an ad that has a click event or clickable region, but instead of using the banner's destination URL as the target for the click, insert one of our click tracking macros instead. You will need to make sure that when the ad is exported, that the macro is contained within the file named "index.html".

Can't find what you're looking for?

Send us an email

hello@adbutler.com

Visit the blog

For more ad serving tips, industry news and AdButler insights.