Single Page Application on part of site only

Silver Contributor
Silver Contributor

Hi, hoping someone can help me with this.

We're planning to move a site from GTM to Tealium iQ, and I've noticed that no virtual pageviews have been set up for the GA account in the application form of the site, which is the only SPA area. 

To do this in Tealium, I've read here that we need to use the script:

window.utag_cfg_ovrd = {noview : true}; 

Before utag.js fires, and then use utag.view(); with all pertinent variables (that are not passed as standard)

But my question is whether conditionally firing that based on DOM pathname is possible? From what I understand, if it's not set on first page load, it won't apply? Please do let me know if that's incorrect!

Also, could I do this within a Preloader extension in Tealium, or does it need to be hardcoded logic?

5 REPLIES 5

Single Page Application on part of site only

Tealium Employee
Hi Chris!

You can certainly add the snippet of code at the preloader level, and you can certainly run this based off the DOM. variables, but do not. that utag hasn't really ran by this point, you would need to check for the domain / pathname yourself - you cant use utag.data

Single Page Application on part of site only

Employee Emeritus

Hi @ChrisWallis 

I recommend adding the code at the preloader level.  You can use DOM variables, such as 

document.location.pathname

just not

utag.data["dom.pathname"]

because utag.data would not have been defined yet. 

Single Page Application on part of site only

Silver Contributor
Silver Contributor

Thanks very much! So I'll pass that only for the URLs on which the site is a SPA. 

Will that be an issue in terms of page view tracking if the user navigates to a different, non-SPA part of the site afterwards? I.e. is the cfg override somehow cached to block any subsequent auto-pageviews that would normally have triggered through utag.js? I wouldn't have to manually use utag.view() on all pages after that?

Single Page Application on part of site only

Silver Contributor
Silver Contributor

Perfect, thanks. We shouldn't need anything more complex than pathname as the condition here, so that will work just fine.

Single Page Application on part of site only

Employee Emeritus
You could add a condition to the preloader javascript extension that doesn't trigger on non SPA pages. But even if the page is a non SPA, by using the "window.utag_cfg_ovrd = {noview : true};" configuration, that disables all auto pageviews, meaning you could also manually trigger a utag.view() call on a non SPA part of the site.
Public