Skip to main content

Recording 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 already been integrated into your application following the steps listed here.

Importing the Rokt SDK into the JavaScript file#

Import the Rokt SDK into the JavaScript file:

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

Executing 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 dictate what customer attributes are shared with Rokt. More information on available data fields can be found on the attributes page. If you want to share 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.

attributes = {  email: "",  conversiontype: "appinstall",  firstname: "Jenny",  lastname: "Smith",  mobile: "(323) 867-5309",  postcode: "90210",  country: "US",};
Rokt.execute("RoktConversion", attributes, null, () =>  console.log("Placement Loaded"));

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?