Trouble with tracking page scrolls on SPA

This guide has been used to implement page scroll-tracking. However, it doesn’t seem to work on single page applications made with NextJS. It only tracks the page scrolls on the first page you land on and if you navigate to other pages, the page scrolls stops working. I’ve tried turning on and turning off the SPA-setting. The risk with having it on (although it doesn’t work with page scrolls) is that it’ll double-track page views.

Do you have other specific guides on how to track page scrolls on SPA? It might be something I’m missing.

Hi @donmiran,

Welcome to our community!

Sadly there is no simple way to track the scroll depth for SPA sites. What you can do is to put on specific elements an interaction tracking How can I track interactions with popups and content? | Piwik PRO help center. Then by selecting “visitor seen the content” you can have similar behaviour to scroll depth. e. g. by adding this - [data-content-name=“footer”] - attribute to all footer elements on your site you can see how many people scrolled far enough to see it.

Best,
Oliwer