Open ninjaPixel opened 4 months ago
@ninjaPixel First, thanks for submitting this. 🙏
How can I make sure that my SPA page views are tracked?
I think we need to augment tracker.js
to be aware of (and track) navigation changes using PopStateEvent
(mdn).
But before that, we need to add tests to the tracker using Playwright or something similar. I've been reticent to add functionality to the tracker because it's not covered at the moment.
I'm using counterscale with Next.js and on page load it sends a trackPageview event to Cloudflare. However, on subsequent page views (where Next.js is effectively a SPA) nothing is sent to Cloudflare. I have tried:
window.counterscale("trackPageview")
on navigationdata-spa="auto"
property on the counterscalescript
tag. (This property is available on the Fathom script so I thought I'd give it a go here!)How can I make sure that my SPA page views are tracked? Thanks!