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

Open
#1,328 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
68/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
react-native, typescript
Domain
mobile

Research direction

Start with src/AppsflyerPlugin.tsx and the call sites in methods/track.ts and methods/identify.ts, then inspect the peer-dependency declaration. Migrate the listed 7.x APIs while preserving listener ordering and emitting Deep Link Opened once; update version support and document the removed ATT timing option.

Written by the indexing model from the issue text.

Description

enhancement

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.

Dominant language
TypeScript
Stars
383
Forks
206
Avg merge
14h 45m
Merged PRs (30d)
11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from segmentio/analytics-react-native

All issues in segmentio/analytics-react-native

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.