Skip to main content

Record conversions for advertisers

The Rokt SDK for React Native can be executed to record conversion events that occur within your app.

Before you begin

Ensure that the Rokt Android SDK has been integrated into your application.

Import the Rokt SDK

Import the Rokt SDK into your JavaScript/TypeScript file:

import { Rokt, RoktEmbeddedView } from "@rokt/react-native-sdk";

Execute the Rokt React Native SDK

Execute the SDK at the desired point by passing the appropriate consumer attributes. At this point, a conversion event is recorded.

You can choose what customer attributes to include in your Rokt integration. More information on available data fields can be found on the attributes page. If you want to add more attributes, you can add additional lines of code for each new attribute to the samples below.

When recording conversion events, it is recommended that the attribute conversiontype is sent to Rokt with an appropriate value for the conversion that is being recorded.

The Rokt React Native SDK is also used to integrate Rokt placements into partner applications. There are optional callbacks available in the SDK when displaying Rokt placements. However, as this guide is specifically referring to recording conversion events, these callbacks do not need to be taken into consideration.

Major Version 3

const attributes = {
email: "j.smith@example.com",
conversiontype: "appinstall",
firstname: "Jenny",
lastname: "Smith",
mobile: "(323) 867-5309",
postcode: "90210",
country: "US",
};

Rokt.execute("RoktConversion", attributes, null, () =>
console.log("Placement Loaded")
);

Major Version 4

const attributes = {
email: "j.smith@example.com",
conversiontype: "appinstall",
firstname: "Jenny",
lastname: "Smith",
mobile: "(323) 867-5309",
postcode: "90210",
country: "US",
};

Rokt.execute("RoktConversion", attributes, null);
note

The ViewName (“RoktConversion”) can be modified when executing the SDK in multiple locations in order to display a different experience according to the context of where in the app the SDK is being executed. If modifying the ViewName, please work with the Rokt team to ensure matching adjustments are made within the Rokt System.

Was this article helpful?