How to set up sources tracking

Last updated: February 20, 2018

Applies to:

Marketing Hub
Basic, Professional, Enterprise

When you first set up your HubSpot account, your account settings should be reviewed to ensure that you are gathering all pertinent data and that it gets categorized properly.

However, if you are hosting your main site elsewhere and using HubSpot for just landing pages and/or the blog, the HubSpot tracking code should be placed within your external website's footer. Without the tracking code on your pages, visits will not be registered from those pages. This will inhibit 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.

Navigate to your account settings

In your HubSpot account, click your photo or avatar in the top right-hand corner, then click Settings.
HubSpot Help article screenshot

Set your target domain

Install Code & Tracking will be selected by default. The first thing you'll see in the Tracking Code tab of your settings is your target website domain. The Target domain is the domain that is used in the links, page performance, and competitors apps. This is also the domain listed above your Hub ID in the top-right corner of your account.

HubSpot Help article screenshot

Install your tracking code

You'll need to embed the tracking code on any external website pages you want HubSpot to track. Once installed, it may take a few moments to write to all your pages. Check out these instructions on how to validate that the tracking code is properly installed on your external pages. Refer to this article on how to install the tracking code on a generic website.

Set your privacy policy

By default, this is set to Do not notify visitors that your site uses cookies. 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 records (recording their original source data) if cookies are not enabled.

Depending on the location of your company, you may be required by law to request consent for cookies to be used during a visitor's session, or you may not be allowed to track cookies at all. Please ensure you are following the proper use guidelines specific to your location. If you're doing business in Europe, check out this article to learn how to set this up.

HubSpot Help article screenshot

Navigate to advanced tracking

You can view your other connected domains and add any external websites that have your HubSpot tracking code installed. To add an additional external domain, click +Add domain.

In this section, you can enable Automatic cross-domain linking to ensure that contacts who visit pages on one domain and click on a link to visit another domain (e.g., to will be counted as the same visitor and not as a new visitor.

You can also select to Limit tracking to these domains in your list of site domains. This ensures that if somehow your tracking code ended up elsewhere that doesn't belong to your website, it will not count visits for those domains. With this setting enabled, visits will only be counted for the domains you choose to track.

HubSpot Help article screenshot

Exclude traffic from your reports

The last section allows you to 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. Note that filtering IP traffic also filters submissions data from your forms. Learn more about how IP filtering impacts form submissions here.

You can find your current IP address at the top of this section. If you need to determine other IP addresses for your home or business, ask your IT department or internet provider. Add your IP addresses to the IP Addresses to Exclude field. Use commas to separate different IP addresses (for example,, and use dashes to represent entire ranges of IP addresses (for example: -  

You can also filter our traffic from specific domains, by adding the root domain (for example, to the From these referrers field. When you're finished, click Save

HubSpot Help article screenshot

Was this article helpful?

If you still need help you can get answers from the , or to contact support.

Previous article:

Next article: