data passed in view call is not showing up in utag.data

VijayYadav
Visitor
VijayYadav

Hi,

Pageview call are made on a SPA using utag.view manually from the application and it is working properly.

exact code : $window.utag.view(udo)

where udo is data object 

{
page_name: pageName, //Page Name
site_name: 'xyz', //Website Name
subsite_name: 'abc', //Subsite Name
user_auth: varValue}

but this data in udo is not present in utag.data when I am trying to console utag.data

Is there something that i am missing

10 REPLIES 10

data passed in view call is not showing up in utag.data

VIP
VIP VIP

Hi @VijayYadav - this is a classic situation, especially where SPA is concerned.

The short answer is that the variables "tossed into the air" into the UDO on a tag.view() call are transient. They exist for the brief instant when the call is made and tag processing is in progress. You can see them if you put Tealium into debug mode and also when you run the browser debugger as well.

Check out links: https://community.tealiumiq.com/t5/JavaScript-utag-js/Debugging-utag-view-and-utag-link/ta-p/13695 and https://community.tealiumiq.com/t5/JavaScript-utag-js/Console-Debug-Output/ta-p/14328

Let us know how it goes - come back with questions and ideas as needed!

data passed in view call is not showing up in utag.data

VijayYadav
Visitor
VijayYadav

Data sent with pageview is present in utag.data only for instance when the pageview calls are made. After that the data is removed from utag.data.

As per the requirement I want to send this data(data sent along with pageview) along with events as well but I am not able to find it in utag.data.
What is the best practice for such type of task any idea, @mitchellt?
Is there some object available in tealium that can be used to fetch the data that was sent along with pageview call?

data passed in view call is not showing up in utag.data

Tealium Employee

 

@VijayYadav

As @mitchellt says, when you pass data within utag.view it's event scoped meaning it's only available while that call occurs. If you declare utag.data.page_name first that will make it global then it will be available for all future utag.view calls.

 

utag.data.page_name = 'pageName'; //Page Name
utag.data.site_name = 'xyz'; //Website Name
utag.data.subsite_name = 'abc'; //Subsite Name
utag.data.user_auth = varValue;
$window.utag.view(utag.data)

 

Please let me know if this is what you're looking for.

Cheers,
-Dan

data passed in view call is not showing up in utag.data

VijayYadav
Visitor
VijayYadav

Hi @dan_george@mitchellt

I agree with the above answer.

But I want the data sent with utag.view() call to be available in utag.data while i am making utag.link() call on the same page.

Note : It is an angular 1.5 application

And same thing was achieved on other angular 1.5 app but dont know how.

After the utag.view() call I was able to see the data in utag.data object when I logged it in console on the other application

data passed in view call is not showing up in utag.data

Tealium Employee

@VijayYadav you should be good to go then. The data will still be available in utag.link calls as long as you pass in the utag.data object as the parameter. Are you making a general statement that's how you want it to work, or are you making the statement that it's not working this way? Just want to clarify so I can be sure your question is fully answer.

Cheers,
-Dan

data passed in view call is not showing up in utag.data

VijayYadav
Visitor
VijayYadav

@dan_george

Udo which i am sending with utag.view  (I have mentioned in above  post) is not available in utag.data after the view call is processed. So I am not able to use it for utag.link calls.

I am passing some data in utag.link() calls and in addition to that i also want to append global data(udo-view calls) to it before making the actual call but the global data is not available in utag.data.

Please let me know if you need more clarity. 

Thanks.

data passed in view call is not showing up in utag.data

Tealium Employee

@VijayYadav I hope the below description is useful.

1) On page load, I check the value of  utag.data.abc and it is undefined

page view.png

2) So I declare a globlal utag.data.abc and set the value to "123"

declare utag data abc.png

3) I trigger a utag.view(utag.data) and view a request that captures the entire UDO and see "abc":"123" is sent. Notice below the highlighted text that you can verify this is a view event.

utag view.png

4) I trigger a utag.link(utag.data) and view a new request that captures the entire UDO and still see "abc":"123" is sent. Notice below the highlighted text that you can verify this is a link event.

utag link.png

So by first declaring the var within the global utag.data object and then triggering a utag.view or utag.link the data will be available.

If this doesn't solve your issue then I'll need detailed examples of the code you're using to see where the breakdown is occurring. Thanks!

Highlighted

data passed in view call is not showing up in utag.data

VijayYadav
Visitor
VijayYadav

@dan_george

I Know that if we add data in utag.data at the time of utag.view() calls it will be available in successive calls.

Here the case is different.

1. I am making a call to utag.view(somedataobj) //somedataobj  is not utag.data

 -tag fires correctly and somedataobj was available in utag.data while the view call was processing.

2. After that I want to make a utag.link(otherdataobj)  on the same page   //here otherdataobj will contain event specific data and few values of somedataobj

But  those values(somedataobj) was not available in utag.data at the time of utag.link() 

Question: Is this possible to persist the data which was sent in utag.view() calls without manually hardcoding it in utag.data?

data passed in view call is not showing up in utag.data

Tealium Employee

@VijayYadav 

Thanks for the clarification and details, this helps a lot.

In your example, it is correct that the Tealium library will not persist somedataobj since it's local to the utag.view.

It will require additional code to be able to persist somedataobj into utag.data. For example, utag.ut.merge is a function you can call just before a utag.view/link request to merge together the two objects. Hopefully this is more along the lines of what you're looking for.

Cheers,
- Dan

data passed in view call is not showing up in utag.data

BenStephenson
Contributor
BenStephenson Contributor

Wasn't aware of utag.ut.merge. That sounds like it would have been a useful one for quite a lot of stuff I've done with SPAs in the last year.