Become a HubSpot power user — join us for HubSpot Training Day 2017.


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

Last updated: May 15, 2017

Available For:

Marketing: Free, Starter, Basic, Pro, Enterprise
Sales: Free, Professional

1. Copy the HubSpot tracking code

  • Copy your HubSpot tracking code by following the instructions here.

2. 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.

Was this article helpful?