Introduction
The Set SDK provides an API for tracking custom events, exploring a user’s current context, and even subscribing to custom context states for things like customized notifications and context-specific app interactions. The API is driven by machine learning (ML) routines that continually learn and adapt to a user’s specific behaviors and past actions, allowing the developer to focus on delivering the right content, to the right user, at the right time.
Context Intelligence
Context Intelligence allows your app to react to changes in the user's world. With two primary APIs, you can monitor specific contexts of interest or learn what the current context for tailoring the user-experience. The Context Subscription APIs (on
and onAny
) will let you define your Context and then passively wait for your defined context to start or end when your app is in the foreground or in the background. The Latest Context API will give you the current Context definition at any moment your app is running.
Context Subscriptions
Combining user mobility with device information can give an app that added ‘magical’ edge that makes it feel like it truly understands its users; and with Set’s on-device learning, it does! This function is used to register a context and an associated closure. Each time Set detects that the conditions specified in the registered context are met, it will call the associated closure.
Resources
SetSDK.on(.atPlace(type: .home), .evening, .onWifi, .pluggedIn) { context in
// handle context detection
}
Discussion
Similar to the on
method, SetSDK.onAny() will allow you to monitor when any condition of your Context definition is met.
Latest Context
You can request the current context at any time. This is useful for helping to understand new user sessions, learning why they are opening the app, what they are trying to solve, and how you can help them faster.
Resources
let state = SetSDK.getLatest()
if let onWifi = state?.onWifi, let wifiDuration = onWifi.bounds.duration {
print("onWifi has been active for \(wifiDuration) seconds")
}
[success] Awesome!
You've got the basics of Context behind you. Now learn how to add custom events to Set's learning and behavior detection flow in the next steps.
Get in touch
- If you need help, shoot us a message at [email protected] or ping us on our Slack community.
- If found a bug, or have a feature request, add an Issue on the SetSDK Repo.
- Follow us on Twitter for product updates: @everyset