Tracking Code
Analytics Tools

Set up site tracking in HubSpot

Last updated: March 4, 2020

Applies to:

Marketing Hub  Professional, Enterprise
CMS Hub  Professional
Legacy Marketing Hub Basic

Review your account settings to customize how you're tracking your website analytics

  • In your HubSpot account, click the settings icon settings in the main navigation bar.
  • In the left sidebar menu, navigate to ReportsTracking Code.
  • You can manage your tracking settings in the following tabs:

Tracking code

Set a target domain and access your tracking code.

  • Enter your target domain in the Domain field. The target domain is the domain that is used in your analytics
  • Click Save

If you are hosting your site externally, the HubSpot tracking code needs to be embedded on your external site. Without the tracking code on your pages, visits will not be registered from those pages. Learn how to install the tracking code on your external site.

Please note: if you are fully hosted on HubSpot, the tracking code is already embedded on all pages you create so you don't have to worry about this article's steps on installing the tracking code.

Advanced Tracking

If you're tracking external domains in HubSpot, click the Advanced Tracking tab to configure settings to collect your data in HubSpot. 

  • Additional site domains: domains added here are considered as part of your site and data from these domains will be counted in your analytics. To add an external domain to be tracked, click + Add domain. Learn more about tracking your domains in HubSpot.
  • Automatic cross-domain linking: toggle the switch on to count contacts who visit pages on one of your domains and then click a link to visit another of your domains as the same visitor and not as a new visitor. Learn more about cross-domain linkingHubSpot Help article screenshot
  • Limit tracking to these domains: toggle the switch on to only count visits from the domains you selected in your advanced tracking settings. Learn more about limiting tracking to specific domains
  • Bot filtering: toggle the switch on to allow HubSpot to attempt excluding data coming from bots in your analytics data. Learn more about excluding traffic from your site analytics
  • Exclude Traffic: exclude traffic from specific IP addresses and referral domains. It is recommended that you filter out your own traffic to not skew your data with internal visits. Previews of your pages do not count towards traffic; your views to live pages will count in your traffic analytics unless you filter your IP addresses. IP traffic also filters submissions data from your forms. Learn more about excluding traffic from your site analytics

HubSpot Help article screenshot

Analytics views (Marketing Hub Professional and Enterprise only)

Create custom analytics views to filter your data in the sources report. Learn more about creating a custom analytics view

Cookie policy

Customize how you track visitors with cookies and inform them of your privacy policy in your HubSpot account. This is important for complying with EU cookie laws and the General Data Protection Regulation (GDPR)Learn more about customizing your cookie tracking settings and privacy policy alert.