Rokt Documentation
  • Documentation
  • User Guide
  • SDK
  • API
  • Third-Party Integrations
  • Help

›Integrating the SDK

Getting Started

  • Introduction

Web SDK

  • Overview
  • Architecture
  • Integrating the Web SDK
  • Integration Examples

    • Confirmation Page Integration
    • Preparative Iframe
    • Page Identifier
    • Single Page Applications
    • Brand Conversion Integration
    • In Transaction/Cart Integration
    • Event-based Integration
    • Sandbox Integration
  • Integration Best Practices
  • Attributes
  • Security
  • Mobile In-App Web Pages
  • API

    • README
    • Globals

    Enumerations

    • FailureReason

    Interfaces

    • Attributes
    • Cart
    • CartItem
    • PlacementCloseEvent
    • Rokt
    • RoktConfiguration
    • Widget

iOS SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration
  • Attributes
  • Security

Android SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration

    Attributes

    • Core Attributes
    • Vertical Attributes
  • Security

React Native SDK

  • Overview
  • Version
  • Integrating the SDK

    • Integrating and Initializing the SDK
    • Launching an Overlay Placement
    • Launching an Embedded Placement
    • Recording a Brand Conversion
    • Sandbox Integration

    Attributes

    • Core Attributes
    • Vertical Attributes
  • Security
Edit

Recording a Brand Conversion

The Rokt SDK for Android can be executed to record conversion events that occur within your app. These instructions assume that the Rokt SDK for Android has already been integrated into your application by following steps 1 to 4 here.

Step 5: Execute the Rokt Android SDK

Execute the SDK in your desired Activity/Fragment, passing any appropriate consumer attributes and the placement mapping. The example code uses onCreate to launch the placement

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, these callbacks do not need to be taken into consideration.

Your app dictates which consumer attributes are passed through to Rokt. More information on the data fields that are able to be passed through the SDK can be found under the Attributes section. You can add additional code lines into the below sections containing consumer attributes in order to build up the data package that will be sent through to Rokt.

Kotlin

import com.rokt.roktsdk.Rokt
 
class ConfirmationActivity : Activity() {   
    override fun onCreate(savedInstanceState: Bundle?) {       
        super.onCreate(savedInstanceState)       
        ...    
 
        // Include any appropriate consumer attributes       
        val attributes = hashMapOf(               
                Pair("email", "j.smith@example.com"),
                Pair("firstname", "Jenny"),
                Pair("lastname", "Smith"),
                Pair("mobile", "(323) 867-5309"),
                Pair("postcode", "90210"),
                Pair("country", "US"))
 
        Rokt.execute("RoktExperience",               
            attributes,               
            object : Rokt.RoktCallback {                   
                override fun onUnload(reason: Rokt.UnloadReasons) {                       
                          
                }                   
                override fun onLoad() {                       
                                  
                }                   
                override fun onShouldHideLoadingIndicator() {                       
                            
                }                   
                override fun onShouldShowLoadingIndicator() {                       
                     
                }               
            }       
        )  
        ...
    }
}

Java

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() {
 
                }
            }      
        )  
        ...
    }
}

Step 6: Build & Run

← Launching an Embedded PlacementSandbox Integration →
  • Step 5: Execute the Rokt Android SDK
  • Step 6: Build & Run
RESOURCES
DocumentationUser GuideSDKAPIIntegration PartnersHelp
COMPANY
About UsContact UsCareersEngineering Blog
Rokt Documentation
Copyright © Rokt 2021 - All Rights Reserved