Skip to main content

Configuration

ParameterTypeDefaultRangeDescription
apiKeyStringrequirednon-emptyYour B2Metric API key
appIdentifierStringrequiredsnake_caseIdentifies your app in B2Metric
baseUrlStringhttps://tracker.b2metric.com—Override only for a test or staging endpoint
batchSizeInt201–100Events per batch and per delivery request
flushIntervalTimeInterval301–3600Seconds between periodic flushes
maxRetriesInt31–10Failed passes before a retry warning is logged
sessionTimeoutMinutesInt301–10080Inactivity window before a new session starts
maxQueueSizeInt1000100–10000Undelivered 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
)