Installation
- Bundle
- CDN
Attribution Variables
Three variables are injected automatically:On the very first launch of a fresh install,
appsFlyerAttribution is null until AppsFlyer responds (typically within a few seconds, and on iOS after the App Tracking Transparency prompt is answered, which the SDK waits up to 60 seconds for). Once resolved, the data is persisted natively and is available immediately on every future cold start, even offline.appsFlyerReferrer
The fastest way to branch on acquisition source. A single lowercase string resolved in this order:deep_link_valuefrom the attributed link, if presentdeep_link_sub1, if present- A known ad network with an organic or paid suffix, one of:
| Value | Meaning |
|---|---|
tiktok_ad / tiktok_organic | TikTok or Pangle, paid or organic |
facebook_ad / facebook_organic | Meta, paid or organic |
google_ad / google_organic | Google Ads or AdMob, paid or organic |
utm_source, if present- The raw
media_source, if present "organic", the default when nothing else matched
appsFlyerAttribution
The full attribution object. All fields are optional strings unless noted.The attributed network, e.g.
"tiktok", "facebook", "google".Campaign name. Also mirrored to
c for affiliate-style reads.Full campaign hierarchy for granular reporting.
Additional network metadata when the partner provides it.
Mapped from
af_sub1. Use for affiliate and creator payout tracking.UTM parameters from the link. When absent, they fall back to
af_sub1 through af_sub5 respectively.Affiliate-style aliases:
pid falls back to media_source, c falls back to campaign.Deep link routing values from the OneLink.
deep_link_value plus deep_link_sub1 through deep_link_sub10 are the fields AppsFlyer guarantees on a deferred first-launch resolution. See Deep Linking.Normalized to a top-level field on both platforms.
page_id is the one custom OneLink param Despia lifts out of the raw payload for you. Any other custom key lives only under raw.true when AppsFlyer classified the install as organic (af_status)."install", "re-engagement", or "re-attribution".true only on the very first launch after install.Same value as
despia.appsFlyerUID.Campaign cost data when available (
cost_value falls back to af_cost_value, cost_currency to af_cost_currency).Timestamps of the attributed click and the install.
Every raw key and value AppsFlyer returned, as strings. Custom parameters you add to a OneLink (e.g.
creator_code, episode_id) appear here. page_id appears here too but is also normalized to a top-level field.Example object
Example object
appsFlyerUID
The AppsFlyer device identifier. Send it to your backend to run server-to-server events or to join AppsFlyer raw-data exports with your own database.Request Attribution On Demand
The injected variables are refreshed automatically, but you can also request them explicitly and await the result:Personalize Onboarding by Source
Branch on the referrer for a quick check, and drop into the full attribution object when you need campaign or deep link detail.Resources
NPM Package
despia-native