> ## Documentation Index
> Fetch the complete documentation index at: https://radarlabs-update-tracking-options.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Logging and analyzing where conversions occur

<Info>
  Conversions are available on the [**Enterprise plan**](https://radar.com/pricing).
</Info>

In this tutorial, we show you how to use Radar's [conversions API](/api#log-a-conversion) 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

* [iOS SDK](/sdk/ios)
* [Android SDK](/sdk/android)
* [Conversions API](/api#log-a-conversion)

## Steps

<Steps>
  <Step title="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**](https://radar.com/signup)
  </Step>

  <Step title="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](https://docs.radar.com/sdk/ios#install-sdk) using CocoaPods or Carthage (recommended) or by [downloading the framework](https://github.com/radarlabs/radar-sdk-ios/releases) and dragging it into your project.

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

    ```swift theme={null}
    import UIKit
    import RadarSDK

    @UIApplicationMain
    class 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](https://docs.radar.com/sdk/android#install-sdk).

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

    ```kotlin theme={null}
    import io.radar.sdk.Radar

    class MyApplication : Application() {

        override fun onCreate() {
            super.onCreate()

            Radar.initialize(this, "prj_test_pk_...")
        }

    }
    ```
  </Step>

  <Step title="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 name** | **Example purpose**                                                                                         | **Placement**                          | **Event properties**                                                      |
    | :------------------ | :---------------------------------------------------------------------------------------------------------- | :------------------------------------- | :------------------------------------------------------------------------ |
    | `purchase`          | Measure the revenue driven from location-enabled features                                                   | After a user makes a purchase          | `revenue` (number)<br />`pickup` (boolean)<br />`in_store_mode` (boolean) |
    | `order_placed`      | Understand where users are placing orders within the app to prioritize personalized features                | After a user places an order           | `revenue` (number)<br />`applied_coupon` (boolean)                        |
    | `sign_up`           | Measure which stores are driving sign ups through store promotions                                          | After a user completes the signup flow | `referrer` (string)<br />`rewards` (boolean)                              |
    | `product_search`    | Understand where customers are searching for products (i.e., in specific stores or at competitor locations) | After a user searches for a product    | `section` (string)                                                        |
  </Step>

  <Step title="Set up Radar geofences or places">
    On the [Geofences page](https://dashboard.radar.com/geofencing/geofences), import geofences for your locations. For places, on the [Settings page](https://dashboard.radar.com/settings), monitor your desired place chains and categories. When processing conversions, Radar will determine if they happen at any of these geofences or places.
  </Step>

  <Step title="Log conversions via the Radar SDK">
    The following example demonstrates how to log a conversion when a user makes a purchase.

    <CodeGroup>
      ```swift Swift theme={null}
      // on making a purchase
      Radar.logConversion(
        name: "purchase",
        revenue: 12.50,
        metadata: ["product":"shirt"]
      ) { (status, event) in
        print("Logged conversion: status = \(Radar.stringForStatus(status)); event = \(String(describing: event))")
      }
      ```

      ```kotlin Kotlin theme={null}
      // on searching for a product
      val metadata = JSONObject(mapOf("product" to "shirt"))
      Radar.logConversion(
          "purchase",
          12.50,
          metadata
      ) { status, event ->
          Log.v("example", "Conversion = ${event?.type}: status = $status; event = $event")
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="Conversions overview in the Radar dashboard">
    The [Report](https://dashboard.radar.com/geofencing/analytics/conversions) 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:

    <img src="https://mintcdn.com/radarlabs-update-tracking-options/raXxpkaZHCzKUoPc/images/tutorials/assets/images/conversions-report-page-0b467fbf731440f46fab841b3ebcee68.png?fit=max&auto=format&n=raXxpkaZHCzKUoPc&q=85&s=b69b1e441e7af602be53c6c5ce83884e" alt="Conversions Report Page 0b467fbf731440f46fab841b3ebcee68 Pn" width="2370" height="1530" data-path="images/tutorials/assets/images/conversions-report-page-0b467fbf731440f46fab841b3ebcee68.png" />
  </Step>

  <Step title="Analyze conversions across location context types">
    You can see when and where conversions were generated directly in the Radar dashboard. On the [Events](https://dashboard.radar.com/geofencing/events) page, watch as conversions start to stream in:

    <img src="https://mintcdn.com/radarlabs-update-tracking-options/raXxpkaZHCzKUoPc/images/tutorials/assets/images/conversion-events-feed-61fa7247b3e1dc0a1b91a4492f3d7687.png?fit=max&auto=format&n=raXxpkaZHCzKUoPc&q=85&s=88e2d543d2c9fc000c98a7a51bd1bfea" alt="Conversion Events Feed 61fa7247b3e1dc0a1b91a4492f3d7687 Pn" width="1559" height="858" data-path="images/tutorials/assets/images/conversion-events-feed-61fa7247b3e1dc0a1b91a4492f3d7687.png" />

    Click the\_View icon\_  on the right to view a conversion's details:

    <img src="https://mintcdn.com/radarlabs-update-tracking-options/hbm_NuO3on5rqRgE/images/conversion-event-detail-page.gif?s=6f5d5b14fb69366ce71458ad26def165" alt="Conversion Event Detail Page Gi" width="1584" height="839" data-path="images/conversion-event-detail-page.gif" />

    Finally, select *Analysis* within the dropdown on the [Events](https://dashboard.radar.com/geofencing/events) page to view all of your conversions sliced by different dimensions, such as place chain or geofence tag:

    <img src="https://mintcdn.com/radarlabs-update-tracking-options/raXxpkaZHCzKUoPc/images/tutorials/assets/images/conversion-events-analysis-0252a5def813edf16b7ac1c4ce50ff80.png?fit=max&auto=format&n=raXxpkaZHCzKUoPc&q=85&s=157a05e6ebff163e83ffce43a02fcc3a" alt="Conversion Events Analysis 0252a5def813edf16b7ac1c4ce50ff80 Pn" width="1569" height="1247" data-path="images/tutorials/assets/images/conversion-events-analysis-0252a5def813edf16b7ac1c4ce50ff80.png" />
  </Step>
</Steps>
