Page data on link events (SPA)

Gold Contributor
Gold Contributor

Hi,

we are looking for a solution for the following problem: On our single page website, we have implemented page specific data variables (e.g. page_type, page_id). These are passed with the call to utag.view() like this:

utag.view({"page_type": "home", "page_id": "123"});


To ensure, that the data is not sent on subsequent pages without these parameters, the values are mapped to "pageview-dimensionX" in the Google Analytics tag.

Now we would like to have these values also sent on link events, to see in GA which events fired on the page with ID "123". Is there a way to achieve this?

We can't use the "set" option, as in this case there is no way to clear the variable (an empty value means it is not passed to the GA tag). 

Do you know a way to persist a page value through several link events and only reset it in case of a new view event?

Best regards,
Andreas

1 REPLY 1

Page data on link events (SPA)

Tealium Employee

Hi @ahrasch

 

From how you have described this, I think your best bet is to use an extension to help you out.

What you would need to do is have a variable, say utag.data.current_page_type = b.page_type and utag.data.current_page_id = b.page_id, which you update when the view happens.

Then when you call a utag.link() call, you can then retrieve the data store in these data sources, put them into their respective data sources b.page_type = utag.data.current_page_type and b.page_id = utag.data.current_page_id and map accordingly, when you need to set them.

 

Adrian

 

 Remember to give me a kudo if you like my post! Accepting my post as a solution is even better!

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