holidaycheck / react-google-tag-manager

This repository contains a react based implementation for Google's Tag Manager snippet.
MIT License
192 stars 31 forks source link

Using ReactGTM with react-router #53

Closed spetex closed 7 years ago

spetex commented 7 years ago

Hello, I have a simple React/Redux application which uses react router for syncing the URL. I also have react-google-tag-manager in my app. Unfortunately my GA does not track URLs while transitioning in the app. In order to change the URL I have to force refresh the page which obviously forces the GTM component to re-render.

My thinking is force the GTM component to re-render each time route transition occurs.

Is there a simple solution which I am missing?

Thanks!

FQ400 commented 7 years ago

Hey @spetex,

the Google Tag Manager and Google Analytics are two different things.

Assuming GTM is used to deliver GA to your page, it is possible to trigger virtual page views after the routing transition is done.

That should do the trick.

Regards.

FQ400 commented 7 years ago

Appears to be fine ...