Matomo Tag Not Seeing Google Tag Manager Pageview Triggers

I have a react website that i want to track with Matomo
I have everything setup and am using Google Tag Manager(will now refer to it as GTM) to install the matomo tracking code tag

I noticed that GTM is able to see all pages i go to even if the page is not loaded for single page apps and component pages with child pages for example i have console.log to log what GTM sees and GTM is able to track the url changes and see all pageviews

but for some reason matomo refused to see the child pages pageviews and even back and forward pages matomo can not register these pageviews

it is crazy to me how i have matomo tag inside the GTM tag and yet GTM sees everything but matomo refuses to just see what GTM sees

matomo will see regular pageviews but as soon i use back and forward buttons, matomo can not track these pageviews and when i first go to the parent component landing page it sees as a pageview but then any child page after that clicked from inside the parent page matomo will not see the pages. this is disappointing that matomo as a web tracking app does not have default settings to track these things without me even having to make any settings changes

but anyways how do i fix this?
anyone else faced this issue and fixed it?

Will anyone ever help me?

OK, I’m guessing some things here, that your React website changes the URL on a new pageview, and in GTM you’ve set up a trigger based on history fragment, and you send a trackpageview to matomo with the new fragment.

When you put GTM into preview mode, can you see the trackpageview tag fire, and are there any errors in the console?

You should be able to go into the Network tab in Chrome and see whats being sent to matomo.php on each child pageview

in GTM in preview and network tab, all works perfectly fine as i have mentioned
it detects every single url change even for single page components and child pages that do not trigger page reload but url change

BUT matomo does not detect the child pages, it only sees the component page first time and any child page matomo can not see them

also back and forward browser button matomo can not detect and all detected in GTM

so what do i do to make matomo see things GTM sees?

OK, go to the site, open the network tab, reload without cache, find the matomo.php call, and copy the request url, it will be something like matomo.php?action_name= etc etc

Paste this into a notepad

navigate to different page, go back into the network tab and find the new matomo.php thats been fired and paste this under the previous line in the same notepad.

does the URL parameter match what you’re expecting?

There’s 3 possibilities here:

  1. the additional trackpageview on each page isn’t being fired (so you won’t have an additional matomo.php)
  2. it is being fired, but it’s being sent with the original URL
  3. it is being fired, with the new url, but matomo isn’t collecting it