Matomo React/NextJS site tracking thru GTM

Hi

I’ve been trying to install Matomo tracking on React/NextJS website through Google Tag Manager and it doesn’t seem to work quite as expected. There are suggestions everywhere to use Matomo Tag Manager, but I have numerous tags in GTM as for now, so do not want to change that. And I do not want to install any specific NextJS/React extensions, since tracking should work sufficiently fine with history change.
But it does not.

My setup is that “Matomo Tracking Tag for Matomo Cloud” is launched in GTM wit triggers:

  1. page view
  2. history change

alternatively, I’ve tried a setup as described in the answer below:
(cannot paste link - stackoverflow - google-tag-manager-not-functioning-on-page-change-in-next-js-using-react-gtm-mo )

But the outcome is, the pages are present in the user journey, but the URL and page title does not change. There are eg. 10 pages in the journey, but with same URL and title… (based on “Visits in real-time” report)
Any ideas how to achieve proper tracking of webpage urls and titles?

many thanks,
mike

Hi,

Were you able to find the solution? I am also facing the same issue.

I had to ask developers to create a special push event when the route/URL changes. I ‘catch’ this event with GTM and push page view to Matomo. It’s not working 100% right, but we had no time to make it 100% accurate.
Generally speaking, it’s quite disappointing that it’s so complicated just to launch page view tracking with such a popular framework sa react/nextjs.