This document describes a legacy version of the Android SDK. If your new to Analyitcs, use the latest SDK. Learn more

User Timings - Android SDK v2 (Legacy)

Stay organized with collections Save and categorize content based on your preferences.

This document provides an overview of measuring user timings using the Google Analytics SDK for Android v2.

Overview

Measuring user timings provides a native way to measure a period of time in Google Analytics. This can be useful to measure resource load times, for example.

A timing in Google Analytics consists of the following fields:

  • String Category - the category of the timed event
  • long Interval - the timing measurement in milliseconds
  • String (Optional) Name - the name of the timed event
  • String (Optional) Label - the label of the timed event

User timing data can be found primarily in the User Timings report.

Implementation

To send a user timing to Google Analytics, call sendTiming() and provide the timing interval as well as a category. In the following example, we assume that onLoad() is called after some resource finishes loading, in this case a list of high scores for a game:

public void onLoad(long loadTime) {
  // Where myTracker is an instance of Tracker.
  myTracker.sendTiming(loadTime, "resources", "high_scores", null);
  ... // The rest of your onLoad code.
}