AppsFlyer
Updated
Mobile attribution and campaign measurement.
- JavaScript:
window.AppSorcerer.appsflyer - Plan: Business (premium) — included on plans with premium plugins, and you can try it free for 14 days
- Platforms: Android apps today. iOS support arrives with iOS builds (coming soon).
Turn the plugin on in App Studio → Plugins, fill in its settings, then rebuild your app. Websites call it through the JavaScript bridge.
Settings
| Studio label | Type | Default | Notes |
|---|---|---|---|
| Dev key | text | – | required |
| Apple app ID (iOS) | text | – |
Setup
Enter your AppsFlyer Dev key (the Apple app ID setting is for iOS). Deep linking, including deferred deep links, is handled automatically. OneLink domains for direct deep links aren't set up by this plugin.
JavaScript API
Every method returns a Promise. Call it as await AppSorcerer.appsflyer.<method>(args).
| Method | Arguments | Resolves with |
|---|---|---|
logEvent | { name, values?: {} } | null once AppsFlyer accepted the event (e.g. af_purchase with af_revenue, af_currency) |
setCustomerUserId | { userId } | null |
getAppsFlyerUID | – | { uid } |
getConversionData | – | install attribution data, or null |
getDeepLink | – | last deep link data, or null |
anonymizeUser | { enabled } | null |
stop | { stopped } | null (opt-out) |
setUserEmails | { emails: [] } | null |
Events
Listen with AppSorcerer.on('<event>', callback) (or the DOM event appsorcerer:<event>).
| Event | Data |
|---|---|
appsflyer.conversion | install attribution map (af_status, media_source, campaign, …) |
appsflyer.deepLink | deep link clickEvent + { deepLinkValue, isDeferred }. A deep_link_value that is a path (/products/x) or an https URL is opened first |
appsflyer.appOpenAttribution | attribution of a re-engagement open |
Events that happen before the page is ready are queued and delivered after the next page load.
Errors
Rejections carry error.code: not_configured, log_failed, invalid_args, unknown_method.
Example
await AppSorcerer.appsflyer.setCustomerUserId({ userId: customer.id });
await AppSorcerer.appsflyer.logEvent({ name: 'af_purchase', values: { af_revenue: 59.8, af_currency: 'EUR', af_order_id: '1042' } });Notes
- Google Play install referrer attribution is included.
