Latest 1.0.5
Homepage https://github.com/data-cortex/cortex-ios-sdk
License MIT
Platforms ios 7.0, requires ARC
Authors ,

cortex-ios-sdk

Data Cortex iOS SDK

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

cortex-ios-sdk is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "DataCortex"

Make sure you include the following in your Info.plist

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
   <key>api.data-cortex.com</key>
   <dict>
    <key>NSTemporaryThirdPartyExceptionRequiresForwardSecrecy</key>
    <false/>
   </dict>
  </dict>
</dict>

Initializing the library

Generally you initialize the library in your AppDelegate.m file.
application:willFinishLaunchingWithOptions:

#import <DataCortex/DataCortex.h>

#define DC_API_KEY @"YOUR_API_KEY"
#define DC_ORG @"your_org_name"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

  // Initialize the library with your DC_API_KEY
  [DataCortex sharedInstanceWithAPIKey:YOUR_API_KEY forOrg:DC_ORG];

  // To get your instance later
  DataCortex *dc = [DataCortex sharedInstance];

//...

}

You can also specify your DAU tracking time zone, otherwise we assume UTC.

  // Initialize the library with your DC_API_KEY
  [DataCortex sharedInstanceWithAPIKey:YOUR_API_KEY
                                forOrg:DC_ORG
                           dauTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"PST"]];

User tracking

If you have a user ID or other identifier you track users by, add this to
Data Cortex to aggregate the user’s usage across multiple devices and platforms.

  DataCortex *dc = [DataCortex sharedInstance];

  // User identified by Numeric ID
  [dc setUserTag:@1234];
  // User identified by unique string
  [dc setUserTag:@"xzy123"];

Event Tracking

Event tracking is the bulk of the ways you’ll use the Data Cortex SDK. Please
refer to your tracking specification for the parameters to use in each event.

  DataCortex *dc = [DataCortex sharedInstance];

  // With all taxonomy
  [dc eventWithProperties:@{
    @"kingdom": @"kingdom",
    @"phylum": @"phylum",
    @"class": @"class",
    @"order": @"order",
    @"family": @"family",
    @"genus": @"genus",
    @"species": @"species",
  }];

  // With all taxonomy and floats
  [dc eventWithProperties:@{
    @"kingdom": @"kingdom",
    @"phylum": @"phylum",
    @"class": @"class",
    @"order": @"order",
    @"family": @"family",
    @"genus": @"genus",
    @"species": @"species",
    @"float1": @123,
    @"float2": @1.5,
    @"float3": @100000,
    @"float4": @0.0,
  }];

Economy tracking

Economy tracking is very similar to event tracking but adds a few extra
required elements. Specifically spendAmount and spendCurrency. It also
adds an optional spendType.

  DataCortex *dc = [DataCortex sharedInstance];

  [dc economyWithProperties:@{
      @"kingdom": @"kingdom",
      @"phylum": @"phylum",
      @"class": @"class",
      @"order": @"order",
      @"family": @"family",
      @"genus": @"genus",
      @"species": @"species",
    }
    spendAmount: @9.99
    spendCurrency: @"USD"
    spendType: @"coinPurchase"
  }];

  [dc economyWithProperties:@{
      @"kingdom": @"buildings",
      @"phylum": @"barn",
      @"class": @"red",
    }
    spendAmount: @10
    spendCurrency: @"coins"
  }];

Latest podspec

{
    "name": "DataCortex",
    "version": "1.0.5",
    "summary": "Data Cortex iOS SDK",
    "description": "iOS SDK to interact with Data Cortex.",
    "homepage": "https://github.com/data-cortex/cortex-ios-sdk",
    "license": "MIT",
    "authors": {
        "Yanko Bolanos": "[email protected]",
        "Jim Lake": "[email protected]"
    },
    "source": {
        "git": "https://github.com/data-cortex/cortex-ios-sdk.git",
        "tag": "1.0.5"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "public_header_files": "Pod/Classes/**/*.h"
}

Pin It on Pinterest

Share This