Implementation Guide

Mobile SDKs

Native SDKs for iOS, Android, and React Native that bring MetaRouter's tracking capabilities to your mobile applications.

Overview

MetaRouter's mobile SDKs provide the same powerful tracking capabilities as Analytics.js, optimized for native mobile applications. Use familiar methods like track(), identify(), and screen() (the mobile equivalent of page()) to capture user interactions.

Already collecting mobile events with an existing SDK? Consider using the Streaming API to forward that data to MetaRouter.

Available SDKs

MetaRouter provides native SDKs for the most popular mobile platforms. Each SDK requires a writeKey (pipeline identifier) and ingestionHost (your MetaRouter endpoint).

Identity on Mobile

Mobile identity management differs from web tracking in several important ways.

Anonymous ID

The anonymousId is automatically generated by the SDK and persisted locally on the device. This identifier is used to track user behavior before they authenticate, similar to web tracking.

No Sync Injector or A.js Required

Unlike web implementations, mobile SDKs operate independently and do not require the A.js file, sync injector, or File Builder configuration. The SDK communicates directly with your MetaRouter cluster after initialization with your write key and ingestion host.

Advertising Identifiers

Mobile identity resolution relies on platform-specific advertising identifiers rather than cookie-based syncs:

  • iOS: IDFA (Identifier for Advertisers) — requires App Tracking Transparency (ATT) authorization on iOS 14.5+
  • Android: AAID (Android Advertising ID) — users can reset or opt out via device settings

Device-Level Consent

Consent is managed at the device level through native OS controls rather than a consent management platform. On iOS, users must explicitly grant permission via the ATT prompt before IDFA can be collected. On Android, users can opt out of personalized advertising through their device settings. Your app should respect these preferences using the SDK's setAdvertisingId() and clearAdvertisingId() methods.

Shared Features

All MetaRouter mobile SDKs share a common feature set designed to make mobile data collection reliable and comprehensive.

Offline Support

Events are queued locally when offline and automatically sent when connectivity is restored. Batch processing optimizes network usage.

Non-Blocking Architecture

All SDK operations run asynchronously to avoid impacting app performance or blocking the UI thread.

Device Context

Automatically enriches events with device info, OS version, app version, screen dimensions, and more.

Privacy Controls

Built-in support for IDFA/AAID collection with methods to set and clear advertising identifiers based on user consent.

Privacy Note: Obtain user consent before collecting advertising identifiers (IDFA/AAID). Ensure compliance with GDPR, CCPA, and App Store policies before enabling ad tracking.