iOS SDK - Configuration
Basic Configuration
Section titled “Basic Configuration”let config = FunnelMobConfiguration( appId: "com.example.myapp", // Required: Your app identifier apiKey: "fm_live_abc123" // Required: Your API key)FunnelMob.shared.initialize(with: config)Full Configuration with Builder
Section titled “Full Configuration with Builder”let config = FunnelMobConfiguration(appId: "com.example.myapp", apiKey: "fm_live_abc123") .with(environment: .production) // .production (default) or .sandbox .with(logLevel: .none) // .none, .error, .warning, .info, .debug, .verbose .with(flushInterval: 30.0) // Auto-flush interval in seconds (min: 1.0, default: 30.0) .with(maxBatchSize: 100) // Events per batch (1-100, default: 100)Environments
Section titled “Environments”| Environment | Base URL |
|---|---|
.production | https://api.funnelmob.com/v1 |
.sandbox | https://sandbox.funnelmob.com/v1 |
SwiftUI App
Section titled “SwiftUI App”import SwiftUIimport FunnelMob
@mainstruct MyApp: App { init() { let config = FunnelMobConfiguration( appId: "com.example.myapp", apiKey: "fm_live_abc123" ) FunnelMob.shared.initialize(with: config) }
var body: some Scene { WindowGroup { ContentView() } }}SDK Control
Section titled “SDK Control”// Disable tracking (e.g., for GDPR compliance)FunnelMob.shared.setEnabled(false)
// Re-enable trackingFunnelMob.shared.setEnabled(true)
// Force send queued events immediatelyFunnelMob.shared.flush()Error Handling
Section titled “Error Handling”Errors are logged rather than thrown. Set logLevel to see validation errors:
let config = FunnelMobConfiguration(appId: "...", apiKey: "...") .with(logLevel: .debug) // See validation errors in console
FunnelMob.shared.initialize(with: config)Error messages appear in the console with the prefix [FunnelMob].