I’m currently trying to integrate matomo to a website built on the Single page application mode.
However, matomo doesn’t work on page change, but only when the user connects directly.
For the idea of the guide to work, you don’t need URLs based on Hashes.
If you use a SPA with some kind of internal routing, Matomo can’t know when a page view is happening.
So whenever a route change is happening, you can have to call the following code with the correct data. The trackPageView will then send this data to Matomo.
_paq.push(['setCustomUrl', '/the_url']);
_paq.push(['setDocumentTitle', 'My New Title']);
_paq.push(['trackPageView']);
So assuming you are using Vue, it might look something like this (ignore the fact that this is a bit needlessly overcomplicated).
And of course you don’t need to do this from scratch: If you are using a popular SPA framework like react, angular or vue, then someone else has already written the code for it: