POST
/
doNotTrack
Enable do not track
curl --request POST \
  --url https://js.hs-scripts.com/doNotTrack \
  --header 'Content-Type: application/javascript' \
  --data '"_hsq.push(['\''doNotTrack'\'']);"'
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 would need to clear their cookies or you would need to provide a mechanism to remove the do-not-track cookie

Body

application/javascript · object

Do not track request

The body is of type object.

Response

200

Do not track enabled successfully