-
Notifications
You must be signed in to change notification settings - Fork 0
Tracking Preferences & Privacy Signals
SunDevil311 edited this page Jun 15, 2025
·
3 revisions
This document explains how Network Pro™ handles analytics tracking in a privacy-aware, user-consented, and standards-compliant manner. It covers:
- Tracking preference storage (cookies)
- Browser signals (DNT and GPC)
- Reconsent logic
- Reactive store architecture
- Privacy by default: Tracking is disabled when browser signals indicate user preference (DNT/GPC).
- Explicit consent: Users may opt-in or opt-out manually, overriding signals.
- Persistent choice: Consent state is remembered via first-party cookies.
- Transparency: The tracking status is shown to users in the UI.
-
Store:
src/lib/stores/trackingPreferences.js- Consolidates logic for cookie preferences, browser signals, and consent state.
- SSR-safe, reactive, and fully declarative.
-
Deprecated:
-
utils/privacy.js→ replaced by derived store logic. -
utils/trackingCookies.js→ merged into the store with SSR-safe cookie APIs.
-
| Store | Type | Description |
|---|---|---|
trackingPreferences |
Readable<TrackingState> |
Contains current tracking metadata (opt-in/out, DNT, GPC, status, etc). |
trackingEnabled |
Writable<boolean> |
Exposed to toggle or query PostHog tracking state reactively. |
remindUserToReconsent |
Readable<boolean> |
Indicates whether a consent renewal prompt should be shown. |
showReminder |
Writable<boolean> |
Used by PostHog to conditionally display a reminder or banner. |
The derived store remindUserToReconsent evaluates whether a user should be
reminded to re-consent to tracking.
It checks for:
- Manual opt-in or opt-out
- A valid
tracking_consent_timestampcookie - Whether 6+ months have elapsed since that timestamp
- Changes to tracking preferences update cookies and reactive state
- Reconsent timestamp is written/cleared via store utility functions
- Use
$trackingPreferencesandremindUserToReconsentwherever reactive values are needed
| File | Purpose |
|---|---|
+layout.svelte |
Initializes PostHog client and service worker; references trackingPreferences. |
PrivacyDashboard.svelte |
UI control panel for opt-in/out toggles and consent status display. |
PrivacyContent.svelte |
Informational content rendered in modals, footers, and standalone pages. |
stores/trackingPreferences.js |
Primary source of truth; tracks and derives tracking state. |
stores/posthog.js |
Encapsulates privacy-safe analytics setup and event capture logic. |
📎 Related Repositories
💡 This page is part of the internal wiki for Network Pro™. To contribute or suggest changes, see Contributing to the Wiki.
Copyright © 2025
Network Pro Strategies
Network Pro™, the shield logo, and the "Locking Down Networks...™" slogan are trademarks of Network Pro Strategies.
Licensed under CC BY 4.0 and the GNU GPL, as published by the Free Software Foundation, either version 3 of the license or (at your option) any later version.