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

Google Analytics plugin should have configurable delay before sending Page View #15504

Closed
Simon-Tang opened this issue Jul 8, 2019 · 1 comment · Fixed by #37017
Closed

Comments

@Simon-Tang
Copy link
Contributor

Simon-Tang commented Jul 8, 2019

Summary

To build on the fix for #9139 in #10917, we need to support an optional configurable delay before invoking sendPageView for sites that have custom page transitions. (An example plugin: gatsby-plugin-transition-link).

I can probably make this change in the code, but I wanted to see if anyone else had thoughts on this (e.g. the naming of the option).

Basic example

In gatsby-config.js:

{
  resolve: 'gatsby-plugin-google-analytics`,
  options: {
    pageViewDelay: 250,
  }
},

Motivation

With page transitions, such as when using the plugin linked above, the next route can be mounted after an arbitrary delay, so the current requestAnimationFrame/setTimeout in onRouteUpdate will need to be replaced with a user-configured delay in this case.

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 a pull request may close this issue.

1 participant