In Setting, navigate to Reports, then Tracking Code. Below the Embed code section, click Copy. Install the tracking code use Google Tag Manager.
The HubSpot tracking code helps you monitor your website's traffic. The tracking code is automatically included on HubSpot pages; however, if you have pages on your website that are not hosted on HubSpot, you must install the HubSpot tracking code to capture analytics for those pages.
- You should not install multiple HubSpot tracking codes on a page. If there are multiple HubSpot tracking codes installed, the first one to load on the page will fire; any subsequent HubSpot tracking codes will not work.
- If you're hosting entire domains or subdomains externally, you must also add your domain(s) and/or subdomain(s) to your settings in HubSpot.
- The tracking code is not supported on AMP sites.
Copy your tracking code
In your HubSpot account, click the settings icon settings in the main navigation bar.
In the left sidebar menu, navigate to Reports > Tracking Code.
Below the Embed code section, click Copy.
Please note: the tracking code is different for every HubSpot account; you must copy the code directly from your account.
Install the tracking code using Google Tag Manager
Follow the steps above to copy the HubSpot tracking code in your HubSpot account.
In a new browser tab or window, log in to your Google Tag Manager account.
Select your container.
In the left sidebar menu, navigate to Tags.
Click Tag Configuration.
For the Tag type, choose Custom HTML Tag. Then, give your tag a name.
Paste the tracking code in the HTML field.
Below Tag Configuration, click Triggering to set up a firing rule. If you don't set up a firing rule, 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, select the option for All Pages.
Click Save to save your new tag.
In the upper right, click Publish to save your container and tags.
There you have it! Your HubSpot tracking code will now be applied to your website pages.