Skip to main content

Report conversions for advertisers

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

Before you begin

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

Execute the Rokt SDK for iOS

Execute the Rokt SDK for iOS in your desired ViewController and add all appropriate consumer attributes. The example code below uses ViewDidLoad to report conversions.

note

The Rokt SDK for iOS 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 customer attributes are integrated with Rokt. You can find more information on the available data fields on the conversion attributes page. You can include additional attributes to your integration by adding lines of code to the attributes section of the example code below.

import Rokt_Widget

class OrderConfirmationViewController: UIViewController {
...
// call this function when the placement needs to be shown
func showWidget() {
let attributes = ["email": "j.smith@example.com",
"firstname": "Jenny",
"lastname": "Smith",
"mobile": "(555)867-5309",
"postcode": "90210",
"country": "US"]

Rokt.execute(viewName: "RoktExperience", attributes: attributes, onLoad: {
// Optional callback for when the Rokt placement loads
}, onUnLoad: {
// Optional callback for when the Rokt placement unloads
}, onShouldShowLoadingIndicator: {
// Optional callback to show a loading indicator
}, onShouldHideLoadingIndicator: {
// Optional callback to hide a loading indicator
})
}
}
Was this article helpful?