Skip to main content
Add a native SDK to your app. It sends app_install, session_start, and session_end without more code.

Before you start

You need a write key from Settings → API, and a development build you can install on a clean device or simulator.
Do not load the web snippet inside a WebView as a replacement for an SDK. The web tracker gets a separate visitor_id and cannot read install attribution.

Install

In Xcode, open File → Add Package Dependencies. Add https://github.com/datalyr/swift. Add the DatalyrSDK product to your app target.
Install expo-modules-core in bare React Native too. The SDK loads a native module at import time and throws without it.

Set up the rest

1

Initialize once, at launch

Put the call in your app entry point. A second initialize() creates a second SDK.
2

Send a screen event on navigation

Call screen(). It sends an event named pageview, not screen.
3

Identify after sign-in

Pass the same user ID your backend and billing provider use.
4

Pass every deep link to the SDK

On iOS, call handleDeepLink(url). React Native reads links on its own.
5

Pass identity to your subscription SDK

Call getRevenueCatAttributes() or getSuperwallAttributes() after both SDKs start.
Call identify() once per signed-in person. A call with a different user ID runs reset() first, which rotates the anonymous ID and erases attribution and the journey.

Subscription revenue

Mobile purchases reach Datalyr through RevenueCat or Superwall, not the SDK.
Connect RevenueCat or Superwall, never both. Each writes the same event names for one store transaction, so your reports add the same purchase twice.

Web-to-app campaigns

A campaign that lands on a website before the App Store needs web tracking on the landing page as well. Datalyr matches the two by email or by IP, and records $web_attribution_matched. See app campaigns.

Verify

  1. Delete the app, or reset the simulator.
  2. Launch a fresh install.
  3. Open Events in Datalyr.
  4. Confirm app_install and session_start arrive within 30 seconds.
  5. Open one screen. Confirm a pageview arrives.

When no event arrives

Next