Google Analytics Works on ngrok But Not in Production? [SOLVED]

My Meteor app uses React. I installed Google Analytics tags using the npm package, react-gtm-module. I put the app up on ngrok and tested it in GA on preview mode. Everything worked great. The Google Analytics tag was detected.

Then I pushed the same code to production, and GA preview mode says, “Google Tag: GTM-##### not found”.

What am I missing?

UPDATE

I added the gtag.js script to the section in main.html, and it seems to be working in production now. But, I thought react-gtm-module was supposed to add gtag.js for me. Is that not so?

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', 'GTM-XXXXXXX');
</script>

UPDATE 2

It was a misconfiguration of the specs for Google Ads / Google Tag Manager. That U/X is a mess.

1 Like