• Resolved jeremywicker

    (@jeremywicker)


    I am trying to install Google Tag Manager using the Header and Footer Post Injections plugin and am getting a 403 forbidden error every time I try to put the code in the head section injection. I am able to save meta tags, <style> and other types of code that normally go into the head without any problems, but the GTM code won’t work no matter what I do. I always get the 403 forbidden error with that particular piece of code.

    I was having the same issue with the body tag portion of the Google Tag Manager code until I saved that portion without the comments. This fix did not work for the Head Section of the code.

    This is the code I am trying to inject. (I’ve replaced our GTM id with X’s for our privacy) I am not including the instructions when I try to inject the code. I’ve only included them here for clarity.

    Paste this code as high in the <head> of the page as possible:
    <!– Google Tag Manager –>
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:
    new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=
    https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,’script’,’dataLayer’,’XXX-XXXXXX’);</script>
    <!– End Google Tag Manager –>

    Additionally, paste this code immediately after the opening <body> tag:
    <!– Google Tag Manager (noscript) –>
    <noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=XXX-XXXXXX&#8221;
    height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
    <!– End Google Tag Manager (noscript) –>

    • This topic was modified 9 years, 1 month ago by jeremywicker.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jeremywicker

    (@jeremywicker)

    I’ve been continuing to troubleshoot this issue and tried to install Google Analytics without using Google Tag Manager and am having the same issue with both the Universal Analytics tracking code and the PHP implementation code.

    Plugin Author Stefano Lissa

    (@satollo)

    Ask the provider to disable the mod:security of your web space. If the problem is when you save the options.

    Stefano.

    Thread Starter jeremywicker

    (@jeremywicker)

    Our webmaster isn’t a big fan of turning off the security features for our website. We’ve been hacked a few times and we suspect that they were able to gain access through the wordpress section of our site. Is there another potential fix to this problem?

    Plugin Author Stefano Lissa

    (@satollo)

    You can put your tag manager code directly in your theme changing the header.php file.

    Stefano.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘403 Forbidden Error with Google Tag Manager’ is closed to new replies.