Page title in Pageview tag showing for previous page

sujay_das
New Member
sujay_das

I have implemented tealium in a SPA but I'm running into an issue for quite sometime where the page title in the pageview tag of Google universal analytics is not showing for the current page which is loaded but instead, it's capturing the page title of the previous page.

I have created a page_title udo and mapped it to the title in Google Analytics tag to get the page title. The application has different page title for different pages.

I have also tried to create an extension where I'm passing the document.title value to the page_title udo using the b variable but the fix doesn't seem to work.

Has anyone has encountered this issue before who can help me out on this?

Thanks!!

4 REPLIES 4

Page title in Pageview tag showing for previous page

VIP
VIP VIP

Hi @sujay_das - is the utag.view() function getting called in your SPA with each "page view" (route change)?  If so then it might be simple enough to pass in the current page in whatever variable GA has mapped.  Or you could add an extension to move in the current page name into the mapped variable so GA can pick it up and stay current.

As usual there's so many ways to handle this, so others may chime in with to share other techniques/tactics!  Let us know how it goes...

 

Page title in Pageview tag showing for previous page

mvenkatesan
Occasional Contributor
mvenkatesan Occasional Contributor

@sujay_das As @mitchellt explained utag.view is the easiest way.

I believe you will passing other variables on the SPA page views using the same utag.view call you can include the page name variable with the current page name and that will solve the issue.

Hope it helps

Page title in Pageview tag showing for previous page

sujay_das
New Member
sujay_das
Yes, the utag.view() function is getting called with each pageview and all other variables are getting passed and set as expected. Only issue is with the page title not getting set appropriately. I feel the pageview tag is firing before it's able to fetch the page title of the page I'm navigating to.

As mentioned before, one solution I tried was to use the document.title attribute from the page but I can see from the Web Companion tool that it's not changing with other pages.
So, for each pageviews of subsequent pages, the page title remains to be same as with the title of the first page load.

It would be great if you could post an elaborate solution to this.

Thanks!!
Highlighted

Page title in Pageview tag showing for previous page

mvenkatesan
Occasional Contributor
mvenkatesan Occasional Contributor

Hello @sujay_das

I believe you will be calling utag.view like the below way

Page view 1:
utag.view({
variable_one: "Value 1",
variable_two: "Value 2",
variable_three: "Value 3",
})

Page view 2:
utag.view({
variable_one: "Value 11",
variable_two: "Value 22",
variable_three: "Value 33",
})

 

You need to add page_title (or your mapped page title variable) along with it:

Page view 1:
utag.view({
variable_one: "Value 1",
variable_two: "Value 2",
variable_three: "Value 3",
page_title: "View 1 Page title"
})

Page view 2:
utag.view({
variable_one: "Value 11",
variable_two: "Value 22",
variable_three: "Value 33",
page_title: "View 2 Page title"
})

 

Hope this helps!