Skip to content

Official iOS client for the Keen IO API. Build analytics features directly into your iOS apps.

License

Notifications You must be signed in to change notification settings

Sependa/KeenClient-iOS

 
 

Repository files navigation

Keen IO iOS SDK

Build Status

The Keen IO iOS client is designed to be simple to develop with, yet incredibly flexible. Our goal is to let you decide what events are important to you, use your own vocabulary to describe them, and decide when you want to send them to Keen IO.

API Documentation

Client Documentation

Installation

Use cocoapods to install! Just add a line to your Podfile like so:

pod 'KeenClient'

Then run

pod install
Build Settings

Make sure to add CoreLocation.framework to the "Link Binary with Libraries" section.

Also enable the "-ObjC" linker flag under "Other Linker Flags".

Voila!

For other methods, see our detailed documentation here.

Usage

To use this client with the Keen IO API, you have to configure your Keen IO Project ID and its access keys (if you need an account, # here - it's free).

Register Your Project ID and Access Keys
- (void)applicationDidBecomeActive:(UIApplication *)application
{
    [KeenClient sharedClientWithProjectId:@"your_project_id" andWriteKey:@"your_write_key" andReadKey:@"your_read_key"];
}

The write key is required to send events to Keen IO - the read key is required to do analysis on Keen IO.

Add Events

Use the client like so:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    NSDictionary *event = [NSDictionary dictionaryWithObjectsAndKeys:@"first view", @"view_name",
                           @"going to", @"action", nil];
    [[KeenClient sharedClient] addEvent:event toEventCollection:@"tab_views" error:nil];
}
Upload Events to Keen IO

Adding events just stores the events locally on the device. You must explicitly upload them to Keen IO. Here's an example:

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    UIBackgroundTaskIdentifier taskId = [application beginBackgroundTaskWithExpirationHandler:^(void) {
        NSLog(@"Background task is being expired.");
    }];

    [[KeenClient sharedClient] uploadWithFinishedBlock:^(void) {
        [application endBackgroundTask:taskId];
    }];
}
Do analysis with Keen IO
TODO

That's it! After running your code, check your Keen IO Project to see the event has been added.

Changelog

3.2.1
  • Changed project token -> project ID.
  • Added support for read and write scoped keys.
  • Added support for travis.

To Do

  • Support analysis APIs.
  • Native iOS visualizations.

Questions & Support

If you have any questions, bugs, or suggestions, please report them via Github Issues. Or, come chat with us anytime at users.keen.io. We'd love to hear your feedback and ideas!

Contributing

This is an open source project and we love involvement from the community! Hit us up with pull requests and issues.

About

Official iOS client for the Keen IO API. Build analytics features directly into your iOS apps.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 98.4%
  • C 1.1%
  • Shell 0.5%