Installing UserReport SDK to Android Application

This guide will walk you through how to install UserReport survey tool on your native Android app.

Please notice that it is a technical guide and therefore it is targeted to developers.

Before proceeding with this guide, you need to configure as “ Android app” your media in UserReport interface. You can do this by going to the media settings and adding a new media.  When asked on which media you want to run UserReport please select Android app.


Once this is done, you will find the two SDK initializations parameters that will be needed to configure UserReport in-app code:  the SAK_ID (to identify your account) and the MEDIA_ID (to identify your app).


Adding UserReport SDK to your app

Add dependencies to app/build.gradle.

1. Add dependencies to app/build.gradle

 apply plugin: ''

dependencies {

    compile ""
    compile "com.audienceproject:userreport:0.+"
    compile ""


android {

    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {

        applicationId "com.userreport.example.myapplication"
        minSdkVersion 21
        targetSdkVersion 22

        versionCode 1

        versionName "1.0"




2. Add permissions to app/src/main/AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="" package="com.mixpanel.example.myapplication" > 
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" >
        <activity android:name=".MainActivity" android:label="@string/app_name" >
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />



3. Add UserReport to your main activity app/src/main/java/com/userreport/example/myapplication/

package com.mixpanel.example.myapplication;

import android.os.Bundle;
import com.audienceproject.UserReport;

public class MainActivity extends ActionBarActivity {
    protected void onCreate(Bundle savedInstanceState) {

        String sakId = YOUR_SAK_ID; // eg: "yourcompany" 
        String mediaId = YOUR_MEDIA_ID; // eg: "b2a408cb-719d-4468-a943-1187201d1ccb" 

        new UserReportBuilder(sakId, mediaId)


User identification parameters

If you want to send user identification parameter you can do it in following way:

new UserReportBuilder(ACCOUNT_ID, MEDIA_ID)
    .setUserInfo(UserIdentificationType.EmailSha256, "87924606b4131a8aceeeae8868531fbb9712aaa07a5d3a756b26ce0f5d6ca674")

 Please notice that you always need to send hashed emails.

Invitation rules

By default, users are eligible for an invitation after spending in application X minutes and total Y screen-views. The screen view is an activity start inside your app, when a user becomes eligible for invitation in Z seconds from application session started we will check if the user can be invited:

  • Is the survey enabled for this media?
  • Is the current user not in the UserReport quarantine?

If answers on both questions and on the invitation frequency selected in UserReport interface, the user will or won't be invited to the survey.

When the invitation is shown - we put the user to quarantine so he or she will be not invited again and again. Depending on what action the user will perform in invitation – the quarantine period will last for a different span of time. Here you can find detailed information on quarantine rules applied.


During development, it is very important to set test mode on. It will guarantee that pop up will appear each time when invite conditions met (X minutes and total Y screen-views). You can do it in the following way 

new UserReportBuilder(ACCOUNT_ID, MEDIA_ID)

Automatically measure activity state changes as page views

If you want to automatically measure Activity State Changes as page views, use the UserReportBuilder with the default provided invoker, the StandardInvoker class.

new UserReportBuilder(YOUR_SAK_ID, YOUR_MEDIA_ID)
new StandardInvoker(context, this.getSettingsLoader(context), prefWrapper)

Manually measure any kind of event as a screen view

To manually register any kind of event as a screen view, use the UserReportBuilder with the ManualEventSurveyInvoker class. This class allows you to increment the view counter on any kind of custom provided event by simply calling the makeEvent() method. 

new UserReportBuilder(YOUR_SAK_ID, YOUR_MEDIA_ID)
.setSurveyInvoker(new ManualEventSurveyInvoker(5));

Alternatively, you can implement even more complex custom Invokers by implementing the ISurveyInvoker interface.

Change Settings

To update the default rules for the rendering of the survey use the UserReportBuilder with the ActivityChangesSurveyInvoker class. This invoker allows you to specify after how many view counts the survey should be invoked.

new UserReportBuilder(YOUR_SAK_ID, YOUR_MEDIA_ID)
.setSurveyInvoker(new ActivityChangesSurveyInvoker(this, 5, MainActivity.class.getName()))

You can use the skipInAppActivityChangeFor(“ActivityClassName”) method to prevent counting switches to specific activities, like for example to the main activity.

Update user information

When changing user data, you should also send the updated data to the UserReport survey instance.

this.survey.setUserInfo(UserIdentificationType.Email, "");

Manually trigger the survey based on custom parameters

If you decide to trigger the survey manually based on custom parameters, you can use the following method attached to the survey instance:



For debugging purposes, we recommend to implement ISurveyLogger and set it during initialization. Like this 

new UserReportBuilder(ACCOUNT_ID, MEDIA_ID)
    .setLogger(new someCustomLoggerImplementation())

How did we do?

Install UserReport script with Google Tag Manager

Installing UserReport SDK to iOS application