If you have Turbolinks or Turbo in your Rails project, only the first page view would be counted and tracked by Fathom Analytics. Here is how you can make use of load
event to track the page views.
For turbolinks:
document.addEventListener("turbolinks:load", function() {
if (window.fathom) {
window.fathom.trackPageview()
}
})
For turbo:
document.addEventListener("turbo:load", function() {
if (window.fathom) {
window.fathom.trackPageview()
}
})
I had recently confirmed the same with Fathom team:
rinas π§βπ»@onerinas@usefathom I'm using Turbolinks and after navigating to another page, it doesn't get updated in the dashboard. After having a look at the script.js, came up with the solution below. Anything else to do other than this?
cc @JackEllis / @pjrvs
16:27 PM - 28 Mar 2021
and looks like this is the way to go:
Fathom Analytics@usefathom@onerinas @JackEllis @pjrvs Because turbolinks runs its own events, this is the way we typically recommend. I donβt think the spa option works with turbolinks. - Jack16:33 PM - 28 Mar 2021
Top comments (0)