The only one maybe missing from his list is the %this.@cleanText% which will pick up the text within the object you wish to track.

However, sometimes using these can be less useful, especially when the site mark-up is poor and doesn’t contain the right information within the element to pass into a Prop or an eVar.

One option is to populate the variable value is to create data element. However the downside is that these often fail to execute/capture in time for onclick event.

Another method is to use the custom code element within the Event Based Rule Adobe Analytics tag. This has happened to me a lot the past couple of months especially when two different elements direct the user to the same destination but the markup is different.

In the example below, a user clicks on the coupon image [highlighted in red] within this page https://www.sainsburysentertainment.co.uk/ and we want to populate a variable with the href value.

Unfortunately, using DTM’s built-in CSS selector %this.href% doesn’t work if I want to pass the href value when someone clicks on the image. This is because the image (‘img’) element clicked (on line 3), does not have an ‘href’ attribute. It just has a ‘src’ attribute which is too long and an ‘alt’ tag that contains a very generic keyword.

Therefore, we need to traverse upwards to line 2 and grab the href so the example below should do the trick…

$(this).find("a").attr("href");

Next we need to set the href value in a Adobe Analytics variable…

s.eVarXX=$(this).find("a").attr("href");

And finally, we need to append eVarXX to any other variable contained in the core s.tl() call.

How to generate meaningful descriptions for your Content Interaction variable

Continuing with the event based rules example, on the same website, the “About us” page has the following component (again with different attributes):

This makes it tricky to generate a meaningful description for your Call to action variable, without creating multiple rules which are a pain to maintain. In the example above, a user may click on the image [A] or on the text [B] and in both cases he will be redirected to the same destination page. You now want 1 event to fire in both cases and record exactly the same value.

Item ‘A’ is an image that contains an alt tag.

However when you look at the site’s markup, Item ‘A’ is an image that contains an alt tag:

About YiannisG

Yiannis has twelve years experience working in digital marketing and was an early enthusiast and adopter of web analytics. He is currently working as a senior digital analyst and has held different positions at various companies such as Tesco, Gain Capital, City Index, Art Division, Middlesex University, Ford, Honda to name a few. He has also worked as a consultant for various private firms and digital agencies, primarily for web analytics and biddable media set up & optimisation. In his spare time he is working on various SEO projects - but in reality he is trying to outwit Google.