Google Tag Manager Script

I am having an issue trying to get a Google Tag Manager script into the section of my web pages. I have inserted the code into the file:


As recommended in other posts but it does not show in the source code. I have tried both with and without {literal}. I have also tried to install it in the "default" layout in the custom HTML code box as also suggested but the code just disappears when I hit "save".

Any direction would be appreciated.

Just wanted to mention that I followed these instructions from another post and it shut down my site:

Hello! You can create a file [cscart_root]/design/themes/[your_theme]/templates/addons/my_changes/hooks/index/ in my_changes addon and put your code to it.

The code I am trying to add is:

You can try our free module

We put it in a meta.override.tpl which for us has a bunch of opengraph, schema code, and stuff for the head section of the site.

You need to place it inside literal tags or it breaks the store. And, include data-no-defer to make sure the tag stays at the top. Here's what ours looks like. And it works.