Important: This document describes a legacy version of the SDK. New users should use the latest SDK.

Screens - Android SDK

This document provides an overview of screens and how to measure screen views using the Google Analytics SDK for Android v3.

Overview

Screens in Google Analytics represent content users are viewing within your app. The equivalent concept in web analytics is a pageview. Measuring screen views allows you to see which content is being viewed most by your users, and how they are navigating between different pieces of content.

A screen view consists of a single string field that will be used as the screen name in your Google Analytics reports:

Field Name Tracker Field Type Required Description
Screen Name Fields.SCREEN_NAME String Yes The name of an application screen.

Screen view data is used primarily in the following standard Google Analytics reports:

  • Screens report
  • Engagement Flow

Manual Screen Measurement

To manually send a screen view, set the screen field values on the tracker, then send the hit:

// May return null if EasyTracker has not yet been initialized with a property
// ID.
Tracker easyTracker = EasyTracker.getInstance(this);

// This screen name value will remain set on the tracker and sent with
// hits until it is set to a new value or to null.
easyTracker.set(Fields.SCREEN_NAME, "Home Screen");

easyTracker.send(MapBuilder
    .createAppView()
    .build()
);

Automatic Screen Measurement (EasyTracker)

EasyTracker can automatically measure screen views each time an app's Activities is displayed to a user.

To enable automatic Activity measurement:

  1. Add EasyTracker methods to all of your Activities
  2. Set the ga_autoActivityTracking parameter in your analytics.xml file.
  3. Give each of your Activities a screen name in your analytics.xml file.

Here's an example snippet from an analytics.xml file once automatic Activity measurement has been enabled:

<-- Enable automatic Activity measurement -->
<bool name="ga_autoActivityTracking">true</bool>

<-- The screen names that will appear in reports -->
<string name="com.example.app.BaseActivity">Home</string>
<string name="com.example.app.PrefsActivity">Preferences</string>