Quick start guide for Android
This page describes essential information to integrate the NAVER App Tracking SDK into Android apps. For more information, see How to integrate the SDK.
Prerequisites
Before you begin, check the following requirements:
- The SDK supports Android 5.0 (API level 21) or later.
- To integrate the SDK, you need a “site ID.” For more information, see Get a site ID.
Install the SDK
The SDK has dependencies on the following libraries.
dependencies {
implementation 'com.google.android.gms:play-services-appset:16.0.2'
implementation 'com.android.installreferrer:installreferrer:2.2'
}
Installing the SDK requires the following permissions.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Add the following dependency configuration in the Gradle dependencies block.
dependencies {
implementation 'com.navercorp.ntracker:NTrackerSDKExt:version name'
}
Configure and initialize the SDK
Follow the instructions below to configure and initialize the SDK.
- Initialize the SDK using the
configure
API inonCreate
of the Application class. - Set whether to display debug logs in the Logcat console using the
enableDebugLog
API. - Set the server environment using
phase
. - When you publish your app on the app store, the phase must be set to
Release
, and whether to display logs tofalse
.
class App: Application() {
override fun onCreate() {
super.onCreate()
NTrackerExt.enableDebugLog(true)
NTrackerExt.configure(applicationContext, siteId, NTrackerExtPhase.DEBUG)
}
}
For more information, see Configure and initialize the SDK in How to integrate the SDK.
Set funnels
You can collect funnel data for app conversions that occur through an App Link or Custom URL Scheme for more accurate conversion tracking.
- Collect funnel data using the
setInflow
API. - To measure conversion tracking through NAVER Ads, use the
setInflow
API to collect URL information. If you use a deep link provided by a third party’s tracker, you need to pass the URL information as it is using thesetInflow
API before it is processed by the tracker.
class SampleActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
handleIntent(intent)
// Your Codes.
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleIntent(intent)
// Your Codes.
}
private fun handleIntent(intent: Intent?) {
if (intent == null) {
return
}
val appLinkAction = intent.action
val appLinkData: Uri? = intent.data
if (Intent.ACTION_VIEW == appLinkAction) {
NTrackerExt.setInflow(appLinkData)
}
// Your Codes.
}
}
The implementation code will vary depending on your app or project configuration. For more information, see Set funnels in How to integrate the SDK.
Send conversion events
The SDK collects various conversion events.
- The “App installed” and “App launched” events are automatically collected.
- The “Purchase completed” event is collected using
trackPurchaseEvent
, and the “In-app purchase completed” event usingtrackInAppPurchaseEvent
. - Other general events are collected using
trackConversionEvent
.
// 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)
The general event names are defined in NTrackerConversionEvent
.
NTrackerExt.trackConversionEvent(NTrackerConversionEvent.Subscribe, 10_000)
For more information, see Send conversion events in How to integrate the SDK.