How to count clicks on third-party ad tags

in Revive Adserver

This article for experienced users explains how to count clicks on ads that are created using html or javascript code from third parties.

Introduction

In almost all cases, third-party ad codes will enable the advertiser or ad agency to count the clicks on their own system. From time to time, it might be useful to be able to count these clicks in your own Revive Adserver system as well. For example, when you’re running a cost-per-click campaign, this will enable you to validate that the clicks reported by the external system are a close enough match to your own click count.

The Revive Adserver software has a feature called “magic macros”, which are little snippets of text in curly braces. You simply paste these macro codes into a banner, and every time the banner is delivered to a website, it is replaced in real time with the actual value. One of these magic macros can be used to inject a ‘click tracker’ into an HTML ad or javascript ad.

This is an article for experienced users. Make sure to first study the article about How to create an HTML banner first.

Requirements

In order for the click tracker macro to work, the third party ad must have a place where the macro can be inserted.

HTML code

In case the third party ad code is simply a piece of HTML code, this will be relatively simple.

Here is an example of what the HTML code could look like:

<a href=”https://www.example.com/landing-page.html” title=”A text that shows up when hovering the ad with a mouse”><img src=”https://www.example.com/banner.png”></a>

Automatic click tracker insertion

When you paste a piece of code like this into an HTML banner, you can use the “Alter HTML to enable click tracking for:” option underneath the code box, and pick the “Generic HTML Banner” option. This will instruct the Revive Adserver software to look for the landing page URL in the code and insert the click tracker automatically.

HTML banner - automatic click tracking

Manual click tracker insertion

Sometimes the automatic insertion might not work as expected, or you might prefer to manually insert the click tracker macro yourself.

First off, make sure to use the “Alter HTML to enable click tracking for:” option underneath the code box, and pick the “Do not alter HTML” option.

Next, just look for the <a> tag in the code, and then the href attribute in that tag. This is the place where the click tracker must be added.

The click tracking macro is {click_url}.

Here is an example of the HTML code, now with the click tracker macro inserted:

<a href=”{click_url}https://www.example.com/landing-page.html” title=”A text that shows up when hovering the ad with a mouse”><img src=”https://www.example.com/banner.png”></a>

HTML banner - manual click tracking

How click tracking works

When a banner with the click tracking enabled gets delivered, either with the automatically inserted click tracker or the manually inserted click tracker, the Revive Adserver software will dynamically change the code of the banner and insert a click tracking URL.

When a visitor sees a banner with a click tracker inserted, and clicks it, they are first taken to the click tracking URL of your own Revive Adserver installation. The fact that this URL is triggered means that 1 click is counted.

Immediately after that, the Revive Adserver software will redirect the visitor’s browser to the actual landing page URL. The redirect will almost always happen so quickly that the visitor won’t even notice it.

Javascript ad code

Instead of a simple piece of HTMl code, the advertiser, ad agency or ad network may have sent you a piece of javascript code. In some cases, you’ll see a placeholder that indicates clearly where the click tracker must be inserted. In other cases, the party that sent you the javascript tag won’t have accounted for the click tracking. If that’s the case, you’ll need to get in touch with them and ask them for specific guidance on how and where to insert the click tracking macro.

Make sure to select the option “Do not alter HTML” in case you’re using a third party javascript code.

When a banner containing a javascript tag gets delivered, the Revive Adserver software will dynamically insert the click tracking URL in the place where the {click_url}macro is found.

When a visitor sees a banner with a click tracker inserted, and clicks it, the javascript code that takes care of clicks will be executed. This is purely the responsibility of the third party code. The javascript code will then trigger a call to your own Revive Adserver installation, which will take care of counting the click.

Additional tips

There is a list of all available magic macros on the Revive Adserver documentation subsite.

We do NOT recommend attempting to track clicks on Google AdSense tags or any other tags from Google systems. The reason is that Google constantly changes and updates their tags and/or how they work, and as a result, click tracking on such tags hasn’t been reliable for a number of years.