Skip to main content

Logging and analyzing where conversions occur

In this tutorial, we show you how to use Radar's conversions API to analyze the location context associated with key customer interactions. Conversions can represent anything from a purchase or signup to engagement with an in-app feature.

When these events are enriched with Radar's location context, they can be used to determine where these conversions occur and measure the value of location based features.

Languages used#

  • Swift
  • Kotlin

Features used#

Steps#

Step 1: Sign up for Radar#

If you haven't already, sign up for Radar to get your API key. You can create up to 1,000 geofences and make up to 100,000 API requests per month for free.

Get API keys

Step 2: Install the Radar SDK#

iOS#

If you're starting from scratch, create a new Xcode project of type Single View App.

Install the iOS SDK using CocoaPods or Carthage (recommended) or by downloading the framework and dragging it into your project.

Initialize the SDK in your AppDelegate class with your publishable API key.

import UIKitimport RadarSDK
@UIApplicationMainclass AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {        Radar.initialize(publishableKey: "prj_test_pk_...")
        return true    }
}

Android#

The best way to add the SDK to your project is via Gradle. See the Android SDK installation guide.

When your app starts, in application onCreate(), initialize the SDK with your publishable API key.

import io.radar.sdk.Radar
class MyApplication : Application() {
    override fun onCreate() {        super.onCreate()
        Radar.initialize(this, "prj_test_pk_...")    }
}

Step 3: Determine the conversions you want to track#

To take advantage of Radar's conversions API, you need to identify the events that are important to your business. Here are some examples:

Conversion nameExample purposePlacementEvent properties
purchaseMeasure the revenue driven from location-enabled featuresAfter a user makes a purchaserevenue (number)
pickup (boolean)
in_store_mode (boolean)
order_placedUnderstand where users are placing orders within the app to prioritize personalized featuresAfter a user places an orderrevenue (number)
applied_coupon (boolean)
sign_upMeasure which stores are driving sign ups through store promotionsAfter a user completes the signup flowreferrer (string)
rewards (boolean)
product_searchUnderstand where customers are searching for products (i.e., in specific stores or at competitor locations)After a user searches for a productsection (string)

Step 4: Set up Radar geofences or places#

On the Geofences page, import geofences for your locations. For places, on the Settings page, monitor your desired place chains and categories. When processing conversions, Radar will determine if they happen at any of these geofences or places.

Step 5: Log conversions via the Radar SDK#

The following example demonstrates how to log a conversion when a user makes a purchase.

// on making a purchaseRadar.logConversion(  name: "purchase",  revenue: 12.50,  metadata: ["product":"shirt"]) { (status, event) in  print("Logged conversion: status = \(Radar.stringForStatus(status)); event = \(String(describing: event))")}

Step 6: Conversions overview in the Radar dashboard#

The Report page of the Radar dashboard has a Conversions tab that provides an overview of all conversions logged for a project. Understand how engagement with your app differs between opted-in and opted-out users. See the total revenue across all conversions that have been logged with revenue.

Below is an example of a fully populated Conversions page for a project that has logged conversions for purchase and opened_notification events: Conversions report page

Step 7: Analyze conversions across location context types#

You can see when and where conversions were generated directly in the Radar dashboard. On the Events page, watch as conversions start to stream in:

Conversion events feed

Click the View icon on the right to view a conversion's details: Conversion event detail page

Finally, select Analysis within the dropdown on the Events page to view all of your conversions sliced by different dimensions, such as place chain or geofence tag:

Conversion events analysis