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.
To get started tracking Events and comparing usage between your app and its Apple Watch extension, follow these steps:
- 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.
- Download the latest Flurry from Yahoo iOS SDK and load it into your Xcode project, replacing the existing Flurry SDK.
- 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.
(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.
- 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.
- In the watch extension, include the
FlurryWatch.hfile. 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.
The following is the example code you use for your implementation, using either Obj-C or Swift.
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.
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.