Skip to main content

Use Cursor, Claude Code, or another AI to help you integrate the React Native SDK.

Open in Cursor

Repository

Here, you will find the npmjs.org react-native-appstack-sdk documentation. Please use the latest available version of the SDK.

Quickstart

Use this path when you only need the minimum production integration:
  1. Install react-native-appstack-sdk.
  2. Run cd ios && pod install for iOS projects.
  3. Copy the Production API key from SDK in Appstack.
  4. Call AppstackSDK.configure(...) from app startup code.
  5. Send standard events such as 'LOGIN', 'SIGN_UP', 'PURCHASE', and 'SUBSCRIBE'.
  6. Confirm events appear in the Appstack SDK page before enabling downstream integrations.

Requirements

iOS

  • iOS version: 13.0+ (15.0+ required for Apple Ads attribution).
  • Xcode: 14.0+
  • React Native: 0.72.0+

Android

  • Minimum SDK: Android 5.0 (API level 21).
  • Target SDK: 35+
  • Java Version: 17+

General

  • Node.js: 16.0+

Initial setup

1

Installation

2

Initialization

Follow these steps to get the API key:
  1. In Appstack, from the side menu, select SDK and ensure you are selecting the correct application.
  2. Select the Production environment.
  3. Copy the API key.
Examples:
3

Configuration parameters

Initializes the SDK with your API key. Call this from app startup code before any other SDK methods.
Parameters:
  • apiKey (string, required): Your platform-specific API key from the Appstack dashboard.
Returns: A promise that resolves to true if configuration was successful.Example:
configure also accepts two trailing positional parameters: logLevel (0=DEBUG, 1=INFO, 2=WARN, 3=ERROR, default 1) and customerUserId. They sit behind two deprecated slots that the wrapper ignores, so pass undefined for both:
4

Sending events

Track user actions and revenue in your activities:
Available EventType valuesIt is recommended to use standard events for a smoother experience.
INSTALL is tracked automatically on SDK initialization. Do not send it manually.
  • LOGINSIGN_UP REGISTER Authentication.
  • PURCHASEADD_TO_CARTADD_TO_WISHLISTINITIATE_CHECKOUTSTART_TRIALSUBSCRIBE  Monetization.
  • LEVEL_STARTLEVEL_COMPLETE Game progression.
  • TUTORIAL_COMPLETE/SEARCHVIEW_ITEMVIEW_CONTENTSHARE Engagement.
  • CUSTOM For application-specific events.
Tracks custom events with optional parameters:
  • eventType Event type from EventType enum or string (e.g., ‘PURCHASE’, ‘LOGIN’).
  • eventName Event name for custom events (optional).
  • parameters Optional parameters object (e.g., { revenue: 29.99, currency: 'USD' }).
Returns: A promise that resolves to true if event was sent successfully.Enhanced app campaigns
When running enhanced app campaigns (EACs), it is highly recommended to send multiple parameters with the in-app event to improve matching quality.
For any event that represents revenue, we recommend sending:
  1. revenue or price (number).
  2. currency(string, e.g. EUR, USD).
To improve matching quality on Meta, send events including the following parameters if you can fulfill them. Appstack automatically encrypts these matching parameters before using them for attribution matching.
  1. email.
  2. name (first + last name in the same field).
  3. phone_number — also accepted as phone or phoneNumber.
  4. date_of_birth (recommended format: YYYY-MM-DD) — also accepted as birthdate, birthday, or dateOfBirth.
  5. gender.

Appstack ID and attribution params

After configure, you can read the Appstack user ID and the attribution object for partner integrations (for example Superwall, RevenueCat).
  • getAppstackId() — Appstack user identifier when a partner expects $appstackId or similar.
  • getAttributionParams() — Attribution payload (campaign, media source, click IDs, device identifiers where available) to forward to partners.

Development setup

Environment-based configuration

Set up different API keys for different environments:

Platform-specific considerations

iOS

Apple Ads attribution:
  • Only works on iOS 15.0+ (below that the call is a no-op)
  • Requires app installation from App Store or TestFlight.
  • Attribution data appears within 24-48 hours.
  • User consent may be required for detailed attribution (iOS 14.5+).

Android

Play Store attribution:
  • Install referrer data collected automatically.
  • Attribution available immediately for Play Store installs.
  • Works with Android 5.0+ (API level 21).

Cross-platform best practices

Security and privacy

API key protection

  • Never commit API keys to version control.
  • Use environment variables or secure configuration.
  • Use different keys for development and production.
  • Do not put personally identifiable information in event names.
  • Only send matching parameters such as email, name, phone_number, and date_of_birth when your app has the right consent and compliance basis. Appstack automatically encrypts these fields before using them for attribution matching.
  • Prefer standard event types for common flows so event mapping remains consistent across Appstack and ad integrations.

Data privacy

  • Event names and revenue data are transmitted securely over HTTPS.
  • No personally identifiable information (PII) should be included in event names.
  • The SDK does not collect device identifiers beyond what’s required for attribution.

Limitations

Attribution timing

  • iOS: Apple Ads attribution data appears within 24-48 hours after install.
  • Android: Install referrer data available immediately for Play Store installs.
  • Attribution only available for apps installed from official stores.

Platform constraints

  • iOS: Requires iOS 13.0+, Apple Ads attribution needs iOS 15.0+
  • Android: Minimum API level 21 (Android 5.0).
  • React Native: 0.72.0+
  • Some Apple Ads features may not work in development/simulator environments.

Event tracking

  • Event types are case-sensitive (use uppercase like ‘PURCHASE’, ‘LOGIN’).
  • Parameters are passed as an object and can include any key-value pairs.
  • For revenue events, always pass a revenue (or price) and a currency parameter.
  • The SDK must be initialized from app startup code before any tracking calls.
  • Network connectivity required for event transmission (events are queued offline).

Technical limitations

  • enableAppleAdsAttribution() only works on iOS and will do nothing on Android.
  • The isDebug and endpointBaseUrl arguments still accepted by configure(...) are deprecated no-ops: they are not forwarded to the native SDKs and have no effect. Call configure(apiKey) and leave them out.

Troubleshooting

Common Issues

Configuration fails:
Events not appearing in dashboard:
  • Check network connectivity.
  • Verify the API key is correct for the platform.
  • Events may take a few minutes to appear in the dashboard.
iOS Attribution not working:
  • Ensure iOS version is 15.0+
  • Verify the app is installed from the App Store or TestFlight.
  • Allow 24-48 hours for attribution data to appear.

Verification checklist

  • react-native-appstack-sdk is installed.
  • iOS dependencies are installed with cd ios && pod install.
  • App meets React Native 0.72.0+, Node 16.0+, iOS 13.0+, Android min SDK 21, target SDK 35+, and Java 17+ requirements.
  • Platform-specific API keys are configured for iOS and Android.
  • Production API keys are used in production builds.
  • Development API keys are used only in development builds.
  • configure(...) runs once from app startup code before any events.
  • iOS-only Apple Ads calls are guarded with Platform.OS === 'ios'.
  • INSTALL is not sent manually.
  • Login, signup, purchase, subscription, and other key app events use standard event names where possible.
  • Revenue events include revenue or price and currency.
  • Custom events use 'CUSTOM' with a descriptive event name.
  • Appstack ID and attribution params are available before wiring partner integrations.
  • Events are visible in the Appstack SDK page before launch.

Superwall

To start using the Superwall integration, click here to see the correct SDK documentation.

Apple Ads

To start using the Apple Ads integration, click here to see the correct SDK documentation.

Support

For questions or issues:
  1. Check the GitHub Repository.
  2. Contact our support team at support@appstack.tech
  3. Open an issue in the repository.

Use Cursor, Claude Code, or another AI to validate your existing Appstack React Native SDK integration.

Open in Cursor