TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Sep 2015 |
Maintained by Two Bit Labs, Jim Boyd.
The goal of AnalyticsKit
is to provide a consistent API for analytics regardless of the provider. With AnalyticsKit
, you just call one logging method and AnalyticsKit
relays that logging message to each registered provider. AnalyticsKit works in both Swift and Objective-C projects
The following providers are included but not supported. YMMV.
We've had a number of problems integrating the New Relic framework into the test app, so we can't verify that events are logged correctly.
If you would like to add support for a new provider or to update the code for an existing one, simply fork the master repo, make your changes, and submit a pull request.
initializeLoggers:
. Objective-C:
Initialize AnalyticsKit in applicationDidFinishLaunchingWithOptions
AnalyticsKitFlurryProvider *flurry = [[AnalyticsKitFlurryProvider alloc] initWithAPIKey:@"[YOUR KEY]"];
[AnalyticsKit initializeLoggers:@[flurry]];
To log an event, simply call the logEvent:
method.
[AnalyticsKit logEvent:@"Log In" withProperties:infoDict];
Depending on which analytics providers you use you may need to include the following method calls in your app delegate (or just go ahead and include them to be safe):
[AnalyticsKit applicationWillEnterForeground];
[AnalyticsKit applicationDidEnterBackground];
[AnalyticsKit applicationWillTerminate];
Swift:
Import AnalyticsKit and any providers in your bridging header:
#import "AnalyticsKit.h"
#import "AnalyticsKitNewRelicProvider.h"
Initialize AnalyticsKit in application:didFinishLaunchingWithOptions:
let newRelic = AnalyticsKitNewRelicProvider(APIKey: "[YOUR KEY]")
AnalyticsKit.initializeLoggers([newRelic])
Depending on which analytics providers you use you may need to include the following method calls in your app delegate (or just go ahead and include them to be safe):
AnalyticsKit.applicationWillEnterForeground()
AnalyticsKit.applicationDidEnterBackground()
AnalyticsKit.applicationWillTerminate]()
See AnalyticsKit.h for an exhaustive list of the logging methods available.
AnalyticsKit now provides support for logging from your Apple Watch Extension.
Objective-C:
Initialize AnalyticsKit in awakeWithContext
AnalyticsKitWatchExtensionFlurryProvider *flurry = [AnalyticsKitWatchExtensionFlurryProvider new];
[AnalyticsKit initializeLoggers:@[flurry]];
To log an event, simply call the logEvent:
method.
[AnalyticsKit logEvent:@"Launching Watch App"];
Swift:
Import AnalyticsKit and any providers in your bridging header:
#import "AnalyticsKit.h"
#import "AnalyticsKitWatchExtensionFlurryProvider.h"
Initialize AnalyticsKit in awakeWithContext
let flurryLogger = AnalyticsKitWatchExtensionFlurryProvider()
AnalyticsKit.initializeLoggers([flurryLogger])
To log an event, simply call the logEvent
method.
AnalyticsKit.logEvent("Launching Watch App");