Skip to content

iOS SDK

Behavioral analytics for your iOS app, in minutes.

A lightweight Swift SDK that captures every event, screen and session — then streams it into B2Metric IQ for funnels, retention and churn prediction.

From zero to first event in three steps

Install with Swift Package Manager, initialize on launch, and log your first event.

  • Install

    Add via Swift Package Manager

  • Initialize

    Start the SDK as early as possible

  • Track

    Log a typed event in one line

Everything you need to understand mobile behavior

One install captures the full picture — automatic baselines plus precise, typed events you control.

  • Track Events

    Capture how users interact with your app.

    Log custom events with a single call. Attach typed properties — strings, numbers, booleans, dates — through AnyCodable for full context.

  • Automatic Event Tracking

    Sessions and lifecycle, instrumented for you.

    App opens, sessions and lifecycle moments are captured out of the box — no manual instrumentation required to get a baseline of behavior.

  • Screen Tracking

    See the path users take, screen by screen.

    Record screen views to reconstruct navigation flows and feed funnel, retention and user-flow reports inside B2Metric IQ.

  • Push Notification Tracking

    Measure delivery, opens and impact.

    Attribute notification deliveries and opens to downstream behavior so campaign performance is measurable end to end.

  • Event Batching & Flushing

    Battery- and network-friendly by design.

    Events are buffered and sent in batches on a configurable interval. Tune batchSize and flushInterval to balance freshness against efficiency.

  • Debug Mode

    Verify your integration in real time.

    Switch logLevel to .debug to stream every event and network call to the console, then flip to .off for production builds.

Tuned for development. Hardened for production.

Three parameters control everything. Send events instantly while debugging, then batch for battery and network efficiency in release builds.

  • apiKey · String · required — Your B2Metric API key. Must be non-empty.
  • batchSize · Int · default 20 — Number of events to batch before sending.
  • flushInterval · TimeInterval · default 30 — Time in seconds between automatic flushes.
  • Development: logLevel .debug, batchSize 5 — send immediately. Production: batch for battery and network efficiency.

Rich context, attached automatically

  • Call logEvent with a name and typed properties — the SDK enriches every payload before it leaves the device.
  • Each event carries a unique id and ISO timestamp.
  • Your properties pass through with full type fidelity via AnyCodable.
  • user_properties — device, OS, app version, locale — are added for you.

The full iOS SDK reference

From installation to troubleshooting — every page in the B2Metric Academy iOS guide.

  1. 01Introduction
  2. 02Installation
  3. 03Track Events
  4. 04Automatic Event Tracking
  5. 05Screen Tracking
  6. 06Push Notification Tracking
  7. 07Event Batching & Flushing
  8. 08Debug Mode
  9. 09Best Practices
  10. 10Troubleshooting
  11. 11API Reference
  12. 12Support & Release History

Ship your first insight today.

Add the package, paste your API key, and watch events arrive in B2Metric IQ in real time.