Set up the SDK
The justtrack SDK provides powerful tracking capabilities for attribution, events, and more.
This guide shows you how to add the justtrack SDK to your app.
Add the SDK dependency
You can install the justtrack SDK for React Native from npm using:
npm install react-native-justtrack-sdk --save
Compatibility
Before integrating, make sure your project meets the minimum requirements for your platform.
| Requirement | Minimum |
|---|---|
| React | 18.2.0 |
| React Native | 0.71.0 |
Find your API token
For the next step, you'll need to obtain an API token. Follow our guide to find your API token.
Instantiate the SDK
You first have to initialize the SDK with your API token:
import * as JustTrackSdk from 'react-native-justtrack-sdk';
await new JustTrackSdk.JusttrackSdkBuilder(apiToken).initialize();
Only after initializing the SDK will you be able to call the methods to attribute the current user or send user events.
Track user connection status with events
The SDK can record whether the device was online or offline when an event happened. Enable connection tracking, and every event you track carries the jt_connection_type predefined dimension with the value online or offline. This is useful when you want to tell real user behavior apart from events that queued up while the device had no connection.
Connection tracking is off by default. Turn it on when you create the SDK:
await new JustTrackSdk.JusttrackSdkBuilder(apiToken)
.withEnableConnectionTracking(true)
.initialize();
Ad tracking transparency for iOS Starting with iOS 14, the justtrack SDK can only access the
IDFA if the user allowed the app to track them. The justtrack SDK doesn't request this permission but can (albeit somewhat limited) still attribute the user to the correct campaign. To improve this precision, you can ask the user for permission to track them.
That’s it!
Once instantiated, JustTrackSdk is ready to attribute your users.
See our guide on tracking events next.