Expand my Community achievements bar.

SOLVED

Clicks tracking

Avatar

Level 5

Hey guys!
the person who did the starting setup in some of our sites created specific rules to track some button clicks (using CSS) - including the evars (page name, page URL, report suit, and click text (%Event Text Content%) and in the data element part created one called "Click Info - Click Text" where I believe collects the text of the button. 

fern1_0-1661274294112.png

However, now that I´ve to create new ones, I realized that we have buttons with the same CSS class (our system is the low code ones), and also the same texts.. So I don't really know specifically which button was clicked. In this case they are all in the banner slider but some are in other parts of the website.

How can I know specifically what buttons were clicked in this case?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

For eVar9, you should be using %Click Info - Click URL%, which is the name of your data element.

yuhuisg_0-1661396935451.png

Both the "Event Text Content" and "Click Info - Click Text" do the exact same thing, that's why when eVar8 is set with %Event Text Content%, AA can report the link name properly.

Personally, I would change eVar8 and eVar9 to use "this", i.e.

eVar8 = %this.@cleanText%

eVar9 = %this.href%

Reference: https://jimalytics.com/wp-content/uploads/2017/11/Adobe-Launch-Cheat-Sheet.pdf

View solution in original post

4 Replies

Avatar

Community Advisor

Take advantage of the power of the "this" variable.

In Tags, "this" refers to the DOM element that caused a Rule event to get triggered. In the case of the Click event, "this" refers to the DOM element that the user had clicked. Though your Click event may have a selector that matches more than one item, e.g. the selector could be as simple as "a[href]", but "this" will always refer to the one specific element that triggered the event. E.g. if my web page has 3 <A> elements and I click the 2nd one, then "this" would refer to that 2nd <A> DOM element.

So now, in the Rule's action, you can set your click text with %this.@cleanText% .  What this does is to get the text content of the clicked DOM element. The special operator "@cleanText" returns the trimmed version of the text content, i.e. no leading nor trailing whitespace. (In JavaScript, that's similar to the String trim() function.)

Note: the "this" variable makes sense within the context of the Rule. E.g. if you have another Rule with a Click event, but that Click event has the selector "button", then when that Rule's actions run, the "this" would refer to the specific <BUTTON> DOM element that the user had clicked.

Hope that helps!

Avatar

Level 5

thank you for answering.. but just to add this..
since the CSS is the same, and so the text inside the button, the alternative would be tracking with the href.. 

in the data elements, we have:

fern1_0-1661359523161.png

I believe it's tracking the text inside the button..

fern1_1-1661359570632.png

this one tracking the href (naming it URL)
and:

fern1_2-1661359609894.png

That one is confusing me, considering it's the same code as the first one I posted here. 

For the rules, it was created specifically for the button we want to track.. 

fern1_3-1661360144415.png

so we have two eVars on report suite, the 8 and 9 to track click text and click URL.. 
and also an event 7 clicks..
 
on analytics, when I used the event clicks with the dimension evar 8, I can see correctly the name of the button, but because we have other buttons with the same name, I don't know if it was the one this setup is about..
But when I put the URL eVar, this is what it shows to me on Analytics

fern1_4-1661360325620.png

Im not sure if the %click element URL% is correct considering that the text one is called %event text content%.

Still quite confused here.







Avatar

Correct answer by
Community Advisor

For eVar9, you should be using %Click Info - Click URL%, which is the name of your data element.

yuhuisg_0-1661396935451.png

Both the "Event Text Content" and "Click Info - Click Text" do the exact same thing, that's why when eVar8 is set with %Event Text Content%, AA can report the link name properly.

Personally, I would change eVar8 and eVar9 to use "this", i.e.

eVar8 = %this.@cleanText%

eVar9 = %this.href%

Reference: https://jimalytics.com/wp-content/uploads/2017/11/Adobe-Launch-Cheat-Sheet.pdf

Avatar

Level 5

Thank you so much!!!

will switch it to %this!!