Adjust React Native SDK

5.5.0 · active · verified Sun Apr 19

The `react-native-adjust` package provides the official React Native SDK for Adjust, a mobile app attribution and analytics platform. It enables developers to track installs, events, sessions, and deep links across iOS and Android applications, providing insights into user acquisition campaigns and in-app behavior. The current stable version is `5.5.0`, with frequent updates that typically mirror the underlying native Adjust iOS and Android SDKs. This ensures compatibility with the latest Adjust backend features and OS-level changes. Key differentiators include robust fraud prevention, granular attribution reporting, and seamless integration with the Adjust dashboard for comprehensive analytics, making it a critical tool for mobile marketers and app developers focused on growth and measurement.

Common errors

Warnings

Install

Imports

Quickstart

Initializes the Adjust SDK, sets up logging and attribution callbacks, and demonstrates tracking a custom event and retrieving the ADID with a timeout.

import Adjust, { AdjustConfig, AdjustEvent, AdjustLogLevel } from 'react-native-adjust';

const APP_TOKEN = process.env.ADJUST_APP_TOKEN ?? 'YOUR_ADJUST_APP_TOKEN';
const ENVIRONMENT = AdjustConfig.EnvironmentSandbox; // Use EnvironmentProduction for production

const config = new AdjustConfig(APP_TOKEN, ENVIRONMENT);

// Set up a log listener for debugging
config.setLogLevel(AdjustLogLevel.Verbose);
config.setLogDelegate((logLevel, message) => {
  console.log(`[Adjust Log] ${AdjustLogLevel[logLevel]}: ${message}`);
});

// Set an attribution listener
config.setAttributionCallbackListener((attribution) => {
  console.log('Attribution changed:', attribution);
});

// Initialize the SDK
Adjust.create(config);

// Track an event after SDK initialization
const trackPurchaseEvent = (amount: number, currency: string) => {
  const event = new AdjustEvent('YOUR_EVENT_TOKEN'); // Replace with your event token
  event.setRevenue(amount, currency);
  event.setTransactionId('ORDER_XYZ_123'); // Optional: Add transaction ID
  Adjust.trackEvent(event);
  console.log(`Tracked purchase event: ${amount} ${currency}`);
};

// Example usage:
trackPurchaseEvent(19.99, 'USD');

Adjust.getAdidWithTimeout(5000) // Get ADID with a 5-second timeout
  .then((adid) => {
    console.log('Adjust ADID (with timeout):', adid);
  })
  .catch((error) => {
    console.error('Failed to get ADID with timeout:', error);
  });

view raw JSON →