Install the HubSpot tracking code
Last updated: January 28, 2025
Available with any of the following subscriptions, except where noted:
|
The HubSpot tracking code is unique to each HubSpot account and allows HubSpot to monitor your website traffic. The tracking code is automatically included on HubSpot blog pages, landing pages, and website pages.
If you have any externally hosted pages (i.e., pages not on HubSpot), you must install the HubSpot tracking code manually to capture analytics for those pages.
Learn more about how the tracking code allows you to track visitors to your website.
If you use the HubSpot tracking code, your visitors’ data is collected and used to monitor your website traffic. HubSpot also uses certain data collected from the HubSpot tracking code to improve Hubspot’s products and services, including the Breeze Intelligence commercial dataset. You can turn off data sharing with HubSpot for your account by navigating to your account settings. Learn more about the data that's collected by the HubSpot tracking code.
Please note:
- You should not install multiple HubSpot tracking codes on one 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 load.
- If your IT admin or web developer is installing the code, they must have a HubSpot user account.
- If you're using a single-page application, check out the developers documentation to set up tracking.
- 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.
- If your external site is using WordPress, it is recommended to install and use the HubSpot All-in-One Marketing - Forms, Pop-ups, Live Chat WordPress plugin. It will install the HubSpot tracking code on your WordPress site.
- If a visitor has an ad blocker installed, it may interfere with the tracking code.
Copy your HubSpot tracking code
- In your HubSpot account, click the settings settings icon in the top navigation bar.
- Navigate to your Tracking & Analytics settings:
-
In accounts that only have access to Marketing Starter or HubSpot’s free tools, navigate to Tracking Code in the left sidebar menu.
- For all other subscriptions, navigate to Tracking & Analytics > Tracking code in the left sidebar menu.
-
- In the Embed code section, click Copy or click Email to my web developer to send the tracking code to the team member who will be installing it on your site.
- Install the tracking code on your website.
Install the tracking code on your website
To install the tracking code, paste the code before the closing