1. Knowledge Base
  2. HubSpot
  3. Set-up and Configuration

How do I add my HubSpot tracking code to my website?

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 posts, 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. 


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

Copy your HubSpot tracking code

  • In your HubSpot account, click the settings icon settings in the main navigation bar.
  • Navigate to your Reports and Analytics Tracking settings:
    • In Marketing Starter only accounts and free CRM accounts, 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

To install the tracking code, paste the code before the closing </body> tag in the HTML code for each page of your site. 

At the same time, most content management systems and your developers can install code to all pages on your site, such as a footer file that is referenced across all pages. Check with your developers on how they can help do this.

Install the tracking code on a WordPress website

It is strongly recommended that you install and use the HubSpot All-in-One Marketing - Forms, Pop-ups, Live Chat WordPress plugin. The plugin automatically installs the HubSpot tracking code on your WordPress website for you.

Only if you're unable to install the HubSpot WordPress plugin, you can manually install the HubSpot tracking code:

  • Follow the steps above to copy the HubSpot tracking code in your HubSpot account.
  • Log in to your WordPress account.
  • In the left sidebar menu, navigate to Appearance > Editor.
  • In the list of theme files on the right side of the editor, select your Footer.
  • Paste in the tracking code and select Update File.