Overview
Nook Browser includes opt-in tracking protection that combines content rule lists with conservative third-party storage restrictions. When enabled, tracking protection blocks known tracking domains and prevents third-party iframes from accessing cookies and storage.Tracking protection is disabled by default. Enable it in Settings to activate cross-site tracking protections.
How tracking protection works
Two-layer protection
Nook’s tracking protection uses a dual approach:- Content rule lists: Block known tracking domains and resources using WebKit’s
WKContentRuleListAPI - Third-party cookie script: Prevent cross-site iframes from accessing
document.cookieand Storage Access API
Content blocking
When tracking protection is enabled, Nook compiles and installs content blocking rules:- Third-party cookie blocking: Attempts to block all cookies loaded from third-party contexts
- Tracker domain blocking: Blocks requests to known tracking domains
- Fallback mode: If cookie blocking is unsupported, falls back to domain-only blocking
TrackingProtectionManager.swift:242-292
JavaScript-based cookie blocking
Nook injects a user script into third-party iframes:- Only activates in embedded iframes (not main frames)
- Checks if the iframe is cross-site using
document.referrer - Overrides
document.cookieto return empty string and ignore writes - Blocks the Storage Access API with a rejected promise
Blocked tracking domains
Nook maintains a built-in list of common tracking domains:Analytics and tracking
google-analytics.comanalytics.google.comgoogletagmanager.comgoogletagservices.comdoubleclick.nethotjar.comsegment.io/cdn.segment.commixpanel.comoptimizely.comclarity.ms
Social media trackers
facebook.netconnect.facebook.netgraph.facebook.com
Ad networks
adsystem.comadservice.google.com
Error tracking
sentry.ionewrelic.com
TrackingProtectionManager.swift:246-265
The tracker list is conservative and focused on common analytics and advertising domains. Nook prioritizes compatibility over aggressive blocking.
Exceptions and allowlisting
Per-domain allowlist
You can disable tracking protection for specific domains:- Tracking protection is disabled for that domain
- All existing tabs on that domain are updated and reloaded
- The domain remains allowed until you revoke it
Temporary disabling
You can temporarily disable tracking protection for a specific tab:Disable for duration
Call
disableTemporarily(for: tab, duration: seconds) to disable tracking protection for a specific time period.TrackingProtectionManager.swift:65-84
OAuth flow exemption
Tracking protection is automatically disabled for OAuth flow tabs:accounts.google.comlogin.microsoftonline.comgithub.com/login- And other OAuth providers
OAuthDetector.swift for OAuth detection logic
Enabling tracking protection
Rule compilation
Nook compiles content blocking rules from JSON and stores them in WebKit’s rule list store for reuse.
Apply to configuration
The compiled rule list is added to the shared
WKWebViewConfiguration used by all new tabs.TrackingProtectionManager.swift:109-122
Disabling tracking protection
When you disable tracking protection:- Content rule lists are removed from the shared configuration
- The third-party cookie script is removed from user scripts
- All existing webviews have tracking protection removed
- All tabs are reloaded from origin to apply changes
TrackingProtectionManager.swift:167-174, 191-200
Configuration details
Rule list compilation
Nook uses WebKit’sWKContentRuleListStore for efficient rule compilation:
- Rules are compiled once and cached on disk
- On subsequent launches, Nook looks up the cached compiled list
- If cookie blocking fails to compile (unsupported action), Nook falls back to domain-only blocking
- Rules are identified by
"NookTrackingBlocker"(or"NookTrackingBlocker.fallback"for fallback mode)
TrackingProtectionManager.swift:125-153
Shared vs. per-webview configuration
Tracking protection is applied at two levels:Shared configuration
The baseWKWebViewConfiguration used by all new tabs:
- Rule lists are added to
userContentController - User script is injected at document start
- New tabs automatically inherit these settings
TrackingProtectionManager.swift:155-165
Per-webview application
Existing webviews are updated individually:- Each tab’s webview configuration is checked
- Tracking protection is applied or removed based on tab state
- Webview is reloaded from origin to ensure rules take effect
TrackingProtectionManager.swift:177-189, 212-229
Refresh and updates
You can refresh tracking protection for a specific tab:- Tab state changes (e.g., becomes an OAuth flow)
- Domain is added to or removed from allowlist
- Temporary exemption expires
Limitations and compatibility
Known limitations
-
Cookie blocking action: The
block-cookiesaction may not be supported on all macOS versions. Nook falls back to domain blocking if compilation fails. - First-party trackers: Tracking protection only blocks third-party requests. First-party analytics (same domain as the site) are not blocked.
- Fingerprinting: Tracking protection doesn’t prevent browser fingerprinting techniques that don’t rely on cookies or scripts.
- Network-level tracking: Your ISP, employer, or network administrator can still monitor your browsing regardless of tracking protection.
Compatibility considerations
- Social media embeds: Facebook, Twitter, and other social widgets may not load with tracking protection enabled
- Embedded videos: YouTube and Vimeo embeds may require third-party cookies
- Payment processors: Checkout flows using embedded payment forms may need exemptions
- Single sign-on: Some SSO implementations may break; OAuth flows are auto-exempted
Technical implementation
Manager lifecycle
TheTrackingProtectionManager is attached to BrowserManager:
TrackingProtectionManager.swift:105-107
Rule JSON structure
Content blocking rules use WebKit’s JSON format:- trigger: Specifies when the rule applies (URL pattern, load type)
- action: What to do when triggered (block, block-cookies, etc.)
TrackingProtectionManager.swift:242-292
State tracking
The manager tracks several types of state:isEnabled: Global on/off toggleinstalledRuleList: CompiledWKContentRuleListinstancetemporarilyDisabledTabs: Map of tab ID → expiration date for temporary exemptionsallowedDomains: Set of domains permanently exempted from tracking protection
TrackingProtectionManager.swift:14-55
Best practices
Test before enabling globally: Try tracking protection on a few sites first to ensure compatibility with your frequently visited websites.
Use temporary disabling for troubleshooting: If a site breaks, disable tracking protection temporarily to confirm it’s the cause before adding a permanent exemption.
Combine with incognito mode: For maximum privacy, use tracking protection in incognito windows where all data is ephemeral.
Tracking protection is most effective when combined with other privacy measures like HTTPS-only mode, regular cookie cleanup, and separate profiles for different browsing contexts.