On this page
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
Use the CUX RC build provided for your project before adding the integration below. Keep your existing mobile project token and AppsFlyer configuration.
Choose your RC version
| Integration | Exact version | Requirements |
|---|---|---|
| Native Android | io.cux:analytics-compose-sdk:1.2.1-rc.1 | Android API 26 or later |
| Native iOS | 1.1.12-rc.1 | iOS 15 or later |
| React Native | @cuxio/react-native-sdk@1.0.23-rc.1 | Android API 23 or later; iOS 15 or later |
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.
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.
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.
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.
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.
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.