Skip to content

iOS SDK - 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)
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)
EnvironmentBase URL
.productionhttps://api.funnelmob.com/v1
.sandboxhttps://sandbox.funnelmob.com/v1
import SwiftUI
import FunnelMob
@main
struct 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()
}
}
}
// Disable tracking (e.g., for GDPR compliance)
FunnelMob.shared.setEnabled(false)
// Re-enable tracking
FunnelMob.shared.setEnabled(true)
// Force send queued events immediately
FunnelMob.shared.flush()

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