Configure and initialize the SDK
To check logs of the SDK, call the enableDebugLog
API. Debug logs are displayed only in the development environment, and must not in the release environment. If this API is not called, the default setting is “false,” meaning debug logs are not displayed by default.
Use the configure
API to initialize the SDK. This API uses a site ID that is issued from NAVER Performance DA and the environment (phase) of the server to send logs to, as parameters. If the phase is “Debug,” logs are not applied to the server’s indicators. You can check whether debug logs are sent to the server in your IDE console.
- iOS: Search for a string that starts with “[ntracker]”
- Android: Search with Log Tag “NTracker”
Before publishing your app on the app store, you must set the phase to “Release” to get more accurate indicators. If not specified, the phase is set to “Release” by default.
Note
If the
configure
API is not called, no events are sent to the server. If you want to temporarily disable the SDK, or want to stop sending events for certain app versions, do not call theconfigure
API.
iOS
Initialize the SDK in AppDelegate
.
import NTrackerSDKExt
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
// Set whether to display debug logs. Make sure to set this to false before publishing the app.
NTrackerExt.enableDebugLog(true)
// Send logs with the phase set as debug. Make sure to set this to release before publishing the app.
NTrackerExt.configure(serviceID: serviceID, phase: .debug)
return true
}
}
Android
Initialize the SDK in onCreate
of the Application class.
import com.navercorp.ntracker.ntrackersdk.NTrackerExt
import com.navercorp.ntracker.ntrackersdk.NTrackerExtPhase
class App: Application() {
override fun onCreate() {
super.onCreate()
// Set whether to display debug logs. Make sure to set this to false before publishing the app.
NTrackerExt.enableDebugLog(true)
// Send logs with the phase set as debug. Make sure to set this to release before publishing the app.
NTrackerExt.configure(applicationContext, siteId, NTrackerExtPhase.DEBUG)
}
}