On this page
- Before you start
- Choose your RC version
- Updating a React Native app
- Prepare attribution before initialization
- React Native
- Forward a raw URL in React Native
- App Clip and App Group handoff before JavaScript starts
- Native Android
- Native iOS
- Check React Native navigation and masking
- Configure campaign fields
- How attribution follows a visit
- Keep data scoped to your project
- Test the integration
Release candidate (RC)
Attach campaign context to mobile visits so you can retain the source, campaign and click information delivered to your app. The RC supports direct links and provider callback forwarding for deferred attribution.
Before you start
Keep your existing mobile project token, AppsFlyer configuration and consent flow. Configure attribution in the app using the steps below.
Choose your RC version
| Integration | Exact version | Requirements |
|---|---|---|
| Native Android | io.cux:analytics-compose-sdk:1.2.1-rc.3 | Android API 26 or later |
| Native iOS | 1.1.12-rc.3 | iOS 15 or later |
| React Native | @cuxio/react-native-sdk@1.0.23-rc.3 | Android API 26 or later; the iOS minimum required by your React Native version |
Before installing RC3, remove the CUX-specific patch-package patch for maskView/unmaskView so your app's postinstall step does not reapply the obsolete workaround. Keep unrelated patches.
Install the exact React Native RC, then update the iOS pods:
npm install --save-exact @cuxio/react-native-sdk@1.0.23-rc.3
cd ios
pod install
This wrapper uses Android 1.2.1-rc.3 and includes iOS 1.1.12-rc.3. Keep both native dependencies as supplied by the wrapper. The latest npm tag can continue to point to the stable release; install the explicit RC version above.
Updating a React Native app
RC3 supports the React Native 0.88.1 Android toolchain and remains compatible with React Native 0.78.3. The wrapper uses your app's Android Gradle Plugin and Kotlin versions. On AGP 9 it supports the new DSL and built-in Kotlin; it does not require the android.newDsl=false workaround.
Remove android.newDsl=false if it was added solely for CUX; check other dependencies before removing a project-wide workaround. Custom Android build setups must provide their compatible AGP/Kotlin plugin dependencies at the app level.
After installing the exact RC and running pod install, rebuild the Android and iOS apps completely. A JavaScript-only reload does not update the native SDKs. Keep the native versions supplied by the wrapper: Android 1.2.1-rc.3 and iOS 1.1.12-rc.3.
RC3 also improves native masking during remounts and navigation, and keeps explicit React screen names after modal dismissal. Keep the initial-route and navigation hooks below.
For native iOS with CocoaPods, select the versioned podspec:
pod 'CuxAnalyticsSDK', :podspec => 'https://bitbucket.org/cuxio/public-ios-sdk/raw/1.1.12-rc.3/CuxAnalyticsSDK.podspec'
For Swift Package Manager, use https://bitbucket.org/cuxio/public-ios-sdk and select the exact tag 1.1.12-rc.3.
Use your platform's Android, iOS or React Native guide for the base integration and select the RC version listed above. React Native includes compatible native collectors; keep its declared dependencies.
Your app must also meet the minimum OS version required by React Native and its other native dependencies. For React Native 0.78.3, use an iOS 15.1 or later deployment target. For the fmt compiler error on RN 0.78.3 with Xcode 27.1, follow React Native troubleshooting.
Prepare attribution before initialization
Prepare attribution with your mobile project token before the app's existing CUX initializer. Preparation keeps normalized campaign fields in memory for up to 15 minutes and does not start recording. Keep collection connected to your existing consent handling.
React Native
import { CUX } from '@cuxio/react-native-sdk';
const token = 'YOUR_MOBILE_PROJECT_TOKEN';
CUX.prepareAttribution({ token, enabled: true });
const stopDeepLink = appsFlyer.onDeepLink(payload => {
void CUX.processAttribution(payload, { provider: 'appsflyer' });
});
const stopConversion = appsFlyer.onInstallConversionData(payload => {
void CUX.processAttribution(payload, { provider: 'appsflyer' });
});
await CUX.initialize({ token, needConfirmToStart: true });
This example uses the React Native plugin's onDeepLink and onInstallConversionData JSON callback objects. Here appsFlyer is the instance already owned by your app. Attach callbacks before that instance's existing startup can deliver them. Keep the provider's own initialization and consent configuration in your app; CUX does not initialize AppsFlyer or add it as a dependency. Use the callback API supplied by your installed AppsFlyer version.
Forward the complete callback object. CUX reads its status, direct/deferred flags and campaign fields. Do not extract only payload.data or rewrite installation flags. Remove these subscriptions through their returned cleanup functions when the integration owner is removed. Keep one callback owner per application startup.
Your existing consent flow calls CUX.resumeCollectingData() when collection is allowed and CUX.stopCollectingData() when it is withdrawn. Stop clears pending attribution. A later grant captures future links; do not replay callback bodies cached by your app.
Forward a raw URL in React Native
CUX captures the initial URL and later URL events delivered through React Native Linking after preparation. If your OneLink already reaches Linking, a missing AppsFlyer callback does not require another CUX forwarding call. Keep the existing link routing; do not add a second timer for each automatic URL event.
For a URL received through your own App Group handoff or another path outside Linking, forward the original URL after preparation:
CUX.prepareAttribution({ token, enabled: true });
const result = await CUX.processAttribution(rawUrl, { provider: 'url' });
Pass the original string, including its query parameters. Do not turn it into a custom event, screen parameter or an AppsFlyer-shaped object. You can retain your existing five-second fallback if it serves your application routing. A manual replay of identical campaign evidence within the bounded 15-minute history confirms the earlier observation instead of creating another opening.
App Clip and App Group handoff before JavaScript starts
The full app can forward the URL from its existing App Group handoff before React Native starts. Prepare the native collector first with the same mobile token used later by JavaScript:
CuxAnalytics.shared.prepareAttribution(token: "YOUR_MOBILE_PROJECT_TOKEN", enabled: true)
CuxAnalytics.shared.processAttribution(
url: appClipInvocationURL.absoluteString,
detectedFrom: "url"
)
Insert this into the full app's existing handoff, with appClipInvocationURL being the URL you recovered. Preserve AppDelegate or SceneDelegate routing and return values. Native preparation must happen before forwarding the URL. The first JavaScript preparation with the same token preserves this native buffer. Alternatively, keep the URL in your existing handoff and forward it from JavaScript after CUX.prepareAttribution.
The App Clip itself does not need CUX for this handoff. CUX does not read your App Group or initialize AppsFlyer. Calling performOnAppAttribution alone does not forward data to CUX; use the raw URL path when no useful callback follows.
Native Android
CuxAnalytics.prepareAttribution(this, "YOUR_MOBILE_PROJECT_TOKEN", true)
Call this in your existing Application startup before CuxAnalytics.init. Keep the same token and consent configuration. Forward warm Activity intents through CuxAnalytics.onNewIntent(intent). Keep your existing link routing and lifecycle. In React Native, if cold and warm links already reach Linking, use the CUX automatic hooks instead of adding a second native forwarding path. Preserve your existing super.onNewIntent(intent) handling in MainActivity.
Native iOS
CuxAnalytics.shared.prepareAttribution(token: "YOUR_MOBILE_PROJECT_TOKEN", enabled: true)
Call this before your existing setup(). Forward received URL contexts and user-activity URLs through processAttribution(url:detectedFrom:). Keep your AppDelegate or SceneDelegate routing and return values. For an App Clip, pass the URL recovered by your host's existing App Group handoff.
Check React Native navigation and masking
Keep your existing navigation integration and CUXMask wrappers. Name the initial screen and forward later route changes using the React Navigation setup.
On iOS, this RC preserves names supplied through CUX.screen() during native-stack navigation. Screenshot capture waits for animated native view-controller transitions to finish, then continues with the configured sampling interval. Short intermediate states may not produce a separate image.
Use synthetic data to check the initial screen, nested navigation, Back, component recreation and scrolling on both platforms. Inspect the available images throughout the recorded visit using the masking checklist.
Configure campaign fields
Preserve campaign parameters through the link that opens the app:
| Incoming parameter | Retained field |
|---|---|
utm_source | Source, for example tiktok |
utm_medium | Medium, for example paid_social |
utm_id | Campaign ID |
utm_campaign | Campaign name |
utm_term | Ad group ID, when configured for that purpose |
utm_content | Creative ID, when configured for that purpose |
ttclid | TikTok click ID |
Keep IDs as strings. For deferred OneLink delivery, set deep_link_sub1 to the same click ID as ttclid. CUX uses that alias when a valid ttclid is absent. New-user deferred callbacks can contain fewer fields than a direct link, so forward both supported provider callbacks and retain the fields they actually deliver.
How attribution follows a visit
The first valid direct campaign identifies acquisition for the visit. A later external link is recorded as a separate opening for the active visit. Confirmation of the same click can add missing campaign fields without creating another opening or replacing existing values.
The same explicit ttclid identifies confirmation of the same click within the same direct or installation category. A late AppsFlyer callback or manually forwarded URL can add missing fields under the original event identity and timestamp. Existing nonempty values remain unchanged.
Without ttclid, only identical normalized campaign metadata is deduplicated. Additional or changed campaign, ad-group or creative fields can describe a different opening and remain separate. CUX does not guess that two different payloads represent the same click. Preserve ttclid or its deep_link_sub1 fallback where the provider supplies it.
An empty FOUND callback, or one containing only provider/match/ad-group/creative details, is ignored and does not block a later complete URL. At least one source, medium, campaign ID, campaign name or click ID is required. Reopening a link through a real later OS or Linking event remains a new opening.
First-launch, non-organic installation attribution is stored separately. Cached and returning-install conversion callbacks do not create a new installation. CUX retains the provider's reported matching method.
Keep data scoped to your project
Use the mobile project's token for preparation and initialization. Changing the project, stopping collection, resetting or disabling attribution clears pending campaign data. Disable attribution independently with CUX.prepareAttribution({ enabled: false }) in React Native, or the native preparation/enable API.
CUX stores the original normalized click ID in that project's attribution data under the project's visit retention. Keep URLs, click identifiers and callback bodies out of application logs.
Test the integration
Use synthetic campaign values and your mobile project's test visit. Keep full URLs, callback bodies and click IDs out of logs; record only the result status and a test-case label.
| Test | Expected behavior |
|---|---|
Cold and warm OneLink delivered through Linking | Campaign retained without a manual CUX forwarding call |
| App Group URL delivered before JavaScript | Native prepare then forward; same-token JavaScript prepare preserves the candidate |
| App Group URL delivered after JavaScript | Explicit processAttribution(rawUrl, { provider: 'url' }) retains it |
Empty or null-field FOUND, followed by a valid URL | Empty callback ignored; URL admitted |
| Automatic URL, then manual replay after five seconds | One opening for identical campaign evidence within the retained history |
| URL, then a late callback with the same click ID and extra metadata | Missing fields added to the same opening; original values retained |
| No click ID, identical callback metadata | Duplicate confirmation; changed metadata can remain a separate opening |
| Withdraw consent, then grant again | Pending data cleared on withdrawal; only future links collected after the grant |
| Change mobile project token | Old pending data is not transferred to the new project |
| Real later link opening | Separate opening in the active visit |
Test the App Clip journey both when the full app is already installed and when the URL is handed off after installation. Test on Android and iOS, including background and cold starts. Keep your existing navigation and masking checks in the same test build.
buffered means the normalized candidate is held in native memory. accepted means the collector admitted it for processing. duplicate confirms matching evidence already retained. ignored means no eligible attribution was admitted; invalid means the input failed validation. These statuses do not confirm server persistence. Check the resulting mobile visit after consent and a successful connection to CUX.
The pending buffer is limited to 16 candidates, 64 KiB and 15 minutes. It is not a persistent queue across process termination. Treat this build as an RC while completing your integration acceptance checks.