403 Forbidden Error with Google Tag Manager
-
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”
height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
<!– End Google Tag Manager (noscript) –>
The topic ‘403 Forbidden Error with Google Tag Manager’ is closed to new replies.