Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Obtaining value from Data Attributes as data elements in DTM

haritikam738202
Level 3
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
gokula
Correct answer by
Level 4
Level 4

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
gokula
Correct answer by
Level 4
Level 4

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

haritikam738202
Level 3
Level 3

Thank you for the response! This definitely worked