-
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
feat(gatsby-plugin-google-gtag): Add delayOnRouteUpdate
option
#37017
feat(gatsby-plugin-google-gtag): Add delayOnRouteUpdate
option
#37017
Conversation
I'm not really sure about what's causing this test failure. I don't think this code change (extra setTimeout) should be breaking anything, since the function being called just invokes the Google pageview event, and the syntax is correct as far as I can tell. |
1749cdc
to
2de4641
Compare
I think these are probably just flaky tests, reran and the original failure passed. These changes were already in use for the last few years in the old plugin, though. |
2de4641
to
7ec55ed
Compare
delayOnRouteUpdate
option
Description
This adds a new
delayOnRouteUpdate
option togatsby-plugin-google-gtag
, which is needed for correct pageview events when page transitions are in use. (e.g. with https://www.gatsbyjs.com/plugins/gatsby-plugin-transition-link/). Without this parameter, for sites that have route change animations, pageview events are logged based on the old page instead of the new page.This ports over a change that I made to the previous (now-deprecated)
gatsby-plugin-google-analytics
: #15610. However, I've renamed the option todelayOnRouteUpdate
which I think is more descriptive.Documentation
Updated the README for this plugin, similarly to #15610.
Related Issues
Fixes #15504