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(gatsby-plugin-google-tagmanager): Properly communicate site title with GTM services #14384

Merged
merged 2 commits into from
May 29, 2019

Conversation

ryandrew14
Copy link
Contributor

Description

This PR registers a Google Tag Manager event that will fire whenever the route in a Gatsby application changes. This fixes a previously described issue (#13968) which led to weird mismatched site titles and routes in Google Analytics. It also updates the documentation to give an example of how to use this event in your Google Analytics to detect Gatsby route changes.

I'm somewhat new to production-level JS development and I know this may not be entirely optimal (the 2000ms delay especially, it was just a number that seemed reasonable since some delay was necessary), so let me know what I can do to make this better!

Related Issues

Fixes #13968

@ryandrew14
Copy link
Contributor Author

This failure is odd -- installing packages and running tests works great locally. Any ideas on what's happening?

@pieh
Copy link
Contributor

pieh commented May 29, 2019

This failure is odd -- installing packages and running tests works great locally. Any ideas on what's happening?

This is probably network error / flake and we can ignore it for now (will restart tests before merging)

@ryandrew14
Copy link
Contributor Author

@pieh 0ms timeout was still mismatching title/route occasionally, so I upped it to 50ms to be safe.

Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

Thanks @ryandrew14!

@pieh pieh merged commit f9bb78a into gatsbyjs:master May 29, 2019
@pieh
Copy link
Contributor

pieh commented May 29, 2019

gatsby-plugin-google-tagmanager@2.0.14 was published

@ryandrew14 ryandrew14 deleted the gtm-titles-fix branch May 29, 2019 18:36
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.

Google Tag Manager plug-in captures incorrect page title
2 participants