Apple Watch Extensions for Flurry Analytics

Flurry Analytics provides support for Apple Watch extensions on iPhone apps with analytics related to New Users, Active Users and Custom Eventing.

Enable Extensions

To get started tracking Events and comparing usage between your app and its Apple Watch extension, follow these steps:

  1. For any iPhone app in your portfolio, navigate to the Manage > App Info page (red arrow shown below) and click the Get watch extension key button (green arrow). An Extension Key is generated and presented in place of the button.

watch extension key
  1. Download the latest Flurry from Yahoo iOS SDK and load it into your Xcode project, replacing the existing Flurry SDK.
  2. In your Xcode project, open the plist and include a key for the Flurry Watch API Key. This should include the Watch Extension Key created via the process described above.

plist watchkey

(For information on why you need to store watch properties in a plist, see the section below.)

Important: Use caution when entering API Keys and Watch Extension Keys into your app code. The incorrect placement of keys will result in invalid metrics.

  1. Optionally configure these additional keys:
  • Flurry Watch App Version. The version of the your app.
  • Flurry Watch Event Threshold. The maximum time a watch session can exist before being sent to the server. Note that the default value for this is 10 events. There is also a minimum threshold of 5 events and a maximum of 50 events that are limits on this property.
  • Flurry Watch Duration Threshold. The maximum number of events that will be recorded in a watch session before being sent to the server. The default value for this property is 10 minutes. 5 minutes is the minimum and 60 minutes is the maximum.
  • Flurry Watch Debug. Set this to YES to enable debug logs as shown below.

watch debug
  1. In the watch extension, include the FlurryWatch.h file. This provides you with access to the following watch-related log event methods:

These methods behave much like their counterparts in Flurry.h, but are intended for use only in a watch extension.

Note: When setting up a WatchKit extension, the library and frameworks required for Flurry Analytics must also be included in the Linked Frameworks and Libraries for the watch extension target.

Specifically:

  • libFlurry.a
  • Security.framework
  • SystemConfiguration.framework

Code Examples

The following is the example code you use for your implementation, using either Obj-C or Swift.

For Objective-C:

To integrate with Swift apps:

  • Follow the steps listed under the Integrate with Swift applications subsection in the Introduction section.
  • In addition to Flurry.h, also import FlurryWatch.h into the bridge header file.
  • Use the analogous Swift calls to log events.

For Swift:

Apple Watch Metrics

Metrics for the Apple Watch appear in the following places inside the parent app on on the Flurry portal:

Apple Watch Metrics Description
New User A new line appears on the New Users chart, displaying the count of new Watch devices for comparison to the New Users for the parent app.
Usage Active Users A new line appears on the Active Users chart, displaying the count of unique watch devices active during the selected interval for comparison to the Active Users for the parent app.
Extension Events A new section provides metrics related to the Events instrumented within the Watch extension. For a detailed description of the metrics, refer to Extension Events.

Storing watch properties in a plist

Unlike a standard iOS app, which has a single point of entry (AppDelegate), WatchKit extensions have multiple points of entry. InterfaceControllers, NotificationControllers, and GlanceControllers can all be called without going through a common piece of code.

To avoid having to repeatedly set these values in every WKInterfaceController, they are set in one place.

Watch sessions behave differently due to the nature of the WKInterfaceController lifecycles. There is no clear indication of when a user has stopped using the watch. With the flip of a wrist they can start and stop watch interactions.

To avoid creating large numbers of miniscule sessions, Flurry keeps sessions alive until they reach a particular duration or event-based thresholds. Once the thresholds are reached, the session ends and a new session begins on the next event.