Reply
Highlighted
Accepted Solution

How can you get the content of the original ("raw") utag_data object after the page has loaded?

Our developers want to create tests to check whether what they sent into utag_data was correct. However, when checking utag_data after the page has loaded, its content has been transformed by Pre-Loader and All Tags Extensions.

So the question is: Is there a better way to keep the original content of the utag_data object somewhere than to copy its content into another object (e.g. "utag_dataCopy")?

Reply
0 Kudos
Regular Visitor
Posts: 38
Registered: ‎11-06-2015

Re: How can you get the content of the original ("raw") utag_data object after the page ha

Hi @loldenburg

 

One way I can think to do this would be to use a pre-loader extension and copy the utag_data object into a new object. You'll likelu want to use the .slice() function so that you're making a copy of the data instead of a reference to the original object, otherwise your new object will equal that of utag_data at page end which isn't what you want.

 

Cheers,

-Dan

Reply
0 Kudos
Tealium Employee
Posts: 533
Registered: ‎09-01-2015

Re: How can you get the content of the original ("raw") utag_data object after the page ha

Hi. what do you mean by the ".slice" function?

We are now doing it this way: 

for (var name in utag_data)
{
utag_dataCopy[name]=utag_data[name];
}

 

This way we create not only a reference but a copy at the time (in the Pre-Loader Ext) when the code runs.

Reply
0 Kudos
Regular Visitor
Posts: 38
Registered: ‎11-06-2015

Re: How can you get the content of the original ("raw") utag_data object after the page ha

Hi @loldenburg

 

Yea that'll work. Just be sure to declare utag_dataCopy before trying to use it.

 

var utag_dataCopy = {};
for (var name in utag_data) {
   utag_dataCopy[name]=utag_data[name];
}

 

Ignore the .slice, I was inexplicably confusing how we pass data into a tag with what you were attemping to do.

Reply
0 Kudos
Tealium Employee
Posts: 533
Registered: ‎09-01-2015