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.