Code Monkey home page Code Monkey logo

analytics_ios's Introduction

Kitemetrics® iOS Client SDK

The Kitemetrics® iOS Client SDK automatically logs Apple Search Ads keyword attributions, installs, and user sessions. In addition, you can log sign up and other custom events. Reports are available from http://kitemetrics.com/.

Contents

Requirements

  • iOS 8.0+
  • Xcode 9.0+
  • Objective-C or Swift 4.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build the SDK

To integrate the SDK into your Xcode project using CocoaPods, specify it in your Podfile:

platform :ios, '8.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'Kitemetrics'
end

Then, run the following command:

$ pod install

also run the following update command to ensure you have the latest version:

$ pod update Kitemetrics

Manually

If you do not want to use the CocoaPods dependency manager, you can integrate the SDK into your project manually by copy/pasting the files into your project or by adding as a git submodule.

Usage

Initialize the session in AppDelegate

Swift 5.0
import Kitemetrics

class AppDelegate: UIResponder, UIApplicationDelegate {

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      Kitemetrics.shared.initSession(apiKey: "API_KEY")
      return true
  }
Objective-C
@import Kitemetrics;

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [[Kitemetrics shared] initSessionWithApiKey:@"API_KEY"];
    return YES;
}

Log Purchase Events

Swift 4.0
    Kitemetrics.shared.logInAppPurchase(skProduct, quantity: 1)
    //It is recommended to include the purchaseType if known
    Kitemetrics.shared.logInAppPurchase(skProduct, quantity: 1, purchaseType: KFPurchaseType.appleInAppNonConsumable)

    //If the SKProduct is unavailable you can log a purchase directly as
    Kitemetrics.shared.logPurchase(productIdentifier: "productId", price: Decimal(0.99), currencyCode: "USD", quantity: 1, purchaseType: .eCommerce)
Objective-C
    [[Kitemetrics shared] logInAppPurchase:skProduct quantity:1];
    //It is recommended to include the purchaseType if known
    [[Kitemetrics shared] logInAppPurchase:skProduct quantity:1 purchaseType:KFPurchaseTypeAppleInAppNonConsumable];

    //If the SKProduct is unavailable you can log a purchase directly as
    NSDecimal price = [[[NSDecimalNumber alloc] initWithFloat:0.99f] decimalValue];
    [[Kitemetrics shared] logPurchaseWithProductIdentifier:@"productId" price:price currencyCode:@"USD" quantity:1 purchaseType:KFPurchaseTypeECommerce];

Full list of pre-defined and custom events are available at the full documentation.

Example

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

Documentation

Full documentation is available at http://kitemetrics.com/docs/.

Notes

The SDK uses the Advertising Identifier (IDFA). When submitting an app to Apple you should answer "Yes" to the Advertising Identifier question and check the box next to "Attribute an action taken within this app to a previously served advertisement".

License

The iOS client SDK is available under the Apache License, Version 2.0. See the LICENSE file for more info.

Kitemetrics® is a registered trademark of Kitemetrcs.

analytics_ios's People

Contributors

kitefaster avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.