How to Install the HubSpot Tracking Code

Written By Sean McGauley
November 2, 2023

The HubSpot tracking code is the magic ingredient that powers the HubSpot software. It’s a snippet of JavaScript that must be installed on every page of your website within the <body> section, just above the closing </body> tag.

The HubSpot tracking code is exclusive to your HubSpot account and serves the purpose of monitoring your website traffic. This tracking code is automatically integrated into HubSpot blog pages, landing pages, and website pages, but if you’re using externally hosted pages (those not within the HubSpot domain), you will need to manually install the HubSpot tracking code to capture analytics for those specific pages.

The importance of this tracking code cannot be overstated, as it unlocks HubSpot’s most invaluable features, including:

  • Analytics Reports: These reports provide insights into where your website’s traffic, leads, and customers originate.
  • Contact Intelligence: By having this code in place, HubSpot can offer sophisticated lead intelligence, enabling you to convert more website leads into loyal customers.
  • Pages: The tracking code allows HubSpot to crawl your site, providing recommendations for SEO optimization to enhance your website’s traffic.
  • Live Chat: HubSpot’s live chat feature can be embedded into your site, automatically integrating with your HubSpot CRM tools, so your team can utilize contextual information about the customer without extra data migration work. 

Without the HubSpot tracking code, none of these features will function. Installing the JavaScript code promptly on your site is your ticket to unlocking the full potential of HubSpot. The sooner it’s in place, the sooner you’ll start reaping the benefits.

Here's what's covered in this how-to article: click below to jump to the section you want:

Watch the How-To Video

 

 

What You Will Need:

  • Your Webmaster email (easier method)
  • Access to the HTML of your website or the footer HTML in your CMS or Google Tag Manager (harder method)

Step-by-Step Instruction

To navigate to your tracking code, follow these steps.  

  • In your HubSpot account, click the settings icon in the main navigation bar.
  • In the left sidebar menu, click Tracking & Analytics under Account Setup.
  • Click the Tracking Code
  • Click Set up tracking by embedding code
  • Easier method
    • Click Email to my web developer
    • Enter the email address of your web developer and click send
  • Harder method
    • Click copy to copy the embed code
    • To install the tracking code, paste the code before the closing </body> tag in the HTML code for each page of your site. 

Official HubSpot Guidance: How to install the HubSpot tracking code 

Your Next Step

Now that you’ve installed your HubSpot Tracking Code, the next step in setting up your HubSpot portal is to exclude your own visits to your company website from your HubSpot analytics and reporting.

Here’s our step-by-step instructional post and video to exclude your own traffic from HubSpot analytics.


Download Your HubSpot Implementation Checklist

 

Sean McGauley

About the Author

Marketing is more challenging than it’s ever been - but, I’m committed to finding new and creative ways to succeed. By day, I’m a digital marketing enthusiast with a passion for connecting brands with their target audience. I have over a decade of experience in creating and executing successful campaigns with a proven track record. I specialize in Strategy, Copywriting, SEO, and social media marketing - always staying up-to-date with the latest industry trends and technologies. By night, you'll likely find me adventuring with family and friends. I enjoy nature, photography, mountain biking, fly fishing, and trying new foods. I want to connect with other like-minded professionals to learn from and work with.