×

Hubspot tracking data explained

How the Hubspot tracking code collects data on your site

The Hubspot tracking code is a JavaScript snippet you add to your website to measure visits, page views, and interactions. Understanding how Hubspot collects and stores this data helps you stay compliant, analyze performance, and troubleshoot tracking issues.

What the Hubspot tracking code does

When the tracking code loads in a visitor’s browser, it creates and updates cookies, records page views, and sends data back to your Hubspot account. This process lets you see which pages are visited, how often visitors return, and when they become identified contacts.

The tracking code supports analytics for:

  • Traffic reporting and page performance
  • Contact timelines and activity history
  • Attribution, sources, and campaigns
  • Forms and session activity

Core data collected by Hubspot tracking

The tracking snippet focuses on session-level and browser-level information, not on sensitive personal data by default. Hubspot then maps this behavioral data to contacts when they submit forms or otherwise identify themselves.

Hubspot cookies and their purpose

The script sets several cookies in the visitor’s browser. These cookies help Hubspot recognize returning users and connect visits to a single contact record over time. Common cookies include:

  • First-party tracking cookies to identify a unique browser and store an anonymized ID.
  • Session cookies that expire when the browser is closed and help track a single visit.
  • Analytics cookies that track pages viewed, time on page, and referral sources.

Because cookies are browser-specific, the same person using two browsers or devices will be tracked as separate anonymous visitors until Hubspot can associate them with a contact record.

Hubspot page view and session activity

Each time a page with the tracking code loads, an event is sent with information such as:

  • URL and page title
  • Timestamp of the view
  • Referral source and UTM parameters (if present)
  • Browser and device details

Hubspot groups page views into sessions based on timing and activity. This allows you to see:

  • Number of sessions per visitor
  • Entry and exit pages
  • Session duration and engagement

How Hubspot identifies contacts

Before a visitor identifies themselves, their behavior is stored under an anonymous browser ID. Once a person provides contact details, Hubspot associates their past and future activity with that contact record.

Hubspot form submissions

When a visitor submits a form that is connected to your Hubspot account, several actions occur:

  1. The form fields are sent to Hubspot as contact properties.
  2. The visitor’s cookie ID is linked to the new or existing contact.
  3. Previous page views and sessions for that cookie ID are added to the contact timeline.

This means that once a visitor is identified, you can see what pages they visited before converting, along with subsequent visits.

Non-Hubspot forms and tracking

If you are not using native Hubspot forms, you can still capture tracking data with non-native forms by:

  • Using form API integrations or embedded form options.
  • Mapping external fields to Hubspot contact properties.
  • Passing the visitor’s cookie or tracking ID where applicable.

Proper configuration ensures Hubspot can connect external form submissions to the correct contact timeline.

Hubspot account and technical requirements

Certain data collection features depend on your subscription level and technical setup. Not all Hubspot accounts have access to every analytics detail.

Supported browsers and environments

The tracking code relies on modern browser capabilities, JavaScript, and cookies. For accurate data collection:

  • Visitors must have JavaScript enabled.
  • Browsers must accept cookies for tracking continuity.
  • Ad blockers or privacy tools may limit some tracking events.

Hubspot provides general compatibility with current versions of popular browsers, but behavior may vary if visitors block scripts or third-party resources.

Hubspot pages vs. external pages

You can use the tracking code on:

  • Hubspot-hosted pages and blogs (automatically injected by the platform).
  • External sites where you manually install the tracking script.

On external sites, make sure the code is placed before the closing </body> tag or as directed in your content management system settings.

Managing Hubspot tracking and privacy

Website owners are responsible for configuring tracking in line with laws and policies. Hubspot provides mechanisms to help you manage consent, cookies, and tracking behavior.

Configuring cookie consent with Hubspot

You can use built-in cookie banners and consent tools to inform visitors and request permission before setting certain cookies. Typical steps include:

  1. Enable the cookie banner in your Hubspot settings.
  2. Customize the banner text and appearance.
  3. Choose your consent type (notice only, opt-in, or opt-out).
  4. Test the behavior across your main pages and devices.

Always align your consent settings with your region’s privacy requirements and your own privacy policy.

Disabling Hubspot tracking for specific users

In some circumstances you may want to limit tracking:

  • Employees and internal testers
  • Staging or development environments
  • Specific IP addresses or ranges

Hubspot lets you exclude traffic based on IP addresses and manage other filters in your analytics settings. Doing so helps keep your data clean and focused on genuine visitors.

How to add the Hubspot tracking code to your site

You can install the code directly or through a tag manager. Below is a basic, platform-neutral process.

Step-by-step Hubspot tracking installation

  1. Log in to your Hubspot account and navigate to your tracking code settings.
  2. Copy the full JavaScript snippet provided.
  3. Open your website template or theme editor.
  4. Paste the code before the closing </body> tag or in the designated tracking scripts area.
  5. Publish or deploy your changes.
  6. Visit a tracked page and confirm that page views appear in your Hubspot analytics.

If you use a tag manager, create a new tag with the script and trigger it on all pages where you want tracking to run.

Best practices for accurate Hubspot analytics

To get reliable reporting and contact timelines, combine technical setup with ongoing maintenance.

  • Regularly check analytics for unusual spikes or drops.
  • Audit tracking on new landing pages and microsites.
  • Review IP filters to avoid excluding legitimate traffic.
  • Keep a record of where the tracking code is installed.

For deeper implementation guidance and strategic support around analytics, you can consult specialists such as Consultevo.

Learn more about Hubspot tracking data

For the latest, complete breakdown of the data collected by the Hubspot tracking code, including cookie names, technical limits, and product-specific behavior, review the official documentation at Hubspot’s knowledge base.

By understanding how the tracking script, cookies, and contact identification work together, you can configure Hubspot to deliver accurate analytics, better attribution, and a clearer picture of each visitor’s journey across your website.

Need Help With Hubspot?

If you want expert help building, automating, or scaling your Hubspot , work with ConsultEvo, a team who has a decade of Hubspot experience.

Scale Hubspot

“`

Verified by MonsterInsights