How can I hide visible code text on my website after installing Google Tag?

Topic summary

A Shopify store owner discovered visible code text appearing at the top and bottom of their website after installing Google Tag Manager. They wanted to keep the tag installed but hide the code from public view.

Root Cause Identified:
The Google Tag code was placed outside of proper script tags, causing it to render as visible text instead of executing as code.

Solution Provided:
Move the Google Tag code (specifically the gtag('config', 'AW-3344547...') line) inside proper script tags with the correct markup structure.

Outcome:
The issue was successfully resolved after implementing the suggested code placement fix. The store owner confirmed the solution worked.

Summarized with AI on November 19. AI used: claude-sonnet-4-5-20250929.

I have code txt visible on my website and can not work out how to hide it from the public! I believe it happened when I installed google tag. I want to keep the google tag installed just not to show on my website.

See below photo’s of the top and bottom of my website showing the code displayed. Please help?!

Hi @Jode81 ,

This happen if there is issue in rendering of page so code is not properly rendered, could you please share your store url so I can check.

Thanks

Thankyou, it is www.onestopcelebrations.com

Can you share the link to your website please? This would make it a little bit easier for me to see what the problem is and guide you in the right direction.

My website is http://www.onestopcelebrations.com/

Thankyou :slightly_smiling_face:

Hi @Jode81
I found the reason this is because Google Tag is outside the script tag in code.

Current →


 gtag('config', 'AW-11033445427');

Change this to


This will solve the issue.

1 Like

Hi,

Thankyou so much for your help, this solved my issue!!

1 Like