Application respects DNT signal; analytics disabled when DNT header set
Why it matters
GDPR Art. 25 (privacy by design and default) supports honoring user privacy preferences expressed through browser controls, and California's SB-27 explicitly requires certain businesses to respect the Do Not Track signal. More broadly, a user who has configured their browser to send DNT: 1 has expressed a clear privacy preference — loading analytics scripts regardless of that signal is a direct contradiction of the privacy-by-design principle. While DNT is not universally legally mandated, its absence in jurisdictions that do require it (some US states) creates a patchwork compliance gap. The implementation cost is one conditional check; the omission signals that user privacy preferences are not honored when they conflict with analytics objectives.
Severity rationale
Info because DNT compliance is not universally legally mandated and requires no data breach to trigger, but in jurisdictions where it is required it is a standalone violation addressable with a single code change.
Remediation
Check navigator.doNotTrack before initializing any non-essential analytics or tracking script. Wrap this in a helper in lib/analytics.ts so the check is applied consistently.
// lib/analytics.ts
function isDNTEnabled(): boolean {
if (typeof navigator === 'undefined') return false
return (
navigator.doNotTrack === '1' ||
(navigator as Navigator & { msDoNotTrack?: string }).msDoNotTrack === '1'
)
}
export function initAnalytics() {
if (isDNTEnabled()) return // respect user preference
// Only initialize after consent AND DNT check pass
const consent = JSON.parse(localStorage.getItem('cookie_consent') ?? '{}')
if (!consent.analytics) return
// GA4 / Segment / Amplitude initialization here
gtag('consent', 'update', { analytics_storage: 'granted' })
}
Call initAnalytics() from your consent banner's save handler rather than unconditionally on page load. This satisfies both the consent gate and the DNT signal check with a single initialization path.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Data Protection Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- gdpr · Art. 25 — Data protection by design and by default — respecting user signals
- ccpa · §1798.120 — Consumer right to opt-out; Global Privacy Control (GPC) as a recognized opt-out signal
Taxons
History
- 2026-04-18·v1.0.0·Initial import from data-protection·automated