Tammu
asked on
Insert GTM noscript tag after opening body tag in Squarespace
I know squarespace does not provide a way to add the Google Tag Manager noscript code right after the opening body tag. So I used jQuery prepend to add the it. The problem I am facing is when I try to verify my site in Google Search Console using Google Tag Manager, the verification fails as Google Search Console can't see the noscript tag even thought it is inserted using jQuery.
Is there a way insert the code in such way it will literally print the code and can been seen when viewing page source.
Below is my current code.
Is there a way insert the code in such way it will literally print the code and can been seen when viewing page source.
Below is my current code.
$(document).ready(function(){jQuery('body').prepend('<!-- Google Tag Manager (noscript) --><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><!-- End Google Tag Manager (noscript) -->');} );</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.