flpvsk / gatsby-plugin-gtag

Gatsby plugin to add Google Analytics gtag.js (replacement for analytics.js) to a site.
MIT License
28 stars 12 forks source link

Looks like the pageview event is triggered twice on landing. #4

Closed roelvanhintum closed 5 years ago

ascasson commented 5 years ago

@roelvanhintum Is this still an issue? Curious as I'm consuming this package at the moment...

roelvanhintum commented 5 years ago

@ascasson Just created a pull-request. It's still an issue in the current release. You can simply test this by looking at the requests in your browser when loading a page.

flpvsk commented 5 years ago

I'll happily take a PR for this issue. Unfortunately don't have the time to fix this myself. @roelvanhintum I've commented on #5

roelvanhintum commented 5 years ago

@flpvsk I can't find your comment.

flpvsk commented 5 years ago

@roelvanhintum no worries. Published as v1.0.5 https://github.com/flpvsk/gatsby-plugin-gtag/releases/tag/v1.0.5

ascasson commented 5 years ago

Thanks @roelvanhintum and @flpvsk!

bolton commented 5 years ago

I just installed the plugin and am not seeing data go into google analytics - e.g. I don't see any pageviews or other information. When I look at the code in my site, it has this option set, send_page_view: false which disables pageview tracking (https://developers.google.com/analytics/devguides/collection/gtagjs/). If I manually update the code this plugin spits out in my html and set it to send_page_view: true, everything works as expected. I also npm installed 1.0.4 of the plugin, and everything works as expected as that config option isn't present anymore. I don't think setting send_page_view: false is the solution.

flpvsk commented 5 years ago

Thanks for reporting, @bolton! I think I found the issue. Will publish a fix later today.

flpvsk commented 5 years ago

Fixed in v1.0.7 I'm afraid v1.0.5 and v1.0.6 didn't collect any analytics whatsoever. I'll deprecate them.