Skip to content
whovisited.

Implementation · Privacy

Handle consent changes and browser privacy signals in analytics

Connect a consent manager to WhoVisited, handle withdrawal safely, and test how Global Privacy Control and Do Not Track affect collection.

Understand what browser privacy signals do here

Global Privacy Control (GPC) and Do Not Track (DNT) are browser signals, not a replacement for your consent manager. WhoVisited reads `navigator.globalPrivacyControl` and the legacy `navigator.doNotTrack === "1"` when the tracker initializes. If either indicates an opt-out, collection stays off for that page load, including when your code calls `consent(true)`. Reload after changing a browser privacy setting before testing its effect.

GPC's JavaScript property reflects a browser preference and is not supported in every major browser. MDN marks it as limited availability. DNT is deprecated and its specification was discontinued; WhoVisited still honors the `"1"` value for compatibility. Do not interpret an absent GPC signal or a DNT value other than `"1"` as proof that someone consented.

This describes the tracker's current behavior, not a legal conclusion about what a business must do. Review the privacy rules that apply to your site and configure your consent manager accordingly. A browser signal and a site-specific consent choice are separate inputs; neither should be silently rewritten to make analytics reports fuller.

Test grant, withdrawal, and a later grant

  1. In a clean browser profile with GPC off and DNT not set to "1", load a page with `data-consent="required"`. Before the CMP grants analytics permission, the Network panel should show no WhoVisited bootstrap or event request.
  2. Grant the analytics category in the CMP. Confirm the adapter calls `consent(true)` and that a page-view request can follow. Check the actual Network request and your configured site's allowed origin, rather than relying only on a console message.
  3. Withdraw analytics permission without navigating away. Confirm the adapter calls `consent(false)`, then navigate and trigger a custom event. No new tracking request should be initiated for those actions.
  4. Grant permission again and verify collection resumes with a new page view. The old visitor and session identifiers were cleared on withdrawal, so do not expect the earlier visitor record to continue.
  5. Repeat in a fresh profile with GPC enabled, then with DNT set to "1" where the browser supports it. Both should remain untracked even if the CMP callback says analytics is allowed.

A withdrawal cannot recall a request that was already sent over the network before the choice changed. The tracker discards a response if consent was revoked while an asynchronous request was in flight, but the browser cannot unsend bytes already delivered to the service. Keep the UI clear about when a choice takes effect, and do not describe withdrawal as erasing events already received.

Keep the integration honest about its limits

Browser support varies, storage can be unavailable, and a page cannot reverse an event already transmitted. Test the real CMP callback in the browsers your audience uses, including rejection, withdrawal and re-grant paths. WhoVisited can pause collection and clear its browser-side identifiers when told to do so; the site owner must connect that control to the correct consent category and explain the choice to visitors.

For browser behavior, see MDN's documentation for [`Navigator.globalPrivacyControl`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/globalPrivacyControl), the [`Sec-GPC` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-GPC), and the deprecated [`Navigator.doNotTrack`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/doNotTrack). Those references describe the signals and their limitations; the integration behavior above is based on the current WhoVisited tracker source.

References and further reading

  1. MDN: Navigator.globalPrivacyControl
  2. MDN: Sec-GPC HTTP header
  3. MDN: Navigator.doNotTrack
  4. WhoVisited: How to install and verify WhoVisited analytics
  5. WhoVisited: Allow a website analytics tracker through your Content Security Policy