Add the Google Tag Manager Code to HubSpot Content

Incorporating Google Tag Manager code into HubSpot content is a seamless way to enhance tracking and analytics. By strategically integrating these tools, you can efficiently manage various tags without altering the core website code. This article guides you through the process, ensuring a streamlined and data-rich digital marketing strategy.

Add the Google Tag Manager code to hubspot content

Integrate Google Tag Manager with HubSpot to monitor HubSpot-hosted landing pages, website pages, blogs, and knowledge base via Google Tag Manager.

Initiate Integration with Google Tag Manager

When you combine HubSpot and Google Tag Manager, the tag manager will function across all HubSpot-hosted material. External content, however, must be separately linked to Google Tag Manager.

  • Inside your HubSpot account, access the settings by clicking the settings icon in the main navigation bar. 
  • In the menu on the left-hand side, proceed to Website > Pages
  • Navigate to the Integrations tab. 
  • Checkmark the option that says "Integrate with Google Tag Manager." 
  • Input your Google Tag Manager ID into the provided text field.

Integration with Google Tag Manager

  • Click Save to apply your changes.

Manually Inserting Google Tag Manager Code 

Alternatively, you have the option to insert the Google Tag Manager code into HubSpot-hosted content manually. This approach is suggested when you specifically intend to track certain HubSpot-hosted domains using this method. Note that these instructions are relevant only for accounts that possess access to site header and footer HTML settings.

Retrieve the Code from Google Tag Manager.

  •  Access your Google Tag Manager account by logging in. 
  • Navigate to the Admin tab
  • Select the desired Container from the Container dropdown, the one that houses your tags. 
  • Proceed to Install Google Tag Manager.

Install Google Tag Manager

  • On the next screen, you can duplicate both code fragments labelled as (1) and (2) designed for your Google Tag Manager Container.

Google Tag Manager Container

  • Inside your HubSpot account, initiate the process by clicking on the settings icon located in the main navigation bar. 
  • In the menu on the left side, navigate to Website > Pages. 
  • Click on the dropdown menu labeled "Choose a domain to edit its settings" and make a selection of a domain. If you intend to incorporate the code across all HubSpot-hosted domains, opt for "Default settings for all domains."

Default settings for all domains

  • Insert the code fragments previously copied from Google Tag Manager: 
  1. Integrate the JavaScript code fragment within the Site header HTML field. 
  2. Include the <noscript> code fragment within the designated section for Site footer HTML.

code fragment within the Site header & footer

  • Click Save to apply your changes.
 Rahul Guleria

Rahul Guleria

I am a digital marketing strategist who loves trying new things, analyzing the data behind them, and helping build brands through content marketing and social media.