iOS SDK

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:

  1. Converts platform-specific types into JSON-serializable values.
  2. Enforces a maximum nesting depth for nested objects.
  3. Truncates large strings and binary data.
  4. Applies your custom sanitizer (if configured).

Built-in sanitizers

The SDK includes three built-in sanitizers you can assign to NuxieConfiguration.propertiesSanitizer:

SanitizerBehavior
DefaultPropertiesSanitizers.privacyRemoves common PII keys (email, phone, name, address) and masks email-shaped values.
DefaultPropertiesSanitizers.complianceEverything in privacy, plus removes empty strings and null values.
DefaultPropertiesSanitizers.debugLogs every sanitization operation to the console for development inspection.
swift
let config = NuxieConfiguration(apiKey: "your_api_key")
config.propertiesSanitizer = DefaultPropertiesSanitizers.privacy

Custom sanitizer

Implement NuxiePropertiesSanitizer for full control over property transformation:

swift
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:

swift
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 beforeSend hook applies to events tracked through the standard trigger() 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:

swift
config.logLevel = .debug // Show all log output
LevelDescription
.verboseAll internal details. Very noisy.
.debugDetailed debugging information.
.infoNormal operational events (setup complete, profile fetched).
.warningUnexpected but handled situations (default).
.errorFailures that need attention.
.noneDisable all logging.

Console logging

Console logging is enabled by default. Disable it for production builds if you prefer silent operation:

swift
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.

swift
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:

DataLocationProtection
Identity (distinct ID, anonymous ID, user properties)Application Support.completeUntilFirstUserAuthentication
EventsApplication SupportStandard SQLite
Profile cacheCaches.completeUntilFirstUserAuthentication
Segment membershipsCaches.completeUntilFirstUserAuthentication
Campaign journeysApplication SupportStandard file protection
Flow WebArchivesCachesStandard file protection
Flow fontsCachesStandard 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