Measuring Apple Watch Events

Because users can launch Apple Watch apps independently of the “main” iOS app (running on the iOS device to which the Apple Watch is paired), it is necessary to integrate MobileAppTracker (MAT) in both AppDelegate and WKInterfaceController.

The watch app sessions and events are measured as part of the parent iOS app, so the same param values for — advertiser id, conversion key and package name — are to be used for the watch app MAT integration.

Initialize MobileAppTracker

To configure session and event measurement with your Apple Watch app extension, first initialize MobileAppTracker in AppDelegateapplicationDidFinishLaunching: and WKInterfaceController awakeWithContext:, as shown in the following code sample.

// sample code to initialize MobileAppTracker
[MobileAppTracker initializeWithMATAdvertiserId:MAT_ADVERTISER_ID
// [MobileAppTracker setDebugMode:YES];
[MobileAppTracker setDelegate:self];

The last call to MobileAppTracker “setDelegate” method is the one to receive the delegate responses moving forward. For more info please refer Reading Server Responses.

Measure Sessions

Each time a user launches an Apple Watch app, call “measureSession” in AppDelegate applicationDidBecomeActive: andWKInterfaceController willActivate, as shown in the following code sample.

// measure app session
[MobileAppTracker measureSession];

Measure Events

To measure a specific event of interest, you can optionally call “measureEvent” as shown in the following code sample. Notice the inclusion of event.attribute5 = @”watch” to indicate this event is watch-specific.

// measure event, e.g. "purchase", "levelChanged"
MATEvent *event = [MATEvent eventWithName:@"anEventOnWatch"];
event.attribute5 = @"watch";
[MobileAppTracker measureEvent:event];