Screens

Screens are the content that your users view in your app. Measuring screen views helps you to understand what is more engaging for your users.

Add the SDK

  • ​Before your begin, make sure that Apptics is integrated into your project by following the Integration Guide.
  • Declaring analytics dependency using Apptics BoM.
Copieddependencies {
  // ...

  // Apptics BoM, latest version is mentioned in the integration guide.
  implementation platform('com.zoho.apptics:apptics-bom:[latest-version]')
  
  // Since BoM version is specified, no need to explicitly specify the dependency version.
  implementation 'com.zoho.apptics:apptics-analytics'

}
  • Alternatively, if you do not use Apptics BoM you can directly declare the analytics dependency with its version.
Copieddependencies {
   // Have to explicitly mention the version, if you are not using BoM.
   // latest version is mentioned in the integration guide.
   implementation 'com.zoho.apptics:apptics-analytics:[latest-version]'
}

Note: It is recommend to use Apptics BoM to avoid unnecessary compatibility issues.

  • Initialize analytics in Application onCreate() method.​
CopiedApptics.init(this)

Automatic activity and fragment tracking

Activity and fragment traversals are tracked automatically on initializing the Apptics.

Fragments will be automatically tracked only if Apptics is initialized early in the Activity lifecycle in the onCreate() method.

You can opt-out from automatically tracking the activity by setting the automaticActivityTrackingStatus and automaticFragmentTrackingStatus in Apptics. 

Make sure to disable them before initializing Apptics.

CopiedAppticsAnalytics.automaticFragmentTrackingStatus = false
AppticsAnalytics.automaticActivityTrackingStatus = false
Apptics.init(this)

Manual screen tracking

You can log screens manually using inScreen and outScreen methods in AppticsScreenTracker end point.

Copiedval trackerId = AppticsScreenTracker.inScreen("ScreenName")

AppticsScreenTracker.outScreen(trackerid)

Call inScreen with screen name to mark that the screen is presented or visible to the user.

'inScreen' method returns a tracking id, which should be passed to 'outScreen' to mark that the screen is dismissed or not visible to the user anymore.