• I’ve just installed your plugin and added a GTM id and selected “Custom” in the Container code placement options. Then I added this code <?php if ( function_exists( 'gtm4wp_the_gtm_tag' ) ) { gtm4wp_the_gtm_tag(); } ?> after the opening body tag. I am getting Uncaught ReferenceError: gtag is not defined error in Chrome Console. I have everything else untouched in the plugin’s settings.

    I’ve also noticed a couple of 302s in the Network tab: https://imgur.com/a/trWIsPv. These are Google links.

    I have the Google Tag Assistant add-on installed in Chrome. It shows me the GTM tag correctly.

    I’ve also disabled the W3 Total Cache plugin to make sure this was not caused by the plugin but that didn’t help. The website is not connected to Cloudflare.

Viewing 1 replies (of 1 total)
  • Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    ‘gtag’ is related to the Google Global Site Tag (gtag.js) and not to Google Tag Manager. The error message that you see appears because your site seem to have some hard coded gtag() command that fails after switching to GTM.

    If you can share the URL of your site, I can have a look at it to help you find this orphaned code.

Viewing 1 replies (of 1 total)

The topic ‘Uncaught ReferenceError: gtag is not defined’ is closed to new replies.