Repository navigation
Support react-native-appsflyer 7.x (plugin calls APIs removed in 7.0.0) #1328
Description
Summary
We are trying to add AppsFlyer's Advanced-Matching Data Sharing by upgrading to the SDK v7. @segment/analytics-react-native-plugin-appsflyer does not support react-native-appsflyer 7.x.
Version 7.0.0 replaced the native bridge with a TurboModule RPC layer. It removed initSdk and the
three onX listener closures. The plugin calls all four. Its peer dependency also pins ^6.9.4,
which excludes 7.x.
The latest published plugin (0.9.0, 2026-03-03) still calls the removed API:
src/AppsflyerPlugin.tsx |
Call |
|---|---|
:94 |
appsFlyer.initSdk(...) |
:122 |
appsFlyer.onInstallConversionData(...) |
:174 |
appsFlyer.onAppOpenAttribution(...) |
:197 |
appsFlyer.onDeepLink(...) |
This blocks the upgrade completely. The plugin is the only caller of initSdk in a Segment-managed
setup, and it reads appsFlyerDevKey from the Segment destination settings. An app that upgrades to
7.x therefore never initializes AppsFlyer at all.
Proposed Solution
Migrate the nine call sites and bump the peer dependency to support both major versions, or ship a
new major that targets 7.x.
Call site replacements
| File | 6.x | 7.0.x |
|---|---|---|
AppsflyerPlugin.tsx:94 |
initSdk({devKey, appId, ...}) |
init({devKey, appId}), then start() inside registerSessionReadyListener |
AppsflyerPlugin.tsx:122 |
onInstallConversionData(cb) |
registerConversionListener({onConversionDataSuccess, onConversionDataFail}) |
AppsflyerPlugin.tsx:174 |
onAppOpenAttribution(cb) |
folds into registerDeepLinkListener |
AppsflyerPlugin.tsx:197 |
onDeepLink(cb) |
registerDeepLinkListener({onDeepLinking}) |
methods/track.ts:25,31 |
logEvent(name, values) |
logEvent({eventName, eventValues}) |
methods/identify.ts:10 |
setCustomerUserId(uid) |
setCustomerUserId({customerId}) |
methods/identify.ts:36 |
setCurrencyCode(code) |
setCurrencyCode({currencyCode}) |
methods/identify.ts:40 |
setAdditionalData(data) |
setAdditionalData({customData}) |
Three ordering rules 7.x requires
- Call
registerDeepLinkListenerbeforeinit(). Android drops a deep-link result that arrives
before a listener attaches, permanently. - Register every other listener synchronously after
init(), not insideinit().then(...). - Call
start()only inside theregisterSessionReadyListenercallback. Native never auto-starts.
Two behavior changes to handle
onAppOpenAttributionandonDeepLinkboth emitDeep Link Openedtoday. They merge into one
registerDeepLinkListenerin 7.x, so a direct port double-fires that event. Emit it once.timeToWaitForATTUserAuthorization(AppsflyerPlugin.tsx:56, default 60) has no replacement.
Dropping it silently shortens the iOS ATT window and degrades attribution. Please document the
change, and consider exposing a hook so apps can request ATT beforeinit().
The deep-link payload shape also changed. 7.x normalizes it to {status, error?, deepLink?}, so
callbacks reading data.data need to read data.deepLink.
Activity
andr3wV commentedon Oct 8, 2026
I opened #1336 to fix this.