Obtaining value from Data Attributes as data elements in DTM | Community
Skip to main content
haritikam738202
Level 2
September 24, 2018
Solved

Obtaining value from Data Attributes as data elements in DTM

  • September 24, 2018
  • 2 replies
  • 3518 views

Hi,

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

I have defined the Data Element value as below:

and set the Event based rule shown below:

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Gokul_Agiwal

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.

2 replies

Gokul_Agiwal
Community Advisor
Gokul_AgiwalCommunity AdvisorAccepted solution
Community Advisor
September 26, 2018

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.

haritikam738202
Level 2
September 26, 2018

Thank you for the response! This definitely worked