Privacy & Logging
Data handling, PII sanitization, and debug logging
Privacy & Logging
Control what data the SDK collects, sanitize PII before it leaves the device, and configure logging for development and production.
Properties sanitizer
The SDK applies a sanitization pipeline to every event's properties before they are stored or sent. This pipeline:
- Converts platform-specific types into JSON-serializable values.
- Enforces a maximum nesting depth for nested objects.
- Truncates large strings and binary data.
- Applies your custom sanitizer (if configured).
Built-in sanitizers
The SDK includes three built-in sanitizers you can assign to NuxieConfiguration.propertiesSanitizer:
let config = NuxieConfiguration(apiKey: "your_api_key")
config.propertiesSanitizer = DefaultPropertiesSanitizers.privacyCustom sanitizer
Implement NuxiePropertiesSanitizer for full control over property transformation:
class MyCustomSanitizer: NuxiePropertiesSanitizer {
func sanitize(_ properties: [String: Any]) -> [String: Any] {
var sanitized = properties
// Remove internal debug keys
sanitized.removeValue(forKey: "internal_debug_id")
// Mask credit card numbers
if let card = sanitized["card_number"] as? String {
sanitized["card_number"] = String(repeating: "*", count: card.count - 4)
+ card.suffix(4)
}
return sanitized
}
}
config.propertiesSanitizer = MyCustomSanitizer()The beforeSend hook
Use the beforeSend hook to inspect, modify, or drop events before they are stored and delivered:
config.beforeSend = { event in
// Drop events from a specific screen
if event.properties?["screen"] as? String == "debug_panel" {
return nil // Event is dropped entirely
}
// Redact a specific field
var modified = event
modified.properties?["ssn"] = nil
return modified
}When beforeSend returns nil, the event is not stored locally, not forwarded to campaigns, and not sent to the server.
Warning: The
beforeSendhook applies to events tracked through the standardtrigger()path. Events sent directly for trigger evaluation (e.g., events that check for gate plans) bypass this hook.
Logging
Log levels
Configure the log level during setup to control verbosity:
config.logLevel = .debug // Show all log outputConsole logging
Console logging is enabled by default. Disable it for production builds if you prefer silent operation:
config.enableConsoleLogging = falseSensitive data masking
When redactSensitiveData is true (the default), the SDK masks API keys and distinct IDs in log output:
- API keys appear as
abcd...wxyz - Distinct IDs appear as
abc...xyz
This prevents sensitive identifiers from appearing in console logs, crash reporters, or log aggregation services.
config.redactSensitiveData = true // DefaultOn-device storage
The SDK stores data locally for caching and offline operation. All on-device storage uses iOS file protection:
Data in the Caches directory may be purged by the system under storage pressure. Data in Application Support persists across app sessions.
What is sent to the server
The SDK sends these data types to Nuxie's servers:
- Events -- event name, properties, distinct ID, session ID, timestamp, and device context.
- Profile requests -- distinct ID and locale.
- Purchase sync -- StoreKit transaction JWT and distinct ID.
- Feature checks -- distinct ID, feature ID, and optional required balance.
The SDK does not send raw device identifiers (IDFA, IDFV) unless you include them explicitly in event properties.
Next steps
- Configuration -- see all configuration options including sanitizers and hooks
- Tracking Events -- learn how events flow through the sanitization pipeline
- Sessions & Lifecycle -- understand what data persists across sessions