简体   繁体   中英

GTM iFrame Issue

I am using GTM in our site as below. But in Network panel of Chrome I can see that request is got canceled. I checked the javascript code where it failed but it is only form submit code. I believe this happened because of iFrame is not supported by Google Chrome. Is there another way of using GTM without iFrame .

<!-- Google Tag Manager -->
<noscript>
<iframe src="//www.googletagmanager.com/ns.html?id=GTM-TW7XQX" 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-TW7XQX');
</script>
<!-- End Google Tag Manager -->

在此处输入图片说明

Updtae:

Found this is not happening due to iFrame but something else. iFram will only be triggered if javascript is disabled. In this case configured GTM tags are the root cause.

If you look at the code you'll see that the iframe is in noscript tags - it will only ever be called for clients who do not have javascript enabled. GTM will work fine without it, and most people do not even configure GTM for clients without JS (personally I just drop the noscript part and move the GTM code to the page head).

However Google Chrome supports iframes just fine, and the tag that is aborted seems to be a javascript tag in any case. So this problem cannot possibly related to the iframe (which isn't even called as long as the client runs JS).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM