Google Analytics

User Timings - Android SDK v4

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

  1. Overview
  2. Implementation

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.

User timings have the following fields:

Field Name Tracker Field Type Required Description
Category Fields.TIMING_CATEGORY String Yes The category of the timed event
Value Fields.TIMING_VALUE long Yes The timing measurement in milliseconds
Name Fields.TIMING_VAR String No The name of the timed event
Label Fields.TIMING_LABEL String No 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, build a timing hit using TimingBuilder and send it.

        // Get tracker.
        Tracker t = ((AnalyticsSampleApp) getActivity().getApplication()).getTracker(
            TrackerName.APP_TRACKER);

        // Build and send timing.
        t.send(new HitBuilders.TimingBuilder()
            .setCategory(getTimingCategory())
            .setValue(getTimingInterval())
            .setVariable(getTimingName())
            .setLabel(getTimingLabel())
            .build());

See Advanced Configuration for details on the getTracker method.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.