Troubleshoot the HubSpot tracking code
Last updated: February 14, 2025
Available with any of the following subscriptions, except where noted:
|
The HubSpot tracking code allows HubSpot to track visitors to your site and gather traffic analytics in your account. If you don't see any website traffic data, make sure that the tracking code is installed and working correctly by following the steps below.
Verify the tracking code has been installed
- Verify your Hub ID by clicking your account name in the top right of your account.
- Open a page on your website and right-click anywhere on the page.
- In the dropdown menu, select View page source or View source.
- Use the Ctrl + F or Cmd + F and search for [your Hub ID].js (e.g., 401264.js).
Please note: you may see the HubSpot Embed Code or Async HubSpot Analytics Code. These are both HubSpot tracking codes and indicate that your tracking code has been installed.
If you're using Google Tag Manager or another script loader, the tracking code will not appear in the page source. The tracking code will appear if you’re using the WordPress plugin as long as you don’t have a conflicting plugin installed.

- If the tracking code appears, verify that the code has been copied and pasted correctly from your account settings.
To check the tracking code in your HubSpot account:- Click the settings settings icon in the top navigation bar.
- Navigate to the Tracking & Analytics settings:
- In accounts that only have access to Marketing Hub Starter or HubSpot's free tools, navigate to Tracking Code in the left sidebar menu.
- For all other subscriptions, navigate to Tracking & Analytics > Tracking code in the left sidebar menu.
- The tracking code is in the Embed code section.
- If the tracking code does not appear, install the tracking code
Verify that the tracking code is firing correctly
If your tracking code has been installed correctly and appears on the page, you need to verify that the tracking code is firing:
- Open a page on your website in your browser and right-click anywhere on the page.
- In the dropdown menu, select Inspect Element or Inspect. A toolbar will appear at the bottom or side of your screen.
- Click the Network tab, then refresh your page.
- Click the Name column to sort the elements alphabetically, then scroll to the top of the list.
- In the Name column, look for [your Hub ID].js (e.g., 401264.js). Under the name, you may see from js.hs-scripts.com and/or an instance of this .js element from js.hs-analytics.com.
- Next to [your Hub ID].js, you should see 304 Not Modified or 200 OK in the Status column.

If you see any other status or the JavaScript code is not found, your tracking code may not be firing correctly. Contact HubSpot Support for further troubleshooting and assistance.
It is also expected to see the js.hs-banner script loading in the Network tab, even if you aren't usig the HubSpot's Cookie Consent Banner, as the script is responsible for placing HubSpot's cookies in your visitors' browsers.
If the script loader js.hs-scripts.com is present, also check for the tracking script js.hs-analytics.net to ensure that the code is firing correctly. If you only see the actual tracking script js.hs-analytics.net and not the script loader, the tracking code will still fire correctly.
If the HubSpot tracking code is firing on your website pages, but you do not see any new page views or sessions on your dashboard or in the sources report, you may need to change your target domain or add additional domains to your tracking code settings to make sure that HubSpot is gathering analytics from the correct domain or subdomain.