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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Coffee Break: Join us on Wednesday, April 5th at 10am PT to chat with Ben Gaines, Director of Product Management for Adobe Analytics. Ben will be online to answer your Analytics and Adobe Summit questions.
SOLVED

Issues setting DTM Data Element by either returning value or setting data element directly

Avatar

Level 2

I have some listening code that is being served as a custom script for the data element that could make multiple updates per page view which is capturing the value of a HTML5 Custom Attribute. The issue is I can't get listening code to return the value for data element to be set. Not sure what I'm doing wrong and have tried numerous approaches. When ever I check the value of the data element I get the default value that was set in the UI. Any idea how I make the data element update every time a qualifying element is clicked?

function addEvent(el, ev, fn, uc) { if (el.addEventListener) { el.addEventListener(ev, fn, uc); } else if (el.attachEvent) { // IE8- el.attachEvent('on'+ev, fn); } } addEvent(document, 'click', function(e) { e = e || window.event; var target = e.target || e.srcElement; var customLinkName = target.getAttribute("data-analytics-tracking-name"); if(customLinkName){ //return or set customLinkName from attribute; //_satellite.setVar("custom link name", customLinkName); } }, false);
1 Accepted Solution

Avatar

Correct answer by
Level 2

I just found out from a friend that to make this work, whatever data element name I use in the _satellite.setVar function, ensure that it does not exist as a pre-defined data element. It will not allow you to overwrite the definition with the _satellite.setVar function. So I can just add a custom condition to the event rule to dynamically get the value from this attribute that was listening for the attribute click.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

I just found out from a friend that to make this work, whatever data element name I use in the _satellite.setVar function, ensure that it does not exist as a pre-defined data element. It will not allow you to overwrite the definition with the _satellite.setVar function. So I can just add a custom condition to the event rule to dynamically get the value from this attribute that was listening for the attribute click.

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now