Click Tracking

Adobe Analytics – Click tracking

Every one of you may know the custom link tracking used by Adobe Analytics.

Ready to use click tracking

First of all, by default, you have the possibility to track all the link that go to an external website. This is based in your JS file that is loaded in every page.
You would need to update this line of code : “s.trackExternalLinks” and set it to “true”. After that you will need to select the eVar and event associated with this tracking.
For example : s.linkTrackEvents= ‘event1’ and s.linkTrackVars= ‘prop1’;

This is basic exit link tracking, so every time someone click on something that is not in your domain you will track the exit link he is using. You configure which links link to your internal website by editing this line of code: s.linkInternalFilters.

You may want to make sure that an exit link tracking is not launch when your user use a javascript link, because it pretty uncommon that “javascript” is one of your domain, if you don’t do that, it will fire every time.
s.linkInternalFilters=”javascript:”

There is also another “ready to use” implementation that you can use for click tracking, this is for downloading different document. This is done by passing “true” to this line on your s_code (or JS app Measurement code) s.trackDownloadLinks.
From that you can say the type of file that you want to track by editing this line of code : s.linkDownloadFileTypes. For example : s.linkDownloadFileTypes= ‘zip,doc,pdf’;

Custom Click tracking

Once you are set with these tracking, you may want to track some other stuff that your user are doing, like filtering the search result or add something to the basket.

For that kind of tracking you will need to touch a bit of “JS”. The function that you need to use for that is the s.tl()

Normally, in order to send a request to Adobe Analytics, you need to use this function at the end of your page : s.t()

The s.t() function is launching all the functions integrated in the s_doPlugin function and after send the request to Adobe Analytics. This request is counted automatically as a pageview. The s.tl() does exactly the same except it takes into account only the evars and events set on those line : s.linkTrackVars and s.linkTrackEvents and this request is not counted as a pageview.

The function as you write is like this :
s.tl(this,linkType,linkName, variableOverrides, doneAction);

‘this’ is a dynamic variable that is really important. Put like this, it will replace this by the value of the url attach with the link. However, as I said, you may use this function with something else than a link, to open a pop-up per example. In that case, you will need to use ‘true’ instead of ‘this’.

The different link type value are :

  • ‘o’ for custom – most of what I use
  • ‘e’ for exit link (that could be track automatically)
  • ‘d’ for file download (which can also be tracked automatically)

linkName can be any custom value, up to 100 characters. This determines how the link is displayed in the appropriate report.

variableOverrides and doneAction are optionnal parameters.

So basically, you can use the click tracking anywhere on your website and pass it any value that you want. As it is not that easy to do it directly in the code for every page, what I would recommend is to create a function that your dev team can use whenever they have to implement something with click tracking.

So we have seen that the basic function look like this:
s.tl(true,’o’,’something’);

You would need to add some elements around, what I recommend from experiment is to have a variable that can give you what kind of link is available and enough space in the function for getting what you want to add in any case.

This new function could look like (in JS):

function SendAdobeData(action,val1,val2,val3,val4,val5,val6){
s.linkTrackEvents=”scAdd,scRemove,eventXXXX”;/*configure Events*/
s.linkTrackVars=”events,products,propX,eVarY;/*configure eVar and prop*/
Track=true;
switch(action){
case “addBasket”:
/*condition 1 from val1, val2, val3, etc…*/
break;
case “removeBasket”:
/*condition 2 from val1, val2, val3, etc…*/
break;
case “clickTrack”:
/*condition 3 from val1, val2, val3, etc…*/
break;
default: /* Don’t forget to put a default to not fire the tag if nothing has been set*/
Track=false;
console.log(‘wrong action’)
}
if(Track){
s.tl(this,’o’,action);/*Send the request when there is an action matching*/
}
}

This will enable to track additional things than the normal click tracking and you can use this function track other thinks and fire request without click.
When, per example, on the search mask, the use of filter´field display 0 result so the user knows that this request will not get any result before searching for it. You can measure how many time this happen.

Good article about this topics by Adobe :

 

Leave a Reply

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