Skip to content

Support react-native-appsflyer 7.x (plugin calls APIs removed in 7.0.0) #1328

Description

@andr3wV

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

  1. Call registerDeepLinkListener before init(). Android drops a deep-link result that arrives
    before a listener attaches, permanently.
  2. Register every other listener synchronously after init(), not inside init().then(...).
  3. Call start() only inside the registerSessionReadyListener callback. Native never auto-starts.

Two behavior changes to handle

  • onAppOpenAttribution and onDeepLink both emit Deep Link Opened today. They merge into one
    registerDeepLinkListener in 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 before init().

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions