Skip to content
  • There are no suggestions because the search field is empty.

How to install HubSpot tracking code

The HubSpot tracking code is unique to each HubSpot account and allows HubSpot to monitor your website traffic.

Getting Your Tracking Code

  1. Go to HubSpot Settings (gear icon)
  2. Navigate to:
    • Marketing Starter/Free: Go to "Tracking Code"
    • Other subscriptions: Go to "Tracking & Analytics" > "Tracking code"
  3. Find "Embed code" section
  4. Click "Copy" or "Email to my web developer"

Installation by Platform

1. Standard Website

  • Paste code before closing </body> tag
  • Add to all pages of your website
  • Best practice: Add to footer file for site-wide implementation

2. WordPress

Recommended Method:

  • Install "HubSpot All-in-One Marketing" plugin
  • Plugin automatically handles code installation

Manual Method:

  1. Go to Appearance > Editor
  2. Select Footer file
  3. Paste tracking code
  4. Click "Update File"

3. Shopify

  1. Login to Shopify admin
  2. Go to Online Store > Themes
  3. Click Actions > Edit code
  4. Open theme.liquid
  5. Paste code before </body>
  6. Save changes

4. Wix

  1. Go to Settings > Advanced
  2. Click Custom Code
  3. Click "+ Add Custom Code"
  4. Paste tracking code
  5. Name it "HubSpot Tracking Code"
  6. Select:
    • All pages
    • Load code on each new page
    • Body - end
  7. Click Apply

5. Squarespace

  1. Go to Settings
  2. Navigate to Advanced > Code Injection
  3. Paste code in Header field
  4. Save changes

Important Notes

Do's

  • Install on all pages
  • Verify installation
  • Add external domains to HubSpot settings
  • Use only one tracking code per page

Don'ts

  • Don't install multiple tracking codes
  • Don't use on AMP sites
  • Don't forget to verify installation