GTM Configuration
1. Create a Google Tag Manager Variable of the type JavaScript Variable
2. Modify your Custom HTML block that contains the JavaScript in GTM Containers Blocks.
< script nonce=“{{gtmNonce}}”>
console.log(“This is a test”);
< /script>
3.
Ensure that you check the Support document.write checkbox, as this is essential for the script to function correctly.
If your js executes any other js and in that case, in your script, you need to add cspnonce, example as below
s = document.querySelector(‘script’);t.setAttribute(‘nonce’,window.cspNonce);