How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

sarah_champerno
New Member
sarah_champerno

I originally tried to implement the solution described here: https://community.tealiumiq.com/t5/Mobile/How-to-map-contextData-variables-in-SiteCatalyst-mobile-ap...

 

But it did not work at all. The â c.____â feature described seems to only work in the SiteCatalyst mobile app. I have tested and found that the non-mobile SiteCatalyst tag will handle context data variables if declared explicitly. That is, I can write a javascript extension like this:

 

s.contextData[â fooâ ] = b.data_layer_element and the mapping succeeds â the context data variable and its value are sent in the image request as Iâ d like them to be.

 

However this is very tedious for mapping many values, and the extension doesnâ t have the same in-built error handling as the data layer settings within the tag. Is there a Tealium feature that will map the values of data layer elements to a SiteCatalyst context data variable, preferably within the data layer mapping of the tag?

 

Thanks,

Sarah.

15 REPLIES 15

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

Tealium Employee

Sarah,

 

Thanks for posting and providing these details. We'll definitely plan to update the SiteCatalyst tag to support this via mapping.

 

For now, please try out the Extension code above. This will allow for mapping of "c.something" in Mapping Toolbox.

 

-Ty

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

sarah_champerno
New Member
sarah_champerno

Thank you! Really appreciate it.

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

sarah_champerno
New Member
sarah_champerno

This solution works

Highlighted

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

Tealium Employee

Good ole s.linkTrackVars.. :-) Updated extension below will add the variable name to linkTrackVars list.

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

sarah_champerno
New Member
sarah_champerno

I thought so :). Thanks for the quick update.

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

sarah_champerno
New Member
sarah_champerno

Ok. So this is still not working for a call like utag.link({registration_start: "true"}), I have a mapping: registration_start -> c.registrationstart. I'm not totally clear on the inner workings of Tealium but I couldn't tell if your code is looking only in the page data layer, or in the "temporary" data layer that is created inside a utag.link call. registration_start is not in the page data layer. So maybe registration_start is showing up as undefined? Not sure. Please let me know.

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

Tealium Employee

All Extensions again will run with the new data layer passed to utag.link.

I did this same test and it should work. I'm using latest utag.js template and SiteCatalyst App Measurement for JS tag.

At this point there may be something specific (i.e. Load Rule, other Extension, getting cached file, etc) to your environment.

For further troubleshooting, you can enable debugging by setting the following in your Web Console and refresh the page:

document.cookie="utagdb=true";

You can also add more debugging in Extensions by calling "utag.DB" directly.

// Sample: Output text and the data elements in b object
utag.DB("My data layer");
utag.DB(b);

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

sarah_champerno
New Member
sarah_champerno

I am not on App Measurement for JS. I am on H.27, which supports Context Data Variables. Should this make a difference for your solution?

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

Tealium Employee

I've confirmed H.27 also works.

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

sarah_champerno
New Member
sarah_champerno

Ok. Thanks.

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

sarah_champerno
New Member
sarah_champerno

update: This worked for me for a test H.27 Sitecatalyst tag.

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

sarah_champerno
New Member
sarah_champerno

I have another problem that may come down to this extension. The problem is that context data variables set on a utag.link() call are persisting on some subsequent pageloads, when they shouldn't. This makes me think that whatever object this extension stores Context Data variables in is not being cleared out at the right time. And therefore old values are staying in there and showing up on the image request. It is a bit difficult to test because the extension accesses variables I cannot reach in the console. Do you have any intuition on this? Does you extension make sure to clear out any objects that get context data variables added to them?

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

Tealium Employee

As long as you are only setting Context Data via mapping, you can clear the values out each time with this line added:

// Add following at the top (above the "for" loop) of JS Extension
// to clear values each time

u.o.contextData = {};

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

sarah_champerno
New Member
sarah_champerno

yes. I am setting Context Data via mapping. Thanks very much for the quick response I appreciate it!

How do you map UDO elements to context data variables for a non-mobile SiteCatalyst tag?

Tealium Employee

@sarah_champerno The latest SiteCatalyst templates (H27 & App Measurement for JS 1.5) now have built-in support for mapping your contextData. Simply map to "c.something" in the mapping toolbox.

After updating to the latest templates, the JS Extensions described in this post should no longer be needed.