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

Event Tracking - iOS SDK

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

This developer guide describes how to measure events in your app using the Google Analytics SDK for iOS v2.

Overview

Events are a useful way to collect data about a user's interaction with interactive components of your app, like button presses or the use of a particular item in a game.

An event consists of four fields that you can use to describe a user's interaction with your app content:

  • NSString Category
  • NSString Action
  • NSString Label
  • NSNumber (Optional) Value, interpreted as 64-bit integer

Implementation

To send an event, call sendEventWithCategory:withAction:withLabel:withValue:. For example, you could measure a button press with the following code:

[tracker sendEventWithCategory:@"uiAction"
                    withAction:@"buttonPress"
                     withLabel:buttonName
                     withValue:[NSNumber numberWithInt:100]];