From September, Flash will no longer be supported by Chrome. Prepare for the shift towards HTML5 by visiting our Flash to HTML5 help page

Check it out!

Unique naming

Introduction

Adform click tracking code is used to track clicks on a website buttons or links. The tracking code utilizes JavaScript functions, which gather visit count, basic visitor information (e.g. browser type, operating system or screen size) and sends this information along with campaign data to Adform servers.

Implementation

Click tracking code consists of a link to code library and a JavaScript tracking function. Both must be placed on the same page in order for the click tracking to work.

 

Adding tracking code library

In order for the tracking function to send out tracking requests the library must be loaded on the page beforehand:

<script type="text/javascript" src="https://track.adform.net/serving/scripts/trackpoint/"></script>

It can be added either in the HEAD, or BODY sections of the website prior to the click tracking function:

<html>
<head>
    <title>Page</title>
    <script type="text/javascript" src="https://track.adform.net/serving/scripts/trackpoint/"></script>
</head>
<body>
<button type="button">Click here!</button>
</body>
</html>

The tracking point library needs to be loaded only once per page in case of multiple click tracking point implementation.

 

Adding click tracking function

Once the library is added to the page, click tracking function can be added to track needed element on the page. In most cases it can be added via 'onclick' event:

Example HTML page implementation via onclick event:

<html>
<head>
    <title>Page</title>
    <script type="text/javascript" src="https://track.adform.net/serving/scripts/trackpoint/"></script>
</head>
<body>
<button type="button" onclick="return window.adf&&adf.ClickTrack(this, {trackingId}, 'Example Name',{});">Click here!</button>
</body>
</html>

The tracking function also supports custom implementation within page code functions, or via tag management solutions which support event triggers.

Example JavaScript code:

if (window.adf) {
    e.preventDefault();
    adf.ClickTrack(this, {trackingId}, 'Example Name', {});
}

Example JavaScript code implementation:

<html>
<head>
    <title>Page</title>
    <script type="text/javascript" src="https://track.adform.net/serving/scripts/trackpoint/"></script>
</head>
<body>
<button type="button" id="button">Click here!</button>
<script type="text/javascript">
	document.getElementById('button').addEventListener("click", function(e) {
            if (window.adf) {
                e.preventDefault();
                adf.ClickTrack(this, {trackingId}, 'Example Name',{});
            }
        });
</script>
</body>
</html>
  • Custom variables

    Additional information can be collected by the tracking point with the use of variables, such as sales, order ids, product names or other custom values.
    To collect values from the website macros from the CMS or tag manager system can be used - this information should be passed to the code via respective system variables, data layer or other tools to get variable values from the site.

    Example of the tracking code output with sales, order id and two products passed:

    window.adf&&adf.ClickTrack(this,{trackingID},'Example name',{sales:'95.29',orderid:'YWZ-487921','itms':[{productname:'Product A'},{productname:'Product B'}]});

    For more information and examples of supported variables please refer to the variables page here.

 

 Implementation check

After the tracking code has been implemented on the page it can be confirmed if it has been activated with the Adform site tracking testing browser extension - it is available to be downloaded for Chrome browser here.

Alternatively, you can check network requests via browser’s developer tools:

Click

Successful activation will result in two network requests which are:

1) Tracking point library;

2) Tracking point request, which contains the tracking setup id, tracking point name and other information sent.

For additional information please contact site tracking team at site-tracking@adform.com