Expand my Community achievements bar.

SOLVED

Obtaining value from Data Attributes as data elements in DTM

Avatar

Level 3

Hi,

I am trying to obtain the value of the following data attributes dynamically in a prop on the site www.eonline.com

Screen Shot 2018-09-24 at 2.57.03 PM.png

I have defined the Data Element value as below:

Screen Shot 2018-09-24 at 2.56.44 PM.png

and set the Event based rule shown below:

Screen Shot 2018-09-24 at 2.56.31 PM.png

Site link: www.eonline.com

However, when I click on the element - a click event fires but ONLY shows value of the first click and does not change value as per the change in the Data Attributes

Any help will be greatly appreciated!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

better instead of creating data element, can you please try below. It might be help you in your scenario.

The easiest way to capture the values of a data attribute against an eVar or prop on the element clicked using DTM is to set the input as the following:

prop38 = %this.getAttribute(data-attributename)%

More detail on data attributes can be found at http://www.digitalbalance.com.au/our-blog/event-based-tracking-using-html5-custom-data-attributes/

Hope this helps you.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi,

better instead of creating data element, can you please try below. It might be help you in your scenario.

The easiest way to capture the values of a data attribute against an eVar or prop on the element clicked using DTM is to set the input as the following:

prop38 = %this.getAttribute(data-attributename)%

More detail on data attributes can be found at http://www.digitalbalance.com.au/our-blog/event-based-tracking-using-html5-custom-data-attributes/

Hope this helps you.

Avatar

Level 3

Thank you for the response! This definitely worked