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
Does Fathom work with Turbolinks? #260
Comments
I think I may have answered my own question. It certainly appears to be working. The solution was pretty simple: document.addEventListener('turbolinks:load', e => {
if (typeof window.fathom === 'function') {
window.fathom('trackPageview')
}
}) If somebody else can confirm that this is correct, then the issue can be marked as resolved. Cheers, |
I was going to link you to https://github.com/turbolinks/turbolinks/blob/master/README.md#full-list-of-events Fathom doesn’t support turbolinks out of the box. The approach you’ve arrived at looks good. |
Thanks @JackEllis. |
It does work on Chrome. Unfortunately I can't make it work on Firefox. Edit: my issue is related to this tracker https://cdn.usefathom.com/tracker.js |
@cbaconnier That's because the hosted version of Fathom and the version hosted on this repo are now two different codebases with different features. If you're not paying for the hosted Fathom, you should probably change the URL of your tracker to |
@m1guelpf I'm using the paid version. But at the time being, the paid tracker is not on Github. It seems that in this particular case, Firefox will load the image generated by the tracker from its cache.
To this
It force Firefox to load the new URL since it will be different. @JackEllis is already aware of it :) |
Hello,
I've just installed Fathom [1], and the dashboard is running nicely. However, it doesn't seem to be capturing any data. I suspect this may be because I'm using Turbolinks.
Here's a quick (simplified) summary of how Turbolinks works, in case you're unfamiliar with it:
body
with the new pagebody
.This means the standard "document ready" type events never fire. Turbolinks recommends listening for the
turbolinks:load
event instead, but as far as I can tell I have no control over that.I've reviewed this issue regarding tracking URLs on a single page, but I don't think it applies here, because the problem is (or appears to be) the lack of a document load event.
So, my questions are:
Thanks for taking the time to read this far, and for all your work on Fathom.
Cheers,
Stephen
[1] Which was an incredibly smooth process, by the way. You've done an excellent job with the first-run experience.
The text was updated successfully, but these errors were encountered: