# Running the HubSpot code through Google Tag Manager

**URL:** <https://community.hubspot.com/t/running-the-hubspot-code-through-google-tag-manager/32971>\
**Category:** Reporting & Analytics\
**Tags:** enterprise\
**Created:** [March 10, 2021, 4:40pm UTC](https://community.hubspot.com/t/running-the-hubspot-code-through-google-tag-manager/32971 "2021-03-10T16:40:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alejandro](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/alejandro/32/8032_2.png) [@Alejandro](https://community.hubspot.com/u/Alejandro)\
**Post date:** [March 10, 2021, 4:40pm UTC](https://community.hubspot.com/t/running-the-hubspot-code-through-google-tag-manager/32971/1 "2021-03-10T16:40:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Josh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/josh/32/17115_2.png) [@Josh](https://community.hubspot.com/u/Josh)\
**Post date:** [March 10, 2021, 7:25pm UTC](https://community.hubspot.com/t/running-the-hubspot-code-through-google-tag-manager/32971/2 "2021-03-10T19:25:32Z")

</div>

Hi [@Alejandro\_](https://community.hubspot.com/t5/user/viewprofilepage/user-id/115716) ,

[Here’s a post in the knowledge base of how to do it.](https://knowledge.hubspot.com/reports/install-the-hubspot-tracking-code)

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

---

<div class="post-metadata">

**Author:** ![Alejandro](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/alejandro/32/8032_2.png) [@Alejandro](https://community.hubspot.com/u/Alejandro)\
**Post date:** [March 10, 2021, 7:31pm UTC](https://community.hubspot.com/t/running-the-hubspot-code-through-google-tag-manager/32971/3 "2021-03-10T19:31:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marycheung](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@marycheung](https://community.hubspot.com/u/marycheung)\
**Post date:** [June 23, 2023, 2:00am UTC](https://community.hubspot.com/t/running-the-hubspot-code-through-google-tag-manager/32971/4 "2023-06-23T02:00:21Z")

</div>

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](http://js.hs-scripts.com)_ and/or an instance of this .js element _from [js.hs-analytics.com](http://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!

 ![hubspot blocked.JPG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/c/ac945df46fd9f1497f0bc76b6746a1512c08c303.jpeg)

---

<div class="post-metadata">

**Author:** ![Josh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/josh/32/17115_2.png) [@Josh](https://community.hubspot.com/u/Josh)\
**Post date:** [March 10, 2021, 7:33pm UTC](https://community.hubspot.com/t/running-the-hubspot-code-through-google-tag-manager/32971/5 "2021-03-10T19:33:22Z")

</div>

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.
