-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google analytics tracks pages, but not always the path and the title are from the same page. Sometimes a visitor visits "/" but the title of another url. #9139
Comments
@hackhat can you provide a minimal reproduction repo for this issue? |
I don't, but basically the problem happens in the template because the tracker sends the pageview before the markdown page is loaded. The title of the page is only updated when the markdown is downloaded, because the title is in the markdown. But is tracked as soon as that url is changed. I wonder how this doesn't happen in other places... |
As @hackhat says this is happening because The issue affects SPA's generally and is discussed here. A hacky fix is arbitrarily delaying GA to allow the title to update. I'd like to see a discussion that results in a more elegant solution. |
Me too. I wonder how come it doesn't affect more people? |
Same problem here. Using the |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
The PR got merged :) Big thank you to @jorgenblindheim |
…byjs#10917) There is still a problem with title and path not being correct while navigating across a page. As referenced in: gatsbyjs#9139 Solution made in: gatsbyjs#2478 and gatsbyjs#3362 For some reason the previous solution is being overwritten Co-authored-by: Ward Peeters <ward@coding-tech.com>
Description
Google analytics tracks pages, but not always the path and the title are from the same page. Sometimes a visitor visits "/" but the title of another url.
Looks like the url is correct but the title is from the previous page I've seen. I'm using
import { Link } from 'gatsby'
for the links.Steps to reproduce
Created default app:
Add Google analytics script:
Add helmet in your page template:
Expected result
All pages should have the path matching with the title.
Actual result
Google analytics tracks pages, but not always the path and the title are from the same page. Sometimes a visitor visits "/" but the title of another url.
Environment
gatsby info --clipboard:
The text was updated successfully, but these errors were encountered: