CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

SkarbSDK 0.6.23

SkarbSDK 0.6.23

Maintained by Bitlica Inc.



 
Depends on:
gRPC-Swift= 1.8.0
SwiftProtobuf= 1.24.0
ReachabilitySwift= 5.2.4
 

SkarbSDK 0.6.23

  • By
  • Bitlica Inc

Introduction

SkarbSDK is a framework that makes you happier. It automatically reports:

  1. install event - during SDK initialization phase.
  2. subscription event - this event could be reported manually as well by sendPurchase(), though it's not recommended way.

In addition, you could enrich these events with features obtained from the traffic source by explicit call of sendSource() method. And if you're interesting in split testing inside an app take a look on sendTest() method.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate SkarbSDK into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'SkarbSDK', '~> 0.6'

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding SkarbSDK as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/bitlica/SkarbSDK.git", .upToNextMajor(from: "0.6.16"))
]

Usage

Initialization

import SkarbSDK

class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
      SkarbSDK.initialize(clientId: "YOUR_CLIENT_ID", isObservable: true, deviceId: "YOUR_DEVICE_ID")
    }
}

Params:

clientId You could get it in your account dashboard.

isObservable Automatically sends all events about purchases that are in your app. If you want to send a purchase event manually you should set this param to false and see Send purchase event section. Default value is true.

deviceId If you want to can use your own generated deviceId. Default value is nil.

Send features

Using for loging the attribution.

import SkarbSDK

SkarbSDK.sendSource(broker: SKBroker,
                    features: [String: Any],
                    brokerUserID: String?)

Params:

broker indicates what service you use for attribution. There are three predefined brokers: facebook, searchads, appsflyer. Also might be used any value - SKBroker.custom(String).

features. See features paragraphe, supported features has a string type, not supported are ignored silently.

brokerUserID. Use the unique userID for this SKBroker if you want to use postbacks. For example, for Appsflyer - AppsFlyerLib.shared().getAppsFlyerUID()

Example for Appsflyer:

In delegate mothod:

import SkarbSDK

func onConversionDataSuccess(_ conversionInfo: [AnyHashable : Any]) {
    SkarbSDK.sendSource(broker: .appsflyer,
                        features: conversionInfo,
                        brokerUserID: AppsFlyerLib.shared().getAppsFlyerUID())
}

A/B testing

import SkarbSDK

SkarbSDK.sendTest(name: String,
                  group: String)

Params:

name Name of A/B test

group Group name of A/B test. For example: control group, B, etc.

IDFA

SkarbSDK automaticaly collects IDFA. If you want to disable it, please set false before SkarbSDK.initialize() method. The default value is true

import SkarbSDK

SkarbSDK.automaticCollectIDFA = false

Also you can sent idfa after getting status from ATTrackingManager.requestTrackingAuthorization() and if the the status is .authorized get idfa from ASIdentifierManager.shared().advertisingIdentifier.uuidString and use this method:

SkarbSDK.sendIDFA(idfa: String?)

Logging

If you want to see errors and warning from SkarbSDK , please use set true before SkarbSDK.initialize() method. The default value is false

import SkarbSDK

SkarbSDK.isLoggingEnabled = true

License

MIT