본문으로 건너뛰기

Send conversion events

The SDK collects various conversion events. The “App installed” and “App launched” events are automatically collected. Other events need to be collected manually.

Each event name is defined in NTrackerConversionEvent struct/object.

The list of events is as follows:

Event descriptionHow to collectEvent nameAPI
App installedAutomatically-Automatically sent when the app is first launched.
App launchedAutomatically-Automatically sent when the app is launched and the SDK is initialized.
Purchase completedManually-`trackPurchaseEvent`
In-app purchase completedManually-`trackInAppPurchaseEvent`
Added to cartManuallyCart`trackConversionEvent`
Added to wishlistManuallyWishList
Application completedManuallyApplication
SubscribedManuallySubscribe
Reservation completedManuallyReservation
View contentManuallyViewContent
Level accomplishedManuallyLevelEnd
Tutorial completedManuallyTutorial
Signup completedManuallySignUp
Custom event (#1~#10)ManuallyCustomEvent[001~010]

What you should know when sending conversion events

To enable conversion tracking in NAVER Performance DA, you should note the following.

Event name

When sending an event using the trackConversionEvent API, make sure to specify an event name.

Conversion values

A conversion value (value) means the total conversion sales in KRW. Conversion values can be sent for all events other than those collected automatically.

  • To include conversion values for the “Purchase completed” and “In-app purchase completed” events, you need to specify the total amount that was actually paid. The conversion value field for the other conversion events is optional, so you can specify a conversion value to measure for each event.
  • To send product details using NTrackerConversionItem for the “Purchase completed” and “In-app purchase completed” events, the conversion value must be the same as the sum (payAmount) of purchased items.
  • To include conversion values for general events other than “Purchase completed” and “In-app purchase completed,” the conversion value must be in KRW.
  • If extremely high conversion values are reported within a short period of time, it is considered abuse and the reporting of conversions will be limited in NAVER Performance DA. The criteria to determine whether conversion reporting is abuse can change according to the internal logic.

Send product details by event type

NTrackerConversionItem can contain the information of detailed items in an event. For the “Purchase completed” and “In-app purchase completed” events, it is recommended to pass purchased items (product details) using NTrackerConversionItem. See Examples of sending events for how to use.

Especially when there is a possibility to pay in USD in the “Purchase completed” or “In-app purchase completed” event, you should specify the payment amount and currency under items using NTrackerConversionItem, without specifying the conversion value. Note that if both the conversion value and the payment amount under items are passed, only the conversion value is counted as conversion sales.

You can also use NTrackerConversionItem to pass product details for the “Added to cart,” “Added to wishlist,” and “View content” events, but currently the information is not used for NAVER Performance DA reporting and optimization. The information under items will be available later using conversion optimization and dashboards in NAVER Performance DA.

In NTrackerConversionItem, quantity and payAmount are required, and the other fields are optional.

  • quantity is the conversion quantity of the product (or service).
  • payAmount is the total conversion value of the product. For example, if 3 item A’s are purchased and the price of an item A is 1,000 KRW, the item’s payAmount is 3,000 KRW.
  • If the value for payAmount is not in KRW, you need to add a currency code (ISO 4217) in ext1. If a currency code is not added, the currency unit is “KRW” by default.
  • Other than quantity and payAmount, the optional fields can be specified as needed.

Caution

  • If items can be purchased overseas, a currency code must be added.
  • Currently, only KRW and USD are supported; if another currency code, such as EUR, is added, the conversion value is treated as 0.

Examples of sending events

The following code examples show how to send various types of events.

Send “Purchase completed” event

You can use the trackPurchaseEvent and trackInAppPurchaseEvent APIs for “Purchase completed” and “In-app purchase completed” respectively to pass the conversion value and the purchased items.

  • The conversion value (value) must be the same as the payment amount (payAmount) of the purchased items (items).
  • If only the purchased items are passed in case payment is made in USD, the conversion value (conversion sales) is calculated using the currency code (ext1) and payment amount (payAmount) in the platform.

Assume that the following items are purchased.

Unit priceQuantityTotal price
item11001100
item22002400
item33003900

iOS

// Add currency information to “ext1”. “KRW” can be omitted.
let items = [
NTrackerConversionItem(quantity: 1, payAmount: 100, id: "item1", ext1: "KRW"),
NTrackerConversionItem(quantity: 2, payAmount: 400, id: "item2", ext1: "KRW"),
NTrackerConversionItem(quantity: 3, payAmount: 900, id: "item3", ext1: "KRW")
]

// When passing both the conversion value and purchased items
NTrackerExt.trackPurchaseEvent(value: 1_400, items: items)

// When passing only the purchased items: the conversion value is calculated as payAmount of all items, which is 1,400 KRW.
NTrackerExt.trackPurchaseEvent(items: items)

// When passing only the conversion value
NTrackerExt.trackPurchaseEvent(value: 1_400)

Android

// Add currency information to “ext1”. “KRW” can be omitted.
val items = arrayOf(
NTrackerConversionItem(1, 100.0, "item1", null, null, "KRW"),
NTrackerConversionItem(2, 400.0, "item2", null, null, "KRW"),
NTrackerConversionItem(3, 900.0, "item3", null, null, "KRW")
)

// When passing both the conversion value and purchased items
NTrackerExt.trackPurchaseEvent(1_400, items)

// When passing only the purchased items: the conversion value is calculated as payAmount of all items, which is 1,400 KRW.
NTrackerExt.trackPurchaseEvent(items)

// When passing only the conversion value
NTrackerExt.trackPurchaseEvent(1_400)

Send “In-app purchase completed” event

You can send the “In-app purchase completed” event in a similar way to the “Purchase completed” event.

The following examples show how to send the event using the products and purchase data provided by each OS. See the examples for what to specify in NTrackerConversionItem for your service.

iOS

The following code example sends the “In-app purchase completed” event using SKProduct and SKPaymentTransaction.

func sendIAP(product: SKProduct, transaction: SKPaymentTransaction) {
let quantity = transaction.payment.quantity
let payAmount = product.price.doubleValue
let itemId = product.productIdentifier
let itemName = product.localizedTitle
let currency = product.priceLocale.currencyCode

let ntrackerItem = NTrackerConversionItem(quantity: quantity, payAmount: payAmount, id: itemId, name: itemName, ext1: currency)

NTrackerExt.trackInAppPurchaseEvent(items: [ntrackerItem])
}

Android

The following code example sends the “In-app purchase completed” event using ProductDetails and Purchase. The class to provide the product and purchase information can be different depending on BillingClient. This document is based on BillingClient 5.

fun sendIAB(purchase: Purchase, product: ProductDetails) {
val quantity = purchase.quantity
val itemId = product.productId
val itemName = product.name
val payAmount = product.oneTimePurchaseOfferDetails.priceAmountMicros / 1_000_000
val currency = product.oneTimePurchaseOfferDetails.priceCurrencyCode

val ntrackerItem = NTrackerConversionItem(quantity, payAmount.toDouble(), itemId, itemName, null, null, currency)
NTrackerExt.trackInAppPurchaseEvent(arrayOf(ntrackerItem))
}

Send general events with items not included

To send general events except for “Purchase completed” and “In-app purchase completed”, with items not included, you need to pass the event name and value.

iOS

// When sending the “Subscribe” event with the conversion value of 1,000 KRW
NTrackerExt.trackConversionEvent(NTrackerConversionEvent.Subscribe, value: 1_000)

Android

// When sending the “Subscribe” event with the conversion value of 1,000 KRW
NTrackerExt.trackConversionEvent(NTrackerConversionEvent.Subscribe, 1_000)

Send general events with items included

You can send general events with items included. For example, you can send the “Added to cart” event along with the items in the cart. Note that if only payAmount under items is passed, the conversion value is reported as 0 in NAVER Performance DA. The payAmount information under items is used only for the “Purchase completed” and “In-app purchase completed” events.

iOS

let items = [
NTrackerConversionItem(quantity: 1, payAmount: 100, id: "item1", ext1: "KRW"),
NTrackerConversionItem(quantity: 2, payAmount: 400, id: "item2", ext1: "KRW")
]

// Pass the items in the cart as well.
NTrackerExt.trackConversionEvent(NTrackerConversionEvent.Cart, value: 900, items: items)

Android

val items = arrayOf(
NTrackerConversionItem(1, 100.0, "item1", null, null, "KRW"),
NTrackerConversionItem(2, 400.0, "item2", null, null, "KRW")
)

// Pass the items in the cart as well.
NTrackerExt.trackConversionEvent(NTrackerConversionEvent.Cart, 900, items)

Send custom events

If you need a conversion event that is not predefined, use a “custom” event. You can use 1-10 custom events as needed. For a custom event, you should pass the event name and value in the same way as general events.

iOS

// When sending a custom event with the conversion value of 1,000 KRW
NTrackerExt.trackConversionEvent(NTrackerConversionEvent.CustomEvent001, value: 1_000)

Android

// When sending a custom event with the conversion value of 1,000 KRW
NTrackerExt.trackConversionEvent(NTrackerConversionEvent.CustomEvent001, 1_000)