COS-General

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

Last updated: février 13, 2018

Applies to:

Marketing Hub: Basic, Pro, Enterprise

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

1. Copy the code from Google Tag Manager

  • Log in to your Google Tag Manager account.
  • Click 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.

2. Add the Google Tag Manager code to HubSpot pages

Google advises the Javascript code snippet (labeled 1 in the above screenshot) to be 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 on a website's settings (see Google Tag Manager FAQs). When adding code to the body of your HubSpot pages site-wide, you can only add the code directly before the closing </body> tag.This can be done in your content settings in the Site Footer HTML field.

  • In your HubSpot Marketing Basic, Professional, or Enterprise account, navigate to Content > Content Settings.
  • In the Modifying dropdown at the top, select the specific domain you'd to add the code to, or select All domains to add the code to all of your HubSpot-hosted domains.

Please note: you can choose specific domains if you want to add code to one domain but not another you have in HubSpot. If you do add any code within the header or footer HTML for a specific domain, it will override any code you have placed in header and footer HTML for All domains.

  • Add the Javascript code snippet (1) to the Site header HTML section and the <noscript> code snippet (2) to the Site footer HTML section.
  • Click Save at the bottom left.
For more information, check out Google Tag Manager's Getting Started guide, which includes a page on Common Questions.

Was this article helpful?

If you still need help you can get answers from the , or to contact support.