Skip to main content

Overview

This guide walks you through adding the B2Metric iOS SDK to your app, from the first pod install to the last line of a shutdown call. It's written for the engineer who's about to do the integration, not for a general audience, so it stays close to code and skips the marketing talk.

You don't need to read it top to bottom. If you're starting fresh, the Quick Start section is the fastest way to see an event land in your dashboard. If you're upgrading from an older version of the SDK, jump straight to the section on breaking changes before you touch your call sites. Everything else is here for when you need it: configuration options, push notification setup, and the small print on how offline queuing and retries behave.

If something in here doesn't match what you're seeing in your app, the Troubleshooting section near the end is a good place to start, and the API reference gives you the exact method signatures when you just need to double check a parameter name.

The B2Metric iOS SDK is the official client library for sending analytics data from iOS applications to the B2Metric platform. It provides automatic session tracking, user identification, screen-view analytics, push notification tracking, and offline support, and it is distributed as a precompiled binary (XCFramework) via Swift Package Manager.

Setup and releases: github.com/B2M-Team/b2metric-ios-sdk

Features​

  • Custom event tracking with properties and item-level data
  • User identification with custom attributes (setUser)
  • Automatic session management (first_open, session_start, session_end)
  • Automatic screen-view tracking for UIKit, plus a SwiftUI view modifier
  • Push notification token registration (APNs) and open tracking
  • Offline event queuing with persistent, bounded storage (maxQueueSize)
  • Automatic batching, retry with exponential backoff, and network-aware delivery
  • Automatic device and app metadata collection
  • Configurable log levels for debugging

Requirements​

  • iOS 13.0+
  • Swift 5.5+ / Xcode 13+