Running the HubSpot code through Google Tag Manager

Hello,

I have an interesting question for something I’ve never come across and I was wondering how y’all see tracking code best practices.

I’ve only ever used the best practice of implementing a tracking code in the footer or header of a website and have never heard of adding it to GTM.

Would y’all consider both to be a best practice, or maybe one over the other?

If y’all did consider the latter a best practice - why? Pro’s? Con’s?

Hi @Alejandro_ ,

Here’s a post in the knowledge base of how to do it.

We have done this on client’s websites that are not on the HubSpot CMS and use GTM for other purposes. We have not experienced and issues with it. The pros are the same as with GTM in general:

  • Easily adding, removing, adjusting tags without needing a developer
  • Choosing which tags fire on which pages
  • Choosing which tags fire on which conditions

Josh

Thanks for replying, @Josh. Would you consider this a best practice; running the tracking code through GTM?

Hi Josh,

My website is using sitecore CMS and I’ve installed the hubspot tracking code via GTM. Unfortunately it’s blocked -

  • In the Name column, look for [your Hub ID].js (e.g., 401264*.js)*. Under the name, you may see from js.hs-scripts.com and/or an instance of this .js element from js.hs-analytics.com.
  • Next to [your Hub ID].js, you should see 304 Not Modified or 200 OK in the Status column.

Do you know any ways that I can install the hubspot code properly? thanks a lot!

There are so many variables…

If it were a WordPress site and you are using the plugin, it’s unnecessary.

For our company, it would be a best practice if other tags were using GTM. We probably wouldn’t deploy GTM for this sole purpose unless there was another underlying reason.