Skip to content

Latest commit

 

History

History
87 lines (59 loc) · 4.4 KB

GettingStarted.md

File metadata and controls

87 lines (59 loc) · 4.4 KB

Getting Started with Appcues Android SDK

Initialize the SDK and track events.

Initializing the SDK

An instance of the Appcues Android SDK (Appcues) should be initialized when your app launches. A lifecycle method such as the Application onCreate would be a common location:

override fun onCreate() {
    super.onCreate()
    appcues = Appcues(this, APPCUES_ACCOUNT_ID, APPCUES_APPLICATION_ID)
}

Initializing the SDK requires you to provide two values, an Appcues account ID, and an Appcues mobile application ID. These values can be obtained from your Appcues settings.

An additional optional parameter can also be provided to customize the behavior of the SDK using the AppcuesConfig. For example, setting the logging level:

override fun onCreate() {
    super.onCreate()
    appcues = Appcues(this, APPCUES_ACCOUNT_ID, APPCUES_APPLICATION_ID) {
        loggingLevel = LogginLevel.DEBUG
    }
}

Managing Users

In order to target content to the right users at the right time, you need to identify users and send Appcues data about them. A user is identified with a unique ID.

// identify a known user
appcues.identify(userId, properties)

For more detail about session management and anonymous user tracking, refer to Identifying and Managing Users.

Tracking Screens and Events

Events are the “actions” your users take in your application. Screens are a special type of event to capture a user viewing a specific screen. Once you’ve installed and initialized the Appcues Android SDK, you can start tracking screens and events using the following methods:

// track a custom event
appcues.track(name, properties)

// track a screen view
appcues.screen(title, properties)

A screen should be tracked each time the screen appears to the user, for example in an Activity or Fragment:

override fun onResume() {
    super.onResume()
    appcues.screen("Screen Name")
}

The Appcues Android SDK supports basic automatic screen tracking for Activities. This will report a screen view using the Activity label value as the screen title, each time a new Activity starts. To enable this automatic screen tracking, call trackScreens().

Anchored Tooltips

Anchored tooltips use element targeting to point directly at specific views in your application. For more information about how to configure your application's views for element targeting, refer to the Anchored Tooltips Guide.

Embedded Experiences

Add AppcuesFrameView instances in your application layouts to support embedded experience content, with a non-modal presentation. For more information about how to configure your application layouts to use frame views, refer to the guide on Configuring an AppcuesFrameView.

Debugging

See Configuring the Appcues URL Scheme for setup instructions and then refer to Refer to the Debug Guide for usage details.

Observing Analytics

See Observing Analytics for information about how to listen to analytics tracking data being reported by the Appcues SDK, including uses cases for integrating with other Analytics tracking packages.

Google Play Dependencies

The Appcues Android SDK includes a dependency on the Google Play In-App Review libraries. This dependency allows for building experiences that can request a Play Store in-app review. If your application is not distributed through Google Play, or you otherwise want to opt out of this dependency and the in-app review capability in Appcues, you can update your build.gradle dependency as shown below.

implementation('com.appcues:appcues:<latest_version>') {
    exclude group: 'com.google.android.play', module: 'review'
    exclude group: 'com.google.android.play', module: 'review-ktx'
}