-
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
[gatsby-plugin-google-gtag] Disable default pageview tracking #9842
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the GA doc page url exaplaining the issue and sanitized the not required object too, thanks.
published |
…tsbyjs#9842) The default behavior of the `config` snippet is to send a pageview automatically; this is in contrast with the `exclude` option and the plugin tracks, on page load, even the excluded pages. This PR solve also the double pageview hits on page load too: the first is made by the default behavior and the second one by the `onRouteUpdate` event.
How do I override this so it actually sends page views? I tried the obvious (in gatsby-config.js):
but it seems to be ignored. Help? |
Hi you don't need to override it because it's a bugfix: do you add your tracking id on the Are you checking it on production? The tracking is disabled on development mode. Do you have disabled any ad blocks: sometimes you forget to disable them and you don't understand why the analytics doesn't work 😅 |
I ended up using the google tag manager and got it working just fine. https://www.youtube.com/watch?v=__PctBcNZ-c Good point about ad blockers, though. :) |
The default behavior of the
config
snippet is to send a pageview automatically; this is in contrast with theexclude
option and the plugin tracks, on page load, even the excluded pages.This PR solve also the double pageview hits on page load too: the first is made by the default behavior and the second one by the
onRouteUpdate
event.