utag.link/utag.view and utag.data persistence

Gold Contributor
Gold Contributor

I am looking into how event tracking can be done best and found out that when I call utag.link/view, the parameters passed are persisted in utag.data. I 'm not sure if that is intentional but I actually need the following.
when sending an event I ONLY want to send the variables that have been added into the method call and NOT the variables in the UDO also.
Currenlty when I call utag.link({event:'foo'}) the tags get fired correctly (as the mapping of the event parameter has been configured) but after this method call I can see in the utag.data object the event variable added. When issuing other calls without the event parameter I see that the 'old' event variable is also send. Is Tealium designed to add variables from these method calls to the utag.data object or should that not be the case?

7 REPLIES 7

utag.link/utag.view and utag.data persistence

Employee Emeritus
Hi Jan, That should not be the case. After a manual utag.view() or .link() call is made with a new object, the utag.data object should not have been altered permanently. Is it possible you have an extension adding it in? If you're confident that isn't the case, please contact your account manager and we can take a look at this issue for you.

utag.link/utag.view and utag.data persistence

Gold Contributor
Gold Contributor

I do not get the same result, see my test results below:
Setup
-------------------
-new profile
-html page with code directly from 'code center'
-1 tag added, Tealium custom container,loaded on all pages, where send function does only log the values of the a and b parameters and the mapped data object:
//tealium universal tag - utag.loader ut4.37.##UTVERSION##
u.send = function(a, b) {
console.log('Start send');
console.log('Var a:',a);
console.log('Var b:',b);
... mapping code from Tealium...
console.log('U data:',u.data);

-mapped three UDO variables: event --> ev, event_location-->event_location, event_detail-->event_detail;


Use case 1: Page load
-------------------------------
> utag.data = contains standard utag variables generated by tealium
in tag: console.log(a) = 'view'
in tag: console.log(b) = same as utag.data
OK = Expected result

Test 1: manual utag.link with mapped event parameter (event is mapped to ev)
----------------------------------
> utag.link({event:'foo'});
in tag: console.log(a) = 'link'
in tag:console.log(b) = same as utag.data + variable event:'foobar'
in tag: eventual mapped data = ev:'foobar'
Mapping is ok BUT
> utag.data = standard utag.data + variable event:'foobar' so basically the same as variable b
NOK == not expected this result
Expected result is that utag.data does not contain the event variable.
Using any other parameter exhibits the same behavior:
utag.view({notmappedparam:'should not be there'}), the variable notmappedparam is afterwards also in utag.data AND utag_data plus the event parameter is now set to view.

utag.link/utag.view and utag.data persistence

Gold Contributor
Gold Contributor

when digging into the code I've seen the following in utag.js(line 707+708):
else if(utag.cfg.load_rules_ajax){
// right now, load rules use utag.data (replace items in utag.data with items in b)
if I set utag.cfg.load_rules_ajax to false the utag.data is kept intact but I am not sure what the side effects of this setting will have so I am not sure if this is a solution

utag.link/utag.view and utag.data persistence

Employee Emeritus
If I'm reading this correctly, this is not the expected behavior. Please contact your account manager so we can dig into this for you.

utag.link/utag.view and utag.data persistence

Tealium Employee

This is most likely the result of the loadrule code being re-evaluated. At present, the data that is passed in has to be added to the utag.data object to allow for the re-evaluation. There is an update currently being worked on to stop this from happening and instead will allow the data object passed in to be sent to the loadrules re-evaluation function, leaving the utag.data object as it was.

 

Adrian

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.

utag.link/utag.view and utag.data persistence

Tealium Expert
Tealium Expert

Hello - this is an interesting post - what's the news on the update mentioned by @adrian_browning ?   I have a possibly similar issue I need to resolve.

 

Thanks - 

 

MitchellT

Tealium Expert

utag.link/utag.view and utag.data persistence

Tealium Employee

@mitchellt

 

The update that I was referring to has now been released.

And is available in the latest utag version (v4.40).

 

https://community.tealiumiq.com/t5/uTag/How-do-I-upgrade-to-the-latest-utag-js/ta-p/5042

 

Adrian

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.
Public