-
Notifications
You must be signed in to change notification settings - Fork 16
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
Investigate turbolinks & google analytics #651
Comments
(I'm the writer of the comment linked in #75) I'm not seeing anything where Turbolinks breaks Google Analytics outright (see relevant Google Analytics docs). Because Turbolinks is inadvertently hijacking clicks on same-page anchor links (see #75), 'turbolinks:load' fires during simple intra-page navigation (i.e. clicking a Table of Contents link), and if 'turbolinks:load' is used to track pageviews, you could see increased pageviews for those pages (not lower as you mention, not sure what your graphs are of). I don't necessarily think my comment on the other issue warrants a new issue on its own, I was just noting a potentially common side effect of the same-page anchor link behavior. |
I think I was mixing things up while reading issues at 11pm. GA on our site is in a Thanks very much for the follow up! |
@wjdp One other thing to consider that I just noticed today using Google Analytics and putting things in with Turbolinks 5... It appears raw JavaScript in the tag can be executed twice. 1st - when your doing a Turbolinks visit and the page is loaded out of the Turbolinks cache. 2nd - when the background fetch of the page completes and the cached page in the DOM is replaced with the new version of the page that was fetched in the background. In my (new) experience, the JavaScript is re-run at that point. So make sure you use console.log messages to sanity check. Godspeed. |
I've had good success here by adding the autotrack (https://github.com/googleanalytics/autotrack) plugin and having these enabled:
With that I've been able to get tracking that seems accurate to me. It seems much better suited for automatically figuring out how to deal with SPA-like scenarios. |
@aguynamedben That makes sense, thanks for pointing it out! |
No further action needed |
turbolinks/turbolinks#75 (comment)
May / may not be working. Comment would indicate its shouldn't, but haven't seen a huge drop in GA hits:
Hmm, looking at pageviews... maybe?
The text was updated successfully, but these errors were encountered: