Skip to main content

Report conversions for advertisers

For Rokt advertisers, the Android SDK can record conversion events that occur in your app to help you close the loop on your campaigns.

Before you begin

Ensure that the Rokt Android SDK has already been integrated into your application following the steps listed here.

Executing the Rokt Android SDK

Execute the SDK in your desired activity/fragment by adding any appropriate customer attributes and the placement mapping. The example code uses the onCreate method to report conversions.

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.

note

The Rokt Android 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, you can ignore the callbacks.

import com.rokt.roktsdk.Rokt;

class ConfirmationActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...

Map<String,String> attributes = new HashMap<String, String>();

attributes.put("email", "j.smith@example.com");
attributes.put("firstname", "Jenny");
attributes.put("lastname", "Smith");
attributes.put("mobile", "(323) 867-5309");
attributes.put("postcode", "90210");
attributes.put("country", "US");

Rokt.INSTANCE.execute("RoktExperience",
attributes,
new Rokt.RoktCallback() {
@Override
public void onLoad() {

}

@Override
public void onUnload(Rokt.UnloadReasons unloadReasons) {

}

@Override
public void onShouldHideLoadingIndicator() {

}

@Override
public void onShouldShowLoadingIndicator() {

}
}
)
...
}
}
Was this article helpful?