Skip to content
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

fix(google-analytics): fix pageview timing issue by delaying it #10917

Merged
merged 5 commits into from
Feb 15, 2019

Conversation

jorgenblindheim
Copy link
Contributor

There is still a problem with title and path not being correct while navigating across a page.

As referenced in: #9139
Solution made in: #2478 and #3362

For some reason the previous solution is being overwritten

@pieh
Copy link
Contributor

pieh commented Jan 8, 2019

For some reason the previous solution is being overwritten

It might be that context on why setTimeout was used was missing - can you add comment there to note why this is needed?

@drake-smith
Copy link

drake-smith commented Feb 11, 2019

@jorgenblindheim @pieh Checking in here. I am experiencing the same issue (the page title fired off to GA is the previous page's title because GA updates before React-Helmet can update the meta info). I've simply installed gatsby-plugin-google-analytics and added my Tracking ID to gatsby-config- no extra or custom configuration.

Will this PR be merged in? This is a pretty fundamental bug that i think should be addressed as it essentially sending inaccurate info to Analytics. What is an alternate solution to making this fix myself? I do not have any experience in forking an npm package and making my own updates to it.

@wardpeet wardpeet self-assigned this Feb 12, 2019
@wardpeet
Copy link
Contributor

@drake-smith i'll be checking this out.

@wardpeet wardpeet changed the title Fix so that react-helmet has time to do it's work before google analytics triggers fix(google-analytics): fix pageview timing issue by delaying it Feb 14, 2019
Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched setTimeout to requestAnimationFrames to make it a bit more robust as react-helmet is using requestAnimationFrames as well

@wardpeet wardpeet merged commit 42f509e into gatsbyjs:master Feb 15, 2019
@gatsbot
Copy link

gatsbot bot commented Feb 15, 2019

Holy buckets, @jorgenblindheim — we just merged your PR to Gatsby! 💪💜

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (Currently we’ve got a couple t-shirts available, plus some socks that are really razzing our berries right now.)
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again!

pragmaticpat pushed a commit to pragmaticpat/gatsby that referenced this pull request Apr 28, 2022
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants