Privacy & Logging
Data handling, PII sanitization, and debug logging
Control event delivery before setup and configure logging for development and production.
The beforeSend hook
Set beforeSend on the configuration before calling setup. Return nil to drop an
event, return the original event unchanged, or construct a replacement:
// nuxie-doc-snippet: filter-sensitive-events
import Nuxie
let config = NuxieConfiguration(apiKey: "your_api_key")
config.beforeSend = { event in
guard event.properties["screen"] as? String != "debug_panel" else {
return nil
}
var properties = event.properties
properties.removeValue(forKey: "ssn")
return NuxieEvent(
id: event.id,
name: event.name,
distinctId: event.distinctId,
properties: properties,
timestamp: event.timestamp
)
}
try NuxieSDK.shared.setup(with: config)
When beforeSend returns nil, the event is not stored locally, not forwarded to experiences, 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:
// nuxie-doc-fragment: enable-debug-logging harness=config-body
config.logLevel = .debug // Show all log output
| Level | Description |
|---|---|
.verbose |
All internal details. Very noisy. |
.debug |
Detailed debugging information. |
.info |
Normal operational events (setup complete, profile fetched). |
.warning |
Unexpected but handled situations (default). |
.error |
Failures that need attention. |
.none |
Disable all logging. |
Console logging
Console logging is enabled by default. Disable it for production builds if you prefer silent operation:
// nuxie-doc-fragment: disable-console-logging harness=config-body
config.enableConsoleLogging = false
Sensitive 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.
// nuxie-doc-fragment: redact-sensitive-logging harness=config-body
config.redactSensitiveData = true // Default
On-device storage
The SDK stores data locally for caching and offline operation. All on-device storage uses iOS file protection:
| Data | Location | Protection |
|---|---|---|
| Identity (distinct ID, anonymous ID, user properties) | Application Support | .completeUntilFirstUserAuthentication |
| Events | Application Support | Standard SQLite |
| Profile cache | Caches | .completeUntilFirstUserAuthentication |
| Segment memberships | Caches | .completeUntilFirstUserAuthentication |
| Experience journeys | Application Support | Standard file protection |
| Signed Journey releases and verified assets | Caches | Standard 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, 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 current configuration options
- Tracking Events – learn how events flow through the sanitization pipeline
- Sessions & Lifecycle – understand what data persists across sessions