Introduction
The B2Metric iOS SDK lets you send events to B2Metric. It provides automatic session tracking, screen view analytics, push notification tracking, and offline support.
Quickstart
// Initialize in your AppDelegate
import B2MetricAnalyticsSDK
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
B2MetricAnalytics.shared.start(
apiKey: "YOUR_API_KEY",
batchSize: 20,
flushInterval: 30
)
return true
}
}
// Track events anywhere in your app
B2MetricAnalytics.shared.logEvent(
name: "button_clicked",
properties: ["screen": AnyCodable("home")]
)