Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Analytics framework for iOS
Objective-C Other

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
providers
AnalyticsKit.h
AnalyticsKit.m
AnalyticsKit.vendorspec
AnalyticsKitApsalarProvider.h
AnalyticsKitApsalarProvider.m
AnalyticsKitDebug.h
AnalyticsKitDebug.m
AnalyticsKitFlurryProvider.h
AnalyticsKitFlurryProvider.m
AnalyticsKitLocalyitcsProvider.h
AnalyticsKitLocalyitcsProvider.m
AnalyticsKitTestFlightProvider.h
AnalyticsKitTestFlightProvider.m
MIT-LICENSE
README.md

README.md

AnalyticsKit : an analytics provider wrapper for iOS

INTRODUCTION

The goal of AnalyticsKit is to provide a consistent API for analytics regardless of which analytics provider you're using behind the scenes.

The benefit of using AnalyticsKit is that if you decide to start using a new analytics provider, or add an additional one, you need to write/change much less code!

If you have additions or enhancements please submit pull requests.

AnalyticsKit works both in ARC based projects and non-ARC projects.

INCLUDED PROVIDERS

  • TestFlight
  • Localytics
  • Flurry
  • Apsalar

USAGE

  1. Download the provider's SDK and add it to your project

  2. Add AnalyticsKit to your project either as a git-submodule or copying the source into your project. In Xcode only include AnalyticsKit.m and AnalyticsKit.h and any providers you plan to use

  3. In your AppDelegate's applicationDidFinishLaunchingWithOptions (or in a method called from there), create an AnalyticsKit*Provider (where * is the provider); add it to your loggers array; and call initializeLoggers

// Create the AnalyticsKitApsalarProvider
NSString *apsalarKey = @"myAPIKey";
NSString *apsalarSecret = @"mySecret";

//if you don't want your simulator activity to be logged, use bogus keys. We prefer this approach to not inlcuding the provider in simulator builds so that the code running in the simulator is as close as possible to the code running on the device.
#if (TARGET_IPHONE_SIMULATOR)
    apsalarKey = @"XXXXXXXXXXXXXXXXXXXX";
    apsalarSecret = @"XXXXXXXXXXXXXXXXXXXX";
#endif

NSMutableArray *loggers = [NSMutableArray arrayWithObject:[[AnalyticsKitApsalarProvider alloc] initWithAPIKey:apsalarKey andSecret:apsalarSecret andLaunchOptions:launchOptions]];

//if you are using more than one analytics provider, create as many AnalyticsKit*Providers as you need,
//and add them to loggers array

[AnalyticsKit initializeLoggers:loggers];
  1. Where significant events occur, call AnalyticsKit logEvent: or other appropriate method. Example:
[AnalyticsKit logEvent:@"Notifications - Displaying Webview For Notification" withProperties:eventDict];
  1. You may also want to make AnalyticsKit calls at application lifecycle events, such as applicationDidEnterBackground, applicationWillTerminate, applicationWillEnterForeground

See AnalyticsKit.h for an overview of the methods available. Doublecheck that the methods you call are implemented in the AnalyticsKit*Provider.m that you are using!

Something went wrong with that request. Please try again.