Tag Manager Verification Fails with Snippet Injection Method

I’m experiencing a failed GTM verification on Search Console while deploying Google Tag Manager through snippet injection in Netlify.

When checking the tag it seems to be implemented however not in the top of the <body></body> tag but just before the end of it where Google Search Console seems to specifically need it to be at the top, therefore failing to verify, prompting

"Verification failed. The Google Tag Manager snippet on your site is in the wrong location."

I tried turning off password protection even though the docs mention it shouldn’t matter - it didn’t make a change. For the two pieces of javascript i’m using two snippets - one for the top just after the <head> and one for the bottom for <body>

Wondering if anyone else has used snippet injection succesfully to implement Tag Managers and if so, how ? :slight_smile:

Many thanks for any suggestions or help in this case

Hello @mbumktops, as mentioned in our snippet injections docs, we are only able to inject your code snippet right above the closing or tag. If google tag manager needs their snippet right below the opening tag, then you can try adding that directly to your html rather than using our snippet injection feature. Let me know how that works out for you. Thank you.

But, as indicated in your documentation, this feature is offered as a way to not “pollute the source code

Please add this as a feature, as it’s a MUCH cleaner way to do verification with Google

Also, VuePress mangles it when using the default theme with custom components only used for minor changes

hey chris, would you mind outlining your use case in this thread: