Problems with tracking SPA site

I am trying to track this SPA site using Google Tag Manager: https://schultzlegal.fundament.schultz.dk

First I hoped that the “Track page views in a single-page application” setting in Piwik PRO would automatically detect new pageviews within the SPA site, but that does not seem to work.

Then I created a “History Change” trigger in GTM and added that trigger to my Piwik PRO pageview tag (where I am using the tag template from Piwik PRO).

Now SPA pageviews are being triggered, but the Piwik PRO tag doesn´t pick up the new page url and page title, when browsing the site. So all pageviews are being tracked with the page url and page title of the landing page.

How can I fix this issue?

First I hoped that the “Track page views in a single-page application” setting in Piwik PRO would automatically detect new pageviews within the SPA site, but that does not seem to work.

You have to use Piwik PRO Tag Manager for that to work. It can be installed via GTM.

As for using GTM for that, I’d create a separate tag responsible only for virtual page views. Then, you set the page title via variable. That would be the tag code:

    var _paq = _paq || [];
    _paq.push(['setCustomUrl', {{ Page Url }}]);
    _paq.push(['setDocumentTitle', {{ Page Title }}]);
    _paq.push(['trackPageView']);

Thanks a lot @kuba for your quick answer :pray:

Thank you Kuba

I have the same problem but I’m using the Piwik TMS.
How can I fix that ?
Thank you