React Native: Get Started

View as Markdown
Last updated November 15, 2026

Installation

Before You Begin

Before you begin implementing the Lytics SDK for React Native, please make sure you have the following:

  • Access to a Lytics account capable of collecting streaming data.
  • The latest version of Xcode and/or Android Studio
  • A React Native app that you can use to implement the Lytics SDK for React Native

Step 1. Install the Lytics SDK & OS Specific Dependencies:

Install the core React Native Library

yarn add react-native-lytics

Step 2a. Install for Android (only if targeting Android devices)

Add the following permissions to your AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />

This permission is required to send events to the Lytics API:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

This permission is technically optional but highly recommended to allow the library to determine the best time to send events to the API.

Step 2b. Install for iOS (only if targeting iOS devices)

Install native iOS modules:

Shell

npx pod-install

Step 3. Initialize the SDK

There are several configuration options outlined below. At a minimum, however, you must initialize the SDK with a valid API token with data access to your Lytics account.

JavaScript

import { start } from 'react-native-lytics';

start({
  apiToken: 'xxxxxx',
  ...
});

Step 4. Identifying a User

Once we have initialized the SDK, it is a best practice to identify the user anywhere they provide additional strong identifiers, such as a username or email, upon login. This ensures your profiles have the highest potential for properly unifying across your various data sources as soon as they identify themselves.

Do note that this step is optional. By default, the Lytics SDK will create an anonymous identifier for all users and leverage that to merge disparate sources as we do with our traditional web-based JavaScript SDK.

import { identify } from 'react-native-lytics';

identify({
  identifiers: {
    email: 'jdoe@email.com'
  } 
});

Step 5. Tracking Activity

Once the user has been identified (optional), we can begin tracking various activities throughout their visit. Typical activities include screen views, clicks, purchases, etc. A full scope of event tracking flexibility can be found in the technical documentation section below.

import { track } from 'react-native-lytics';

track({ 
  name: 'purchase',
  properties: {
    total: 19.99,
    item: "Slingshot"
  }
});