Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
Fire Tag in Google Tag Manager on url change of React Application

I have added Google Tag Manager to my React Application with the help of this module - react-gtm-module

So i initialized my GTM on base file as the doc says

  const tagManagerArgs = {
    gtmId: process.env.REACT_APP_GTM_KEY,
  };
  TagManager.initialize(tagManagerArgs);

//This code only executes the first time when the site loads, not on every route change

and i see the script tag in my tag

<script src="https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXXX&gtm_auth=&gtm_preview=&gtm_cookies_win=x"></script>

So as soons as i open my website i see container load in the debug mode of GTM and see the tag GA - UA-XXXXXXX - All Pages fired properly.

Now i have a button in my home page which on clicking takes me to the new route, so in debug mode i see history change but I want to fire GA - UA-XXXXXXX - All Pages Tag in that history change, which doesn't happen. This tag only gets fired when i refresh the website on any of the routes

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!