Optimising Click Tracking With Adobe Launch

It was my honour to be invited to join an Adobe online event to share my experience using Adobe Analytics, the recording is available at Experience Makers The Skill Exchange. Video content is good but I prefer to read articles than watch videos. So I am repeating the content in the article format here.

I have two sharing in the online event and here is the first one on optimising click event tracking using Adobe Launch.


Mouse clicks are a common user interaction on websites and require tracking. However, click tracking can be complicated as there are many things users can click on and each of them may require different tracking, in terms of what event and data to be collected, such as

Click on a carousel slider and capture the slide ID

<div class="slider">
    <div id="slide1" class="slide">Promotion 1</div>
    <div id="slide2" class="slide">Hot Summer Sales</div>
</div>

Click on a button and capture the button text

<button>Click Me</button>

Click on a file download link and capture the file URL

<a href="product_info.pdf">Download</a>

The click tracking can be simply implemented in Adobe Launch by creating a rule using the Core extension and click event with a corresponding CSS selector.

However, for example like the following with all three types of click into one single user click.

<div class="slider">
    <div id="slide1" class="slide">
        <a href="product_info.pdf"><button>Download Product Info</button></a>
    </div>
    <div id="slide2" class="slide">Hot Summer Sales</div>
</div>

There are two problems with the basic click tracking where three rules are triggered and three hits sent: It costs three server calls and they are three separate hits. Unlike Google Analytics, Adobe Analytics’ cost is based on the number of hits, that is how many times sending data to their collection servers. Three hits mean paying three times upon one single user click. Moreover, three hits from one single user click may cause a problem if we start to use Data Feed, the Adobe Analytics clickstream data to analyse user behaviour. Three hits mean three separate lines of records in the clickstream data. It will look like three separate user interactions which are simply wrong.

The objective is to have only one hit sent no matter what combination of the click event, just the slider, a button for file download, or a combination of all three like the above example.

The rule order is the key to the solution.

Instead of having three rules for different click events, we have three rules for each click event setting up the tracker data and one rule to send the hit.

Those rules with order 50 only set up variables in Adobe Analytics but do not send the beacon. The send beacon is handled by another rule with order 100 and listening to all three types of events.

However, it is not working as expected there are still three hits sent and the ‘send beacon on click’ rule is executed three times.

It was because the same rule had been evaluated and matched three times, as the event bubbled through the DOM hierarchy.

To send only one single hit on various types of click events, we need to consolidate all types of click events as one in Adobe Launch, which is the ‘any element’ click then use a custom condition to evaluate if this is a click to a specific element and set up an indicator for sending hit, such as the following for button click.

if (!!this.closest("button")) {
  aaDatalayer.trackerSend = true;
  return true;
}

That is for all rules with order 50, the click event is ‘any element’ and each of them also has a custom code condition to evaluate if the event triggered from the (child) element is to be monitored.

Then in the ‘send beacon on click’ rule, we have the same ‘any element’ click event and a custom condition to check should hit being sent.

return !!aaDatalayer.trackerSend;

Finally, we need to remove the indicator as to the last action of the ‘send beacon on click’ rule.

delete aaDatalayer.trackerSend;

Now, there is only one single hit sending out as expected.

The good thing about the solution is there can be more types of click tracking on different elements by creating more rules with rule order 50 with different custom code conditions to monitor elements with click tracking required, without modifying the ‘send beacon on click’ rule.

One little issue is all those rules have the same event click on any element and are controlled by the custom condition, such there will be lots of log messages on click rules fired or not no matter what user clicked.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *