On Click event working, but eVar is not recording the button title

Avatar

Avatar

mohammeda704170

Avatar

mohammeda704170

mohammeda704170

23-01-2019

Hello everyone,

We've recently introduced a language translation tool to our website and I wanted to track it's usage. I have some simple event based rules setup in DTM for Activate/Deactivate and an event based rule for the menu option which was clicked, here is where I'm experiencing issues.

The event fires if I click any of the menu options, but using this.getAttribute() with an eVar does not appear to be working.

I'm using the Custom Code Editor and the event looks a little like this:

s.linkTrackVars='eVar7,events';

s.linkTrackEvents='event7';

s.eVar7=this.getAttribute('title');

s.events='event7';

Inspecting the element using browser dev tools, one of the buttons html is as follows, and I want to capture Reset in the eVar

<button class="recite-sprite-button-reset recite-reset recite-button recite-button-primary" id="recite-toolbar-button-reset" data-recite-tabbable="" title="Reset" tabindex="163"></button>

Am I using this.getAttribute correctly in the Custom Code Editor?

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar

atuls41837987

Employee

Avatar

atuls41837987

Employee

atuls41837987
Employee

25-01-2019

Hi,

I don't see anything wrong using this.getAttribute.

I tried using similar code on my testing environment and was able to get the value for 'title' attribute into eVar.

Couple of things you can check:

> The event based in rule is firing fine on click of the button.

> Try using console.log() to troubleshooting where the issue might be.