Installation
- Bundle
- CDN
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.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 asphone_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 asdespia.appsFlyerUID. Use the await pattern when you need a guaranteed-fresh value inline:
Recommended order
Consent first
Forward the user’s cookie-banner choice with set_consent before identifying or logging anything.
Log events
Everything from here on is tied to the user. See Events.
Resources
NPM Package
despia-native