Skip to contentSkip to navigationSkip to topbar
On this page
Looking for more inspiration?Visit the
(information)
You're in the right place! Segment documentation is now part of Twilio Docs. The content you are used to is still here—just in a new home with a refreshed look.

Analytics React Native Adjust Plugin


Adjust(link takes you to an external page) is the mobile attribution provider of choice for hundreds of organizations across the globe. They unify all your marketing activities into one powerful platform, giving you the insights you need to scale your business. The Adjust Destination is open-source. You can browse the code on GitHub in the @segmentio/analytics-react-native(link takes you to an external page) repository.


Getting started

getting-started page anchor
  1. From the Segment web app, click Catalog.
  2. Search for "Adjust" in the Catalog, select it, and choose which of your sources to connect the destination to.
  3. You don't need to include Adjust's SDK natively, as this prevent you from successfully implementing the Adjust.
  4. Depending on the source you've selected, include Adjust's library by adding the following lines to your dependency configuration.

You need to install the @segment/analytics-react-native-plugin-adjust and the react-native-adjust dependency.

Using NPM:

npm install --save @segment/analytics-react-native-plugin-adjust react-native-adjust

Using Yarn:

yarn add @segment/analytics-react-native-plugin-adjust react-native-adjust

Run pod install after the installation to autolink the Adjust SDK.

See React Native SDK of Adjust(link takes you to an external page) for more details of this dependency.


Using the Plugin in your App

using-the-plugin-in-your-app page anchor

Follow the instructions for adding plugins(link takes you to an external page) on the main Analytics client:

In your code where you initialize the analytics client call the .add(plugin) method with an AdjustPlugin instance:

1
import { createClient } from '@segment/analytics-react-native';
2
3
import { AdjustPlugin } from '@segment/analytics-react-native-plugin-adjust';
4
5
const segmentClient = createClient({
6
writeKey: 'SEGMENT_KEY'
7
});
8
9
segmentClient.add({ plugin: new AdjustPlugin() });

If you're not familiar with the Segment Specs, take a look to understand what the Identify method does. An example call would look like:

1
const { identify } = useAnalytics();
2
3
identify('user-123', {
4
username: 'MisterWhiskers',
5
email: 'hello@test.com',
6
plan: 'premium',
7
});

When you call identify, Segment will call Adjust's addSessionPartnerParameter(link takes you to an external page) method and set the userId and/or anonymousId. This will set these values within Adjust, and allow Adjust to send back attribution data from their servers.


If you're not familiar with the Segment Specs, take a look to understand what the Track method does. An example call would look like:

1
const { track } = useAnalytics();
2
3
track('View Product', {
4
productId: 123,
5
productName: 'Striped trousers',
6
});

When you call track Segment maps the event to your pre-defined Adjust custom event. You must map your track events to your custom Adjust Event Token in your Adjust destination settings.

If you don't provide a mapping, Adjust cannot accept the event. Segment includes all the event properties as callback parameters on the Adjust event, and automatically translate revenue and currency to the appropriate Adjust event properties based on Segment's spec'd properties.


Client

client page anchor

Segment will trigger an Install Attributed event if you have trackAttributionData enabled in your settings and the Segment-Adjust integration installed in your app.

Using Adjust's Attribution callback(link takes you to an external page), Segment listens for an attribution change from Adjust's SDK and triggers the call with the following Adjust attribution parameters:

KeyValueDescription
providerAdjusthardcoded by Segment
trackerTokenattribution.trackerTokenthe tracker token of the current install
trackerNameattribution.trackerNamethe tracker name of the current install
campaign.sourceattribution.networkthe network grouping level of the current install
campaign.nameattribution.campaignthe campaign grouping level of the current install
campaign.contentattribution.clickLabelthe click label of the current install
campaign.adCreativeattribution.creativethe creative grouping level of the current install
campaign.adGroupattribution.adgroupthe ad group grouping level of the current install

If any value is unavailable, it will default to nil. This call will be sent to all enabled device and cloud mode destinations.


By default, Segment's destination sends data to the Adjust Sandbox Environment. When you release your app to the App Store, enable the Production option in the Adjust destination settings on Segment (or use two separate sources, one for dev and one for prod, with different environment settings for Adjust).

The destination sends all event properties as callback parameters to Adjust. To set Partner Parameters(link takes you to an external page), you can access the Adjust SDK directly.

Transaction deduplication

transaction-deduplication page anchor

The destination will automatically recognize the spec'd orderId property, and send it as the transaction ID to Adjust for revenue de-duplication.

In-app purchase receipts

in-app-purchase-receipts page anchor

The destination does not currently support in-app purchase receipts. If this is important to you, reach out to support(link takes you to an external page).

The destination automatically forwards push notification tokens through to Adjust.

By default, our destination enables event buffering for Adjust. This saves your customers' battery life. However, you can disable this in the options on the Adjust destination settings on Segment.