@datalyr/react-native 1.7.15, which posts events to
https://ingest.datalyr.com/track. For a first install, start with
Install in a mobile app.
Requirements
Install
expo-modules-core even in a bare React Native app. The SDK calls
requireNativeModule at module load, so a missing package throws before initialize()
runs.Install
@react-native-async-storage/async-storage,
react-native-get-random-values, and uuid.
For Play Install Referrer on Android, add this line to android/app/build.gradle.
Initialize
import Datalyr from '@datalyr/react-native' returns the class, not the singleton.
Use the named import { Datalyr } for the static facade, or { datalyr } for the
instance. The default import needs new and creates a second SDK.initialize() resolves.
What the SDK tracks without your code
There is no
app_open, app_foreground, or app_background event. Moving to the
background flushes the queue and records activity time. It sends no event.
Events the SDK sends for you
screen() sends an event named pageview, not screen. Event names accept letters,
digits, _, ., $, and -, up to 100 characters. Any other run of characters becomes a
single _, with a console warning.
Track an event
Screens
Automatic tracking adds
source: 'auto_navigation' or source: 'auto_expo_router' to the
pageview properties.
Identity
Callidentify() once per signed-in person. A call with a different userId runs
reset() first, which rotates the anonymous ID and the visitor ID, and erases attribution
and the journey.
$identify event.
Identity on the wire
This SDK sends no
distinct_id and no top-level visitor_id.
reset() rotates both the anonymous ID and the visitor ID, ends the session, and clears
attribution, the journey, and SKAdNetwork state.
Revenue
Attribution
The SDK subscribes toLinking and reads the initial URL. It reads these 44 parameters
from both the query string and the URL fragment. Keys are lowercased before matching.
Each
utm_* value is mirrored to campaign_source, campaign_medium, campaign_name,
campaign_term, and campaign_content.
Install attribution
Play Install Referrer values merge onto an event only when the event carries neither
gclid nor utm_source.
SKAdNetwork
(rank & 0x7) << 3 | revenueTier, clamped to 0–63. Revenue tiers run
under 1, 5, 10, 25, 50, 100, and 250, then 7 above 250. Coarse value is low under 10,
medium under 50, and high above. skadTemplate accepts ecommerce, gaming, or
subscription.
A cross-launch high-water guard stops any decrease. reset() clears it.
App Tracking Transparency
The SDK never prompts. Call the prompt yourself, then report the result.$att_status and refreshes idfa, idfv, gaid, att_status, and
advertiser_tracking_enabled on later events.
RevenueCat and Superwall
Complete method list
Expo signature differences
The Expo entry point changes five signatures. Copying bare React Native code produces a type error or a missing default.Configuration
AutoEventConfig
sessionTimeoutMs sets when the session_start and session_end events fire. The session
ID on the wire rotates on a fixed 30 minutes.
Options with no effect
Remove these from your configuration, and use the option in the right-hand column.endpoint, debug, and deferred attribution
endpoint applies only while useServerTracking is false. To point at another host, set
both endpoint and useServerTracking: false. That also switches authentication to
Authorization: Bearer.
Logging follows __DEV__, not debug. A release build prints nothing with debug: true,
and a development build prints with debug: false.
For deferred attribution, call getPlayInstallReferrer() on Android and
getAppleSearchAdsAttribution() on iOS.
Limits
How failed requests behave
Storage
Keys live in AsyncStorage.
The Expo build adds
@datalyr/session_start, @datalyr/install_time,
@datalyr/last_app_version, and @datalyr/device_id.
Verify the install
- Run the app on a clean simulator or a fresh install.
- Open Events in Datalyr.
- Confirm
app_installandsession_startarrive within 30 seconds.
Datalyr.getStatus() and read initialized and queueStats. A
queue that grows without draining means the API key is wrong. See
No events.