abc
abc

Reputation: 157

Google Tag Manager

I inserted a Google Tag Manager code snippet below the body tag but my website will only display a blank white page. When I remove it, the page displays correctly.

<!-- Google Tag Manager -->
<noscript>
<iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXXXX" height="0" width="0" style="display:none;visibility:hidden">
</iframe>
</ noscript> 
<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= '//www.googletagmanager.com/gtm.js?id='+i +dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-XXXXXX');
</script> 
<!-- End Google Tag Manager -->

Upvotes: 1

Views: 13409

Answers (6)

Bob
Bob

Reputation: 1

I found the solution of these.

They change something in the URL

In the blank frame https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"

and the Iframe who really works is with these

https://www.googletagmanager.com/**gtm.js?id=**GTM-XXXXXXX

Let me know if they work for you

Upvotes: 0

AlienDev
AlienDev

Reputation: 333

Without many details, it is a little hard to figure this out.

  • Is the main code in the head tag?

    <!-- 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','GTM-XXXXXX');</script> <!-- End Google Tag Manager -->

This script should be as high in the head tag as possible.

If this script is present and there is nothing else wrong. Then there would be code around this that is breaking, or code inside of it. Are there tags in GTM setup to do something that may cause the page to break? Is it only this page? Can you create a new page, fresh HTML, nothing else on it except a paragraph and headline, add the GTM code? Once you do this, and assuming the H1 and p are visible, then add the rest of your page, piece by piece, until the page breaks. You will then know what is breaking GTM.

That is the best advice I can offer without taking a look myself.

-Cheers

Upvotes: 0

Baldr&#225;ni
Baldr&#225;ni

Reputation: 5640

Just spend half a day on it. If you have the same problem has me it is because you are using Smarty and he doesn't recognise it as Js or something like that. I had to use {literal} ... {/literal} tags. Hope this could help someone.

Upvotes: 1

Viktor Iwan
Viktor Iwan

Reputation: 89

Try to replace

'&l' 

with

'&amp;l'

Let me know is it works...

Upvotes: 0

Roger Finch
Roger Finch

Reputation: 13

What tags are installed in your GTM container? Specifically, are you using any "Custom HTML" tags? If so, I've seen the document.write() method do this to pages before. So make sure you check the "Support document.write" box underneath the code block in your tag.

Thanks

Upvotes: 1

underscorePez
underscorePez

Reputation: 897

This could be security rules on your firewall. Many web application firewalls will block 0- width frames to block potential code injection vectors.

Try removing the 'style="display:none;visibility:hidden"' attribute and giving your iframe a height and a width of 100.

If that works, then probably some security system somewhere is blocking the iframe, you can normally fix this by moving the iframe styles out to an external stylesheet like this:

<noscript>
  <iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXXXX" class ="gtmIframe">
  </iframe>
</ noscript>...

and in your stylesheet:

.gtmIframe {
  width:0;
  height:0;
  display:none;
  visibility:hidden;
}

Upvotes: 1

Related Questions