This works fine. So I have tried to include the following after reading the Matamo guides:
jQuery(document).on('pjax:complete', function() {
_paq.push(['setDocumentTitle', 'My New Title']);
_paq.push(['trackPageView']);
});
But page views, other than the initial visit are still not being tracked, so I then tried using Matamo tag manager to create a custom tag with custom triggers. One is a history change trigger and the other a page view trigger event.
I am hoping to use the tag manager, as it look like using the default setup I would need to set a name for every single page I wanted to track a page view for in this code
But apparently tag manager should only require this:
window._mtm.push({'event': 'mtm.PageView'});
Which I assume will be labelled with the page title/name when it works?
somewhere in your code, and check this is logged in the JavaScript console, just to be sure the code is well called at hashchange…
Then check on the network console if some page view requests are sent to the Matomo server.
For the other point (MTM), the idea is to not code each event / tracking. The Manager will do if for you. You just have to add the MTM bootstrap code (or maybe your CMS will do it for you with some little configuration), then you manage most of tracking through the MTM interface:
It is very strange, the page views are actually being logged. But they all show that every page view is the root of the website rather than the page actually being viewed.