Hide

User Timings - iOS SDK

This document provides an overview of measuring user timings using the Google Analytics SDK for iOS 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:

  • NSString Category - the category of the timed event
  • NSTimeInterval Interval - the timing measurement in seconds
  • NSString (Optional) Name - the name of the timed event
  • NSString (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 sendTimingWithCategory:withTimeInterval:withName:withLabel 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:

- (void)onLoad:(NSTimeInterval *)loadTime {
    [tracker sendTimingWithCategory:@"resources"
                            withTimeInterval:loadTime
                                    withName:@"high scores"
                                   withLabel:nil];
    ... // The rest of your onLoad: code.
}