Set up sources tracking

Last updated: March 14, 2019

Applies to:

Marketing Hub  Professional, Enterprise
Legacy Marketing Hub Basic
HubSpot CMS

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.
  • On 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 the links, page performance, and competitors tools. This is also the domain listed above your Hub ID in the top-right corner of your account. target-domain
  • Click Save

If you are hosting your main site elsewhere and using HubSpot for landing pages and/or the blog only, then 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. This prevents you from seeing your total visits on the dashboard and prevent sources from pulling in data of where your visits are coming from.

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.

  • On the Tracking code tab, in the Tracking code installation section, click Copy to copy your embed code.
  • If someone else on your team is going to add the tracking code to your site, click Email to my web developer.
  • In the dialog box, enter their email address then click Send

Learn more about how to install the tracking code on your external site. If you've already installed the tracking code but aren't seeing any data for those pages, make sure your tracking code is installed properly

Advanced tracking

If you're tracking external domains in HubSpot, there are specific settings you can configure to make sure your data is successfully collected in HubSpot. 

  • Additional site domains: domains listed here are considered part of your site and are 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: to count contacts who visit pages on one domain and then click on a link to visit another domain (e.g., to as the same visitor and not as a new visitor, click to toggle the Automatic cross-domain linking switch on. Learn more about cross-domain linkingHubSpot Help article screenshot
  • Limit tracking to these domains: with this setting enabled, visits will only be counted for the domains you choose to track in your advanced tracking settings. Learn more about limiting tracking to specific domains
  • Bot filtering: click to toggle the Bot filtering switch ON to prevent any bots from skewing 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 highly recommended that you filter out your own traffic so that you don't 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)

Enabling/disabling cookies will not affect your data in the sources report, as HubSpot will still be able to pick up where visitors came from to find your site. However, original source data will not be available in a contact's record if cookies are not enabled.

Learn more about customizing your cookie tracking settings and privacy policy alert