Reports

How do I install the HubSpot tracking code on my external website using Google Tag Manager?

Last updated: December 7, 2016

Available For:

Marketing: Basic, Pro, Enterprise
Sales: N/A




First, copy the HubSpot tracking code

  • Navigate In HubSpot Marketing to Reports > Reports Settings.
    Reports Settings
  • At the top of the screen, you will see your HubSpot Tracking Code. Click Copy to clipboard.
Copy tracking code
Copy tracking code


Add the tracking code as a tag within Google Tag Manager

  • In a new browser tab or window, log into your Google Tag Manager account and select your container.
  • Create a new tag for your HubSpot tracking code. Click Tags in the left menu > then select New.

  • Click on Tag Configuration
    • For the Tag Type choose 'Custom HTML Tag'.
    • Add a descriptive Tag Name at the top.
    • In the HTML section, paste in the HubSpot tracking code copied from your Reports Settings.
  • Below Tag Configuration, click on Triggering to set up a firing rule. (Note: if you do not setup a firing rule then the tag will not fire and HubSpot analytics data will not be collected).
  • For the tag to fire on all pages with the Google Tag Manager code installed (recommended) select the option for All Pages.
  • Save the new tag that was just created.
  • Click on the 'Publish' button in the top right corner to save your container and tags.
  • Add the Google Tag Manager code to your website pages below the <body> tag, if not already installed. The Google Tag Manager code is available under Admin > Install Google Tag Manager.