Configuration
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
apiKey | String | required | non-empty | Your B2Metric API key |
appIdentifier | String | required | snake_case | Identifies your app in B2Metric |
baseUrl | String | https://tracker.b2metric.com | — | Override only for a test or staging endpoint |
batchSize | Int | 20 | 1–100 | Events per batch and per delivery request |
flushInterval | TimeInterval | 30 | 1–3600 | Seconds between periodic flushes |
maxRetries | Int | 3 | 1–10 | Failed passes before a retry warning is logged |
sessionTimeoutMinutes | Int | 30 | 1–10080 | Inactivity window before a new session starts |
maxQueueSize | Int | 1000 | 100–10000 | Undelivered events kept on device |
Out-of-range numeric values are clamped to the nearest valid value rather than throwing, so a misconfiguration degrades instead of crashing your app.
Important
An empty apiKey or a malformed appIdentifier is different: the SDK logs an error and stays disabled, and every later call is a silent no-op. Set logLevel to at least .error while integrating so failure is visible.
B2MAnalytics.shared.start(
apiKey: "YOUR_API_KEY",
appIdentifier: "my_app",
batchSize: 20,
flushInterval: 30,
sessionTimeoutMinutes: 30,
maxQueueSize: 1000
)