Hi. I’m needing to find where in Hubspot I can locate and delete the GTM tag that’s currently added. It’s in the wrong place. I’ve had a call with a Google Support GTM expert and Tag Assistant shows the current placement is erroring re: <script> tag must not be included in a <div>. The problem is it’s not in the head tag.
Once I can locate and edit the current wrong tag placement, I can use Hubspot Integrations or paste into Head tag using the Hubspot templates. But I can’t see how the current tag has been added to all pages. Please can someone / Hubspot developer expert investigate and let me know where it is and how I can remove it? Thanks.
Hi @Chappers
Normally people would use the Google Tag Manager setting, a simple tick of checkbox adds the Google Tag Manager ID. From what you describe it sounds like this was added manually to the pages or templates, in which case you would have to check template code in the design manager.
Hope that helps a little bit.
Frank
Thanks. I’ve tried to do that but still can’t see the GTM snippet. Can you / others indicate what I should be clicking in the Design Manager to see that snippet somewhere?
Got you! Usually you’d find your themes here:
- In your HubSpot account, navigate to Marketing > Files and Templates > Design Tools.
- In the finder, click the @hubspot folder. This folder contains all themes and default modules, including drag and drop email modules.
- There is also a @marketplace folder which contains all the themes purchased on the HubSpot market place.
Once you’ve found the theme, it shows the various html templates.
But as I write this I doubt you’d find the wrongly embedded script in there.
Have you checked within the published pages? When you go to the edit menu, settings tab and expand the “advanced options” as that is where people can add code snippets before publishing.
Can’t see GTM tag snippet anywhere in those areas you suggested. I’ve been in them before too and drawn a blank. Headers, footers, text, page templates. We seek the GTM tag here, there, everywhere - but can’t find it…!
Yes, checked that - nothing there either. Bit of a mystery.
Hi Chappers
Silly question, can you see the actual wrong script when you do an “inspect
source” on the actual website page? If so, can you share the URL and a
screenshot?
Thanks
Frank
@Chappers It looks like the snippet is inside a partial file (EQM 2022/Templates/partials/head.html). You’ll want to go into Design Manager and find folder EQM 2022 > Templates > paritals > and then open the head.html file. You should find the GTM snippet in there. It seems the head.html was meant to be the base code for the <head> but in the theme code it’s somehow been placed incorrectly and ended up in the <body>.
I’m also seeing an iframe version of GTM in between the head.html and rest of the code. Not sure if this is being generated by the script in head.html or added in the code. If it is in the code it’d likely be in a file either in the partials folder or a layout folder and possibly called something like base.html.
Thanks @alyssamwilie . By coincidence I found the snippet yesterday too, but wasn’t aware of all that you’ve helpfully explained. How did you see all that? I’m guessing all is publicly visible somewhere is it? Are there some instructions or a guide somewhere that explains how to place GTM correctly across site pages - and i-frames?
For the head.html file I got this from the console. When a partial file is added to a template, on the front-end, HubSpot wraps it in a div with an attribute that shows it’s location in the Design Manager. You’ll also see that it’s placed directly inside the <body> tag, BUT this partial includes things like meta tags and stylesheets which would infer it should actually be inside the <head> instead where that type of code would usually be located.
As for the base.html I mentioned this is just a setup a good majority of themes will use as this is how the HubSpot theme boilerplate is setup.
For HubSpot I’d say the best way to set up GTM is to use HubSpot’s built-in integration for it:


