I use react-gtm-module to place the Google Tag Manager Tags in a react/next.js app hosted with netlify.
The gtm script tag in the head renders perfectly. But the noscript tag in the body is rendered falsely with the iframe as string:
<body>
<noscript>
"
<iframe src=".html?id=GTM-XXXXXXX>m_auth=>m_preview=>m_cookies_win=x"
height="0" width="0" style="display:none;visibility:hidden" id="tag-manager"></iframe>"
</noscript>
...
</body>
react-gtm-module code:
import TagManager from 'react-gtm-module'
...
ponentDidMount(){
const tagManagerArgs = { gtmId: 'GTM-NCGQVKQ' }
TagManager.initialize(tagManagerArgs);
}
Has anybody an idea what might be the cause?
Thanks a lot!
I use react-gtm-module to place the Google Tag Manager Tags in a react/next.js app hosted with netlify.
The gtm script tag in the head renders perfectly. But the noscript tag in the body is rendered falsely with the iframe as string:
<body>
<noscript>
"
<iframe src="https://www.googletagmanager./ns.html?id=GTM-XXXXXXX>m_auth=>m_preview=>m_cookies_win=x"
height="0" width="0" style="display:none;visibility:hidden" id="tag-manager"></iframe>"
</noscript>
...
</body>
react-gtm-module code:
import TagManager from 'react-gtm-module'
...
ponentDidMount(){
const tagManagerArgs = { gtmId: 'GTM-NCGQVKQ' }
TagManager.initialize(tagManagerArgs);
}
Has anybody an idea what might be the cause?
Thanks a lot!
Share Improve this question edited May 20, 2020 at 16:15 aaRitsch asked May 20, 2020 at 8:00 aaRitschaaRitsch 831 silver badge6 bronze badges 2-
Hi, could be great if you can post also how the piece of code where you insert the
noscript
gtm part. – Pierfrancesco Commented May 20, 2020 at 8:05 - I just added it : ) – aaRitsch Commented May 20, 2020 at 16:15
2 Answers
Reset to default 3When scripting is enabled, the noscript
element will only contain plain text. Try disabling JS in your browser, then the text in the noscript
tag should be parsed as HTML
https://html.spec.whatwg/multipage/scripting.html#the-noscript-element
If your app is only on the client side (no server-side rendering involved), then the noscript
part is useless and will never be triggered, since it is loaded using javascript and it is only meant in case javascript is disabled.
From the package's README:
Disabling javascript in the browser can prevent the correct operation of this library if React is only being rendered on the client side.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744325406a4568625.html
评论列表(0条)