Attaching a Click Tracker to Your HTML5 Ad

Jump Ahead


For Growth Channel Activate DSP HTML5 Creative, the Growth Channel click tracker will need to be manually added to each HTML5 Creative’s root HTML document (for ads generated from most builders, this document is named index.html in the root directory of the HTML5 Asset Package zip file). All click through URLs must be located in the root HTML document and the Growth Channel click tracker must be prepended to all click through URLs to ensure tracking of clicks during ad serving.

Below are guidelines on how the Growth Channel click tracker can be added into the document for a sample set of scenarios. Please note that the guidelines do not cover all possible scenarios. It is up to you to ensure that the click tracker is included in the HTML document.

Step 1: Open The Root HTML Document For Your Creative

  • Open the root HTML document for your HTML5 ad. In most cases, this is the document named ‘index.html’ in the HTML5 Asset Package.

Step 2: Add Growth Channel Click Tracker To All Clickable Elements

Scenario A: Click Implementation via JavaScript Variables

HTML5 ads may implement click through via JavaScript variables.

In such cases, the click through is often implemented via a variable named ‘clickTag’ (although different may have different names for the variable) enclosed within script tags as shown below:

/*

<script type="text/javascript">

<--Javascript or HTML Markup-->

var clickTag = "https://www.destinationURL.com"; </script>

*/

In this case, Growth Channel unencoded click tracker will be prepended to the click through url (https://www.destinationURL.com) as shown below:

/*

<script type="text/javascript">

<--Javascript Markup-->

var clickTag = "[UNENCODED_CLICK_REDIRECT]https://www.destinationURL.com"; </script>

*/

Please note that using the following method to implement click through in the body of the HTML document in Firefox will result in a successful redirect to the click through url in a new tab.

However, the ad served in the original tab will disappear and be replaced by the text “[object Window]”

.javascript:window.open(“[UNENCODED_CLICK_REDIRECT]https://www.destinationURL.com”)

This is because Firefox expects a value to be returned for the JavaScript function. If it does not receive a value, it replaces the HTML body with “[object Window]”. This can be fixed by forcing the expression to return a value by modifying the click through expression to:

javascript:void(window.open(“[UNENCODED_CLICK_REDIRECT]https://www.destinationURL.com”));

Scenario B: Click Implementation via HTML Attributes

HTML5 ads may implement click through via HTML attributes. In such cases, the click through is often implemented via the ‘href’ attribute which is enclosed in anchor <a> tags. as shown below:

<a href="https://www.destinationURL.com">  <--HTML Markup-->  </a>

In this case, Growth Channel unencoded click tracker will be prepended to the click through url (https://www.growthchannel.io) as shown below:

<a href="[UNENCODED_CLICK_REDIRECT]https://www.destinationURL.com"> <--HTML Markup--> </a>

Please note that using the href attribute to implement click through will result in the click through breaking when all of the following conditions are met:

  • The ad is served on a device with iOS version 9 or higher installed
  • The ad's click through redirects to the iOS App Store

To avoid broken redirects when the above conditions are met, please use an alternative method for implementation of click through.

Step 3: Save and Test

  • Save the root HTML document.
  • Open the document in a web browser and try clicking on the ad.
  • In your test, the click will lead you to an error page which has the local file path followed by the Growth Channel Click Tracker and your click through URL in the browser address bar as shown below:
  • file:///LocalFilePath/[UNENCODED_CLICK_REDIRECT] https://www.destinationURL.com

  • This is the expected result and a sign that your ad will click through as expected. This can be confirmed by testing the click through in Growth Channel preview.
  • During ad serving, the click tracker will be expanded to ensure that Growth Channel tracks all clicks for impressions served and the click tracker redirects to the valid, desired click through URL.

Step 4: Zip Ad Contents

  • Select all of the files / folders of the ad and compress the contents into a zip file.
  • You are now ready to upload your HTML5 ad into Growth Channel!


Additional Helpful Resources:

IAB HTML5 Resources: https://www.iab.com/?s=html5

IAB MRAID Resources: https://www.iab.com/?s=mraid&post_type=iab_guideline

IAB VPAID Resources: https://www.iab.com/?s=vpaid&post_type=iab_guideline

IAB Creative Specifications: https://www.iab.com/?s=creative%20specifications

     **These are not always the same as Growth Channel specifications as we normalize against our supply source requirements.**