How do I add the Google Tag Manager code to my HubSpot pages?

Last updated: October 19, 2016

Available For:

Product: HubSpot Marketing
Subscription: Basic, Professional, & Enterprise

Google Tag Manager provides with you a code snippet which can be added to your HubSpot pages within Content Settings.

Copy the code from Google Tag Manager

  • Log into your Google Tag Manager account.
  • Click on the Admin tab.
  • Under the Container column, click the Container that contains your tags from the dropdown.
  • Click Install Google Tag Manager
  • On the next screen, you will be able to copy both code snippets (1) and (2) for your Google Tag Manager Container

Adding the Google Tag Manager code to HubSpot pages:

Google advises the Javascript code snippet (labeled 1 in the above screenshot) is placed as high in the <head> of the page as possible. This can be done in your Content Settings in the Site Header HTML field. Google also advises that the <noscript> snippet (labeled 2 in the above screenshot) is placed after the opening <body> tag. However, it can be added to other sections of the page, depending upon a website's settings (see Google Tag Manager FAQs). When adding code to the body of your pages site-wide within HubSpot, you can only add the code directly before the closing </body> tag. This can done within Content Settings by adding your code to the Site Footer HTML field.

  • Navigate to Content > Content Settings > Page Publishing.
    • If you'd only like the code to apply to a particular subdomain, select the subdomain from the dropdown or to set the code for all of your domains, select Default for all domains
  • Add the Javascript code snippet (1) to your Site Header HTML and the <noscript> code snippet (2) to your Site Footer HTML.
  • Be sure to click Save Changes.
For more information about Google Tag Manager, check out Google Tag Manager FAQs.