Skip to content
Nuxie
Esc
navigateopen⌘Jpreview
On this page

Privacy & Logging

Data handling, PII sanitization, and debug 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:

Sanitizer Behavior
DefaultPropertiesSanitizers.privacy Removes common PII keys (email, phone, name, address) and masks email-shaped values.
DefaultPropertiesSanitizers.compliance Everything in privacy, plus removes empty strings and null values.
DefaultPropertiesSanitizers.debug Logs every sanitization operation to the console for development inspection.
let config = NuxieConfiguration(apiKey: "your_api_key")
config.propertiesSanitizer = DefaultPropertiesSanitizers.privacy

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

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:

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.

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
Campaign journeys Application Support Standard file protection
Flow WebArchives Caches Standard file protection
Flow fonts 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, 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

Last updated on July 23, 2026

Was this page helpful?