audienceproject / userreport-android-sdk

Apache License 2.0 GitHub

Brings UserReport capabilities to native Android applications

Maven Central

UserReport Android SDK

Brings UserReport capabilities to native Android applications – Surveys and Audience Measurement


  • For screen/section tracking: Android SDK 21 or higher
  • For surveying: Android SDK 24 or higher


  1. Add audienceprojct as a dependency to your project. See examples for Maven and Gradle below. Please use the latest version of SDK. version which is specified here is provided just as an example.
dependencies {
  implementation "com.audienceproject:userreport:" //though you should use the latest version
  1. Add audienceproject into the so it won't be obfuscated (app/
-keep class com.audienceproject.userreport.models.** { *; }
  1. SDK relies on AAID. It doesn't use the other parts of Google Mobile Ads and therefore does not need AdMob.



Configure the UserReport instance on Application startup, and make sure you store the instance of UserReport. See example below:

import com.audienceproject.userreport.*;

public class App extends Application {
    private UserReport userReport;

    public void onCreate() {
        userReport = UserReport.configure(this, PUBLISHER_ID, MEDIA_ID);
    public UserReport getUserReport() {
        return userReport;


At any point in time you can update user information or settings, see example below:

public void onLoggedIn(View view) {
  userReport = App.get().getUserReport();
  User newUser = new User();

Screen tracking

There are two types of tracking:

  • Screen view tracking (UserReport.trackScreenView)
  • Section view tracking (UserReport.trackSectionScreenView)

Screen view tracking

If a media (website) has one single topic, it can be tracked by using UserReport.trackScreenView.

protected void onCreate(Bundle savedInstanceState) {
  userReport = App.get().getUserReport();

  //track screen view

Section view tracking

If a website has different sections, for instance Health, World news and Local news, then it should be tracked using both UserReport.trackScreenView() and UserReport.trackSectionScreenView(sectionId). The sectionId for a particular section can be found on the Media Setting page in UserReport.

protected void onCreate(Bundle savedInstanceState) {
  userReport = App.get().getUserReport();

  //track section view (use both functions)

Automatic tracking

By default, automatic tracking is disabled.

Also, if the UserReport.trackSectionScreenView or UserReport.trackScreenView methods are invoked by your code, automatic tracking should normally not be used. However, you can enable automatic tracking by following the example below.

When using automatic activity tracking, you might want to disable it for specific screens i.e. your Settings or Login screens. This is also included in the example below.

      userReport = App.get().getUserReport();

      //enable automatic tracking (use 'false' if you don't need it)

      //do not auto-track certain activities
      ArrayList<String> skipActivities =new ArrayList<>();
      // list of other activity names can be passed here

Anonymous tracking mode

If anonymous tracking is enabled: all requests will be fired to the do-not-track domain and AAID will never be sent. To enable anonymous mode you can use following method:



cd ./Userreport-survey
gradle assemblerelease -Poutput=../.artifacts/userreport-survey-android-sdk -PbuildVersion=0