BoundlessKit 7.0.0-beta

BoundlessKit 7.0.0-beta

Maintained by Dopamine.



BoundlessKit 7.0.0-beta

BoundlessKit

Version License Platform

What is BoundlessKit?

BoundlessKit is a behavioral design SDK that provides personalized reinforcement schedules for user engagement.

Learn more at https://www.boundless.ai

Reinforcement Schedule Sample

Above is a sample reinforcement schedule with: [Reward, Reward, Neutral, Reward, Neutral]

Installing BoundlessKit

CocoaPods

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

pod 'BoundlessKit'

Also if it is not already added, add use_frameworks! to the top of the Podfile.

Carthage

To integrate into your Xcode project using Carthage, specify it in your Cartfile:

github "BoundlessAI/BoundlessKit-iOS"

Using BoundlessKit

Step 1: Setup

Import BoundlessKit in your application delegate:

Swift
import BoundlessKit
Objective-C
#import "BoundlessKit/BoundlessKit-Swift.h"

Then in your application delegate’s application(_:didFinishLaunchingWithOptions:) method, setup the SDK like so:

Swift
let bkConfig = BKConfiguration(appId: "YOUR_APP_ID",
                               versionId: "YOUR_VERSION_ID",
                               inProduction: IN_PRODUCTION,
                               devSecret: "YOUR_DEV_KEY",
                               prodSecret: "YOUR_PROD_KEY")
BKBoundlessKit.setup(configuration: bkConfig)
Objective-C
BKConfiguration* bkConfig = [[BKConfiguration alloc]
                               initWithAppId:@"YOUR_APP_ID"
                               versionId:@"YOUR_VERSION_ID"
                               inProduction: IN_PRODUCTION
                               devSecret:@"YOUR_DEV_KEY"
                               prodSecret:@"YOUR_PROD_KEY"];
[BKBoundlessKit setupWithConfiguration: bkConfig];

Step 2: Reinforcement

Immediately after the reinforced action in your app, call the reinforce(actionName:metadata:) method:

Swift
BKBoundlessKit.shared.reinforce(actionName: "Workout Completed")
Objective-C
[BKBoundlessKit.shared reinforceWithActionName:@"appOpen"];

Then register for and receive the reinforcement notification from NSNotificationCenter:

Swift
NotificationCenter.default.addObserver(self,
                                       selector: #selector(reinforce(notification:)),
                                       name: BKConstant.ReinforcementReportNotification,
                                       object: nil)
...
@objc
func reinforce(notification: Notification) {
    guard notification.userInfo?[BKConstant.ReinforcementReportActionKey] as? String == "Workout Completed",
        let reinforcement = notification.userInfo?[BKConstant.ReinforcementReportDecisionKey] as? String else {
            return
    }
    print("Got reinforcement:\(reinforcement)")
}
Objective-C
[NSNotificationCenter.defaultCenter addObserver:self
                                       selector:@selector(reinforce:)
                                           name:BKConstant.ReinforcementReportNotification
                                         object:nil];
...
- (void) reinforce:(NSNotification*) notification {
    if ([notification.userInfo[BKConstant.ReinforcementReportActionKey] isEqual: @"Workout Completed"]) {
        NSString* reinforcement = (NSString*) notification.userInfo[BKConstant.ReinforcementReportDecisionKey];
        NSLog(@"Got reinforcement:%@", reinforcement);
    }
}

Display a visual effect for a reinforcement decision, and display no effect for neutral reinforcement decisions to build anticipation! The variable schedule will engage that user, since reinforcement schedules are personalized to that user's past actions!

Step 3: Track

Tracking actions and other user behaviors can be used to optimize reinforcement schedules, as well as measure changes in engagement for statistical significance.

Swift
BKBoundlessKit.shared.track(event: "foodItemAdded", metadata: ["calories": 400])
Objective-C
[BKBoundlessKit.shared trackWithEvent:@"foodItemAdded" metadata:@{@"calories": @400}];