We are currently seeing a rather large proportion of traffic reporting Page Title = (not set) in google analytics. Approximately 1/3rd of pageviews are missing a page title, and we know that all of our pages are correctly setting the <title>.
A quick search around the web indicates this is often due to a race condition that may present itself when <title>is printing after the GA script, which I believe is happening by default now when the script is manually attached to 'head_placeholder' via the .module file.
Curious to see if there are any other users experiencing/have experienced this or if there are thoughts about how this could be mitigated - obviously one could overwrite the core html.html.twig file to move <title> to the top, but ideally we'd rather not deviate from core, and that doesn't really help anyone else using the module.
To see if this issue is present for your project, simply filter 'Behavior' -> 'All Pages' by primary dimension 'Page Title' in GA UI - in my case over 34% of traffic is '(not set)'.
Comments
Comment #2
trwill commentedComment #3
hass commentedSounds like we are victims of
Comment #4
hass commentedAre you really on 3.x?
I'm just asking as the documentation at google says gtag.js should be the first tag after opening HEAD. There is no word that title need to come before.
Comment #5
trwill commentedSorry for the delay - yes on 3.x. Currently on 3.0.0-beta1
Comment #6
dbarthelemy commentedI'm also seeing the (not set) issue with page titles, but not consistently. When reviewing the same page, there are some instances with a page title and some without. I have seen the same recommendation that a potential fix is moving the title tag above the GA script. Have you found any other solutions to this?
Comment #7
dbarthelemy commentedI did some additional research and found some interesting anomalies among the page not set pages. Almost 80% of the not set traffic is on a tablet and it is mostly commonly not the landing page, it’s after a user starts navigating through the site. Are these anomalies consistent with what the rest of you are seeing in your data?
Comment #8
roberto.rivera.ixis commentedI'm trying to replicate this issue but doesn't seem to be happening for me so far. Tested it using 3.x version and from desktop and tablets as it seems to be more frequent.
Just wondering if could be related to the theme. I am using a defult theme and content, @dbarthelemy have you tested this on a live or dev site? Any other information you could provide for me to replicate it?
Comment #9
roberto.rivera.ixis commentedHi,
I have been testing this using version 3.x from the module but wasn't able to replicate the issue. Tried both, desktop and tablet devices. For the 100% of the sessions logged I am able to see the right site title.
Just wondering if this could be related to the theme you are using, so far I am using a default theme and content. Could you provide extra info for me to try to replicate it? is this happening on a live or dev site?
Comment #10
japerryWith the sunset of legacy google analytics, the 8.x-3.x module is now unsupported. If this is still an issue with the 4.x version, please file a new issue in the queue.