Prevent all tracking by the HubSpot tracking code by placing a do not track cookie in the visitor’s browser.
Usage
var _hsq = (window._hsq = window._hsq || []);
_hsq.push(["doNotTrack"]);
What this does
- Places a “do not track” cookie in the visitor’s browser.
- Prevents the HubSpot tracking code from collecting any analytics data.
- Stops page view tracking, event tracking, and visitor identification.
- Honors the visitor’s privacy preferences.
Use Cases
- Privacy Compliance: Respect visitor’s do-not-track preferences.
- Opt-out Mechanism: Provide a way for visitors to disable tracking.
- Employee Exclusion: Prevent internal traffic from being tracked.
- Testing Environment: Disable tracking during development/testing.
Notes
- This is a permanent setting until the cookie is manually removed.
- The cookie persists across browser sessions.
- This affects all HubSpot tracking functionality.
- To re-enable tracking, the visitor must clear their cookies or you must provide a mechanism to remove the do-not-track cookie.
Last modified on April 17, 2026