For the complete documentation index, see llms.txt. This page is also available as Markdown.

Getting Started

Get started with ContextSDK — sign up, create a license key, and integrate the SDK with step-by-step setup guides for all platforms.

Sign Up and Create a License Key

To start using ContextSDK, sign up in our ContextSDK Dashboard and create a license key for your app. This key is required to authenticate your integration with ContextDecision or ContextPush.

If your app has a different bundle ID or package name for different environments, register each one of them separately, as each environment will have a unique license key that should be used.

SDK Integration

Once you have your license key, integrate ContextSDK into your app. The following sections provide step-by-step instructions for iOS, Android, Flutter, Unity, and React Native.

Installation

Add https://github.com/context-sdk/context-sdk-releases.git as a dependency in Xcode Package Dependencies or in your Package.swift file:

dependencies: [
    .package(url: "https://github.com/context-sdk/context-sdk-releases", .upToNextMajor(from: "5.17.0")),
]

Add the following dependency to your Podfile and run pod install :

Podfile
pod "ContextSDK"
  1. Download the latest version of ContextSDK: ContextSDK.zip

  2. In Xcode, drag ContextSDK.xcframework into the Project Navigator.

  3. Open your project settings, navigate to Frameworks, Libraries, and Embedded Content, add ContextSDK.xcframework, and set it to Embed & Sign.

To download a specific version, replace latest in the download URL with the desired version number. For example, to download version 5.17.0:

https://storage.googleapis.com/de73e410-context-sdk-releases/5.17.0/ContextSDK.zip

SDK Initialization

AppDelegate.swift
import ContextSDK

class AppDelegate: NSObject, UIApplicationDelegate {
    // …
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        // …
        ContextManager.applicationDidFinishLaunchingWithOptions(launchOptions, licenseKey: "YOUR_LICENSE_KEY")
        // …
    }
}
  1. Create an AppDelegate class if you don't have one yet:

AppDelegate.swift
import ContextSDK

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        ContextManager.applicationDidFinishLaunchingWithOptions(launchOptions, licenseKey: "YOUR_LICENSE_KEY")
        return true
    }
}
  1. If you didn't have an AppDelegate class yet, add a UIApplicationDelegateAdaptor property wrapper to your App scene:

YourApp.swift
struct YourApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    // …
}

Installation

Add the ContextSDK Maven repository in your project-level settings.gradle.kts:

settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        // …
        // Add the ContextSDK Maven repo:
        maven {
            url = uri("https://storage.googleapis.com/fc4073e9-contextsdk-maven/")
        }
    }
}

Add the ContextSDK dependency in your module-level build.gradle.kts:

build.gradle.kts
dependencies {
    // …
    implementation("com.contextsdk:contextsdk:<version>")
}

Add the ContextSDK Maven repository in your project-level settings.gradle:

settings.gradle
dependencyResolutionManagement {
    repositories {
        // …
        // Add the ContextSDK maven repo:
        maven {
            url 'https://storage.googleapis.com/fc4073e9-contextsdk-maven/'
        }
    }
}

Add the ContextSDK dependency in your module-level build.gradle:

build.gradle
dependencies {
    // …
    implementation 'com.contextsdk:contextsdk:<version>'
}

Replace <version> with the latest release.

SDK Initialization

In your Application subclass, initialize ContextSDK by calling setup with your license key:

In your Application subclass, initialize ContextSDK by calling setup with your license key:

That's all the setup there is: from setup on, ContextSDK observes every Activity in your app by itself, including ones from other libraries such as an ad network's full-screen ad or a billing screen. It collects accelerometer and gyroscope data while any of them is in the foreground, and stops once the app has been in the background for 5 seconds. There is nothing to call per Activity.

Call setup once, from Application.onCreate(). Only the first call takes effect: any later call logs a warning and is ignored, including its license key and configuration. To change either, change the arguments of that first call.

setup returns whether this call activated ContextSDK with a valid license key. It returns false when the license key isn't valid for your app's package name (ContextSDK then keeps its events on the device instead of uploading them), when an earlier call already set ContextSDK up, when it's called outside your app's main process, and when setup failed. You can use it to report a misconfigured license key at runtime instead of only in logcat.

Installation

Add context_sdk to your pubspec.yaml:

Ensure your project meets the Minimum SDK Requirements target by updating your ios/Podfile, e.g.:

SDK Initialization

Add the following code to your app’s launch:

Installation

  1. Download the latest version of ContextSDK: ContextSDK.zip.

  2. In your Unity project, drag ContextSDK.xcframework into the Assets/Plugins/iOS folder.

  3. Add the ContextSDKBinding.cs script in the same folder.

To download a specific version, replace latest in the download URL with the desired version number. For example, to download version 5.17.0:

https://storage.googleapis.com/de73e410-context-sdk-releases/5.17.0/ContextSDK.zip

SDK Initialization

Set up the ContextManager in the Start() method of a MonoBehaviour that runs early in your game, before accessing the SDK:

Android

On Android, use the latest ContextSDKBinding.cs, add com.contextsdk:contextsdk to your Android Gradle build as shown in the Android tab, and call SetupWithAPIBackend as on iOS.

Installation

Install ContextSDK using your preferred package manager:

or

Ensure your project meets the Minimum SDK Requirements target by updating your ios/Podfile, e.g.:

SDK Initialization

Add the following code to your app’s launch:

ContextDecision

ContextDecision optimizes conversion funnels by intelligently determining the best moments to present monetization or engagement opportunities. Now that you’ve integrated ContextSDK, to get started with ContextDecision, see Logging Conversions.

ContextPush

ContextPush improves the timing of non-transactional push notifications by leveraging user's real-life context. To begin integrating ContextPush, see Set Up Client Integration.

Last updated

Was this helpful?