I've got this weird problem and I just don't know where to look : I've installed GTM tag on my wordpress site but it seems it's only being loaded when I'm connected as an admin.

How I can tell ? In GTM, i've setup the following simple tag

<script type="text/javascript">
  console.log('gtm test html tag');

This code is only triggered when I'm connected to wp-admin.

PS : Here's other informations that I think may enter in play, but im not sure it's relevant :

  • elementor

  • wp Rocket

  • autoptimize

  • Also, when i'm in Preview mode in Google Tag Manager, every tag is triggered even when i'm not connect to wp-admin

Thanks in advance

1 Answer 1


Ok, problem came from Autoptimize problem : there's an option, Also aggregate inline JS? , should be unchecked

There must be a way to exclude GTM script from Autoptimize, still haven't take a look yet !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.