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

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

Avatar

Avatar
Validate 1
Level 2
michael_johns_6
Level 2

Likes

0 likes

Total Posts

19 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
michael_johns_6
Level 2

Likes

0 likes

Total Posts

19 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Affirm 1
View profile
michael_johns_6
Level 2

15-10-2015

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);
View Entire Topic

Avatar

Avatar
Validate 1
Level 2
michael_johns_6
Level 2

Likes

0 likes

Total Posts

19 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
michael_johns_6
Level 2

Likes

0 likes

Total Posts

19 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Affirm 1
View profile
michael_johns_6
Level 2

15-10-2015

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.