Skip to main content

Configuration Options

import ZixflowDataPipelines
import ZixflowLocation

let config = SDKConfigBuilder(apiKey: "YOUR_API_KEY")

    // Logging (default: .error)
    .logLevel(.debug)  // .none, .error, .info, .debug

    // Region (default: .US) — hosts resolve from region unless overridden
    .region(.US)

    // Auto-tracking (defaults: true)
    .autoTrackDeviceAttributes(true)
    .trackApplicationLifecycleEvents(true)

    // Screen tracking (default: auto UIKit tracking off)
    .autoTrackUIKitScreenViews()

    // Where screen events are sent (default: .all)
    // .all = analytics + in-app page rules
    // .inApp = keep screens on-device for in-app page rules only
    .screenViewUse(screenView: .inApp)

    // Custom endpoints (advanced)
    .apiHost("api-events.zixflow.com/v1")
    .cdnHost("custom-cdn.example.com")

    // Event batching (defaults: flushAt 20, flushInterval 30 seconds)
    .flushAt(20)
    .flushInterval(30)

    // Deep linking callback
    .deepLinkCallback { url in
        print("Deep link received: \(url)")
        // Handle deep link navigation
        return true  // Return true if handled; false may open in browser
    }

    // Location tracking
    .addModule(LocationModule(
        config: LocationConfig(mode: .onAppStart)
    ))

    .build()

Zixflow.initialize(withConfig: config)

Log Levels

.logLevel(.none)   // No logs
.logLevel(.error)  // Errors only (default)
.logLevel(.info)   // Errors + informational messages
.logLevel(.debug)  // All messages (use in development)
Handle links from push notifications (the SDK reads ZIXFLOW.push.link from Zixflow payloads):
let config = SDKConfigBuilder(apiKey: "YOUR_API_KEY")
    .deepLinkCallback { url in
        if url.path == "/product" {
            // Navigate to product screen
            return true
        }
        return false  // Return false to open in browser
    }
    .build()

Defaults Summary

OptionDefault
logLevel.error
region.US
flushAt20
flushInterval30 seconds
trackApplicationLifecycleEventstrue
autoTrackDeviceAttributestrue
autoTrackUIKitScreenViewsfalse
screenViewUse.all