setupTrackerfunction in your main activity, only when the app is in the foreground:
app/src/main/java/com/example/app/MainActivity.java. Usually, this should be done in onCreate. If you have multiple entry points into your app, you may call this from any of them, but only the first call will be acknowledged.
thisis the application-level Context.
setUserPaid()to specify a user as a paid subscriber.
setUserLoggedIn()to specify a user as a registered user.
setUserAnonymous()to specify a user as an unregistered guest user.
trackViewcode (below) to any view you want Chartbeat to track.
viewIdthat does not conflict with other page paths from your site. Traffic for this view will then be tracked a separate page in your dashboard. For example, you can track users in your app’s table of contents by setting the
viewIdto something like
setAuthorswith an array of strings for each after calling
trackView. Any sections and authors you set will stay set until you set a different set of values. If the user is navigating from a view with sections or authors to another view with no applicable sections or authors, you should set the sections or authors to an empty array.
userInteractedfunction whenever the user interacts with your view to accurately measure user engagement with your content. Our Recommendation is to call this from within the
onUserInteractionfunction of your activity. Register writing engagement by calling the
userTypedfunction whenever the user starts typing something.
userLeftViewfunction (e.g. from your activities’ onPause functions) whenever the app leaves the foreground to stop the tracking for the current session.
pauseTrackerfunction when the user navigates to a view you don’t want to track.
trackViewagain when the app returns to the foreground.