1.13.1 • Published 18 days ago

@rudderstack/rudder-sdk-react-native v1.13.1

Weekly downloads
378
License
MIT
Repository
github
Last release
18 days ago

What is RudderStack?

RudderStack is a customer data pipeline tool for collecting, routing and processing data from your websites, apps, cloud tools, and data warehouse.

More information on RudderStack can be found here.

RudderStack React Native SDK

The RudderStack React Native SDK allows you to track event data from your app. It can be easily integrated into your React Native application. After integrating this SDK, you will also send the event data to your preferred analytics destination/s, such as Google Analytics, Amplitude, and more.

Getting Started with React Native SDK

  1. Add the SDK to your React Native application with the following command:
yarn add @rudderstack/rudder-sdk-react-native
  1. For Android: Make sure you have added mavenCentral() as a repository in your project level build.gradle file, as shown below:
buildscript {
    repositories {
        mavenCentral()
    }
}
allprojects {
    repositories {
        mavenCentral()
    }
}
  1. For iOS: Navigate to the ios folder of your application and install all the dependencies with:
pod install

Import RudderClient

Add the below line to import the rudderClient.

import rudderClient, { RUDDER_LOG_LEVEL } from '@rudderstack/rudder-sdk-react-native';

Initialize RudderClient

Add the following code in your application:

const config = {
  dataPlaneUrl: <DATA_PLANE_URL>,
  trackAppLifecycleEvents: true,
  logLevel: RUDDER_LOG_LEVEL.DEBUG
};
await rudderClient.setup(<WRITE_KEY>, config);

Send Events

rudderClient.track("simple_track_event", {
  "key1":"val1",
  "key2":{
    "child_key1":"child_val1"
  }
});

Device Tokens

You can use the putDeviceToken method to pass your Android and iOS device tokens.

putDeviceToken accepts two string arguments :

  • androidToken : Your Android device token
  • iOSToken : Your iOS device token

An example usage is as shown below:

rudderClient.putDeviceToken("<Your Android device token>", "<Your iOS device token>");

AdvertisingId

You can use the setAdvertisingId method to pass your Android and iOS AAID and IDFA respectively. setAdvertisingId accepts two string arguments :

  • androidId : Your Android advertisingId (AAID)
  • iOSId : Your iOS advertisingId (IDFA)

Example Usage:

rudderClient.setAdvertisingId(AAID, IDFA);

AnonymousId

You can use the setAnonymousId method to pass your anonymousId and the SDK will use that instead of the deviceId. setAnonymousId accepts one string argument:

  • id : Your anonymousId

Example Usage:

rudderClient.setAnonymousId(ANONYMOUS_ID);

For more details, check out our documentation.

Contact Us

If you come across any issues while configuring or using RudderStack React Native SDK, please feel free to start a conversation on our Slack channel. We will be happy to help you.

1.13.1

18 days ago

1.13.0

1 month ago

1.12.1

2 months ago

1.12.0

3 months ago

1.11.3

5 months ago

1.11.2

5 months ago

1.8.2

7 months ago

1.8.1

9 months ago

1.8.0

9 months ago

1.11.0

7 months ago

1.11.1

6 months ago

1.9.1

8 months ago

1.9.0

8 months ago

1.10.0

7 months ago

1.7.1

12 months ago

1.6.3

1 year ago

1.7.0

1 year ago

1.6.2

1 year ago

1.6.1

1 year ago

1.5.2

1 year ago

1.6.0

1 year ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.2.1

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.16

2 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.9-beta3

3 years ago

1.0.9-beta2

3 years ago

1.0.9-beta1

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.7-beta1

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago