Skip to main content
Identity commands connect AppsFlyer’s device-level attribution to your own user model. Everything here is forwarded to the native SDK. Email and phone are SHA256-hashed on the device before transmission, so raw PII never leaves the app.

Installation


set_user_id

Call as soon as the user signs up or logs in. All subsequent events carry your internal user ID across AppsFlyer, Meta, and TikTok reporting, and raw-data exports become joinable with your own database.
string
required
Your internal, stable user identifier. Avoid emails or anything that changes.

set_email

Passes the user’s email for audience matching. The value is normalized and SHA256-hashed natively before it is sent.
Lowercase and trim the email in your web layer before sending. Hashes only match across systems when the input is normalized identically everywhere.

set_phone

Passes the user’s phone number, SHA256-hashed natively and attached to the user’s event data as phone_hash.
Send phone numbers in E.164 format (+<country code><number>, no spaces or dashes) so hashes are consistent.

get_uid

Reads the AppsFlyer device ID. It is already injected on every page load as despia.appsFlyerUID. Use the await pattern when you need a guaranteed-fresh value inline:

1

Consent first

Forward the user’s cookie-banner choice with set_consent before identifying or logging anything.
2

Identify at signup or login

set_user_id, then set_email and set_phone if you have them.
3

Log events

Everything from here on is tied to the user. See Events.

Resources

NPM Package

despia-native