Reference
Every public method of Screeb KMP SDK, with its signature.
Complete reference for the Screeb Kotlin Multiplatform SDK. New to Screeb? Start with the install guide.
Methods by capability
Section titled “Methods by capability”Lifecycle
Section titled “Lifecycle”| Method | Description | More |
|---|---|---|
initSdk(channelId: String, userId: String? = null, properties: Map<String, Any>? = null, hooks: ScreebHooks? = null, initOptions: ScreebInitOptions? = null, language: String? = null): Boolean? |
Initialize the Screeb SDK. | Guide |
closeSdk(): Boolean? |
Stop the SDK. | Guide |
Identity
Section titled “Identity”| Method | Description | More |
|---|---|---|
setIdentity(userId: String, properties: Map<String, Any>? = null): Boolean? |
Identify the current user with optional properties. | Guide |
setProperties(properties: Map<String, Any>? = null): Boolean? |
Send visitor properties without changing the identity. | Guide |
resetIdentity(): Boolean? |
Reset the current visitor identity. | Guide |
setAnonymousId(anonymousId: String): Boolean? |
Adopts the anonymous id your CDP already uses (Amplitude device id, Segment or RudderStack anonymous id) on the current respondent, which stays anonymous. Call it right after [initSdk]: the call is resolved during init. 5 to 128 characters. | Guide |
getIdentity(): Map<String, Any>? |
Get the current visitor identity and properties. | Guide |
Groups
Section titled “Groups”| Method | Description | More |
|---|---|---|
assignGroup(groupType: String? = null, groupName: String, properties: Map<String, Any>? = null): Boolean? |
Assign the current user to a group. | Guide |
unassignGroup(groupType: String? = null, groupName: String, properties: Map<String, Any>? = null): Boolean? |
Remove the current user from a group. | Guide |
Tracking
Section titled “Tracking”| Method | Description | More |
|---|---|---|
trackEvent(name: String, properties: Map<String, Any>? = null): Boolean? |
Track a custom event. | Guide |
trackScreen(name: String, properties: Map<String, Any>? = null): Boolean? |
Track a screen navigation event. | Guide |
Surveys
Section titled “Surveys”| Method | Description | More |
|---|---|---|
startSurvey(surveyId: String, allowMultipleResponses: Boolean = true, hiddenFields: Map<String, Any>? = null, ignoreSurveyStatus: Boolean = true, hooks: ScreebHooks? = null, language: String? = null, distributionId: String? = null): Boolean? |
Start a specific survey programmatically. | Guide |
closeSurvey(surveyId: String? = null): Boolean? |
Close the currently displayed survey. | - |
Messages
Section titled “Messages”| Method | Description | More |
|---|---|---|
startMessage(messageId: String, allowMultipleResponses: Boolean = true, hiddenFields: Map<String, Any>? = null, ignoreMessageStatus: Boolean = true, hooks: ScreebHooks? = null, language: String? = null, distributionId: String? = null): Boolean? |
Start a specific message programmatically. | Guide |
closeMessage(messageId: String? = null): Boolean? |
Close the currently displayed message. | Guide |
Session replay
Section titled “Session replay”| Method | Description | More |
|---|---|---|
sessionReplayStart(): Boolean? |
Start session replay recording. | Guide |
sessionReplayStop(): Boolean? |
Stop session replay recording. | Guide |
| Method | Description | More |
|---|---|---|
debug(): String? |
Get SDK debug information. | Guide |
debugTargeting(): String? |
Get targeting debug information. | Guide |
Privacy helpers
Section titled “Privacy helpers”| Method | Description | More |
|---|---|---|
View.screebMaskText(): View |
Mask a view or component in session replay. | Guide |
UIView.screebMaskText(): UIView |
Mask a view or component in session replay. | Guide |
View.screebNoCapture(): View |
Exclude a view or component from session replay capture. | Guide |
UIView.screebNoCapture(): UIView |
Exclude a view or component from session replay capture. | Guide |
View.screebId(id: String): View |
Set a stable Screeb element ID for IAM targeting. | Guide |
UIView.screebId(id: String): UIView |
Set a stable Screeb element ID for IAM targeting. | Guide |
| Method | Description | More |
|---|---|---|
handleDeepLink(url: String?) |
Forward an incoming deep link (e.g. screeb-<channel-id>://inspector) to the SDK so it can act on it - used by the in-app message editor / native inspector. Pass the URL of the launch (or new) intent. On Android, call this from your Activity’s onCreate and onNewIntent. |
- |
API signatures
Section titled “API signatures”Lifecycle
Section titled “Lifecycle”initSdk(channelId: String, userId: String? = null, properties: Map<String, Any>? = null, hooks: ScreebHooks? = null, initOptions: ScreebInitOptions? = null, language: String? = null): Boolean?closeSdk(): Boolean?Identity
Section titled “Identity”setIdentity(userId: String, properties: Map<String, Any>? = null): Boolean?setProperties(properties: Map<String, Any>? = null): Boolean?resetIdentity(): Boolean?setAnonymousId(anonymousId: String): Boolean?getIdentity(): Map<String, Any>?Groups
Section titled “Groups”assignGroup(groupType: String? = null, groupName: String, properties: Map<String, Any>? = null): Boolean?unassignGroup(groupType: String? = null, groupName: String, properties: Map<String, Any>? = null): Boolean?Tracking
Section titled “Tracking”trackEvent(name: String, properties: Map<String, Any>? = null): Boolean?trackScreen(name: String, properties: Map<String, Any>? = null): Boolean?Surveys
Section titled “Surveys”startSurvey(surveyId: String, allowMultipleResponses: Boolean = true, hiddenFields: Map<String, Any>? = null, ignoreSurveyStatus: Boolean = true, hooks: ScreebHooks? = null, language: String? = null, distributionId: String? = null): Boolean?closeSurvey(surveyId: String? = null): Boolean?Messages
Section titled “Messages”startMessage(messageId: String, allowMultipleResponses: Boolean = true, hiddenFields: Map<String, Any>? = null, ignoreMessageStatus: Boolean = true, hooks: ScreebHooks? = null, language: String? = null, distributionId: String? = null): Boolean?closeMessage(messageId: String? = null): Boolean?Session replay
Section titled “Session replay”sessionReplayStart(): Boolean?sessionReplayStop(): Boolean?debug(): String?debugTargeting(): String?Privacy helpers
Section titled “Privacy helpers”View.screebMaskText(): ViewUIView.screebMaskText(): UIViewView.screebNoCapture(): ViewUIView.screebNoCapture(): UIViewView.screebId(id: String): ViewUIView.screebId(id: String): UIViewhandleDeepLink(url: String?)Hooks can be passed to initialization and programmatic survey/message starts. Callback payloads are forwarded as JSON strings by the mobile wrappers.
val hooks = ScreebHooks( version = "1.0.0", callbacks = mapOf( "onSurveyShowed" to { payload -> /* handle hook payload */ }, ),)For complete hook payload definitions, see the JS tag hooks reference.
Privacy helpers
Section titled “Privacy helpers”view.screebMaskText()
view.screebNoCapture()
view.screebId("checkout-button")Type definitions
Section titled “Type definitions”data class ScreebHooks( val version: String, val callbacks: Map<String, suspend (String) -> Any?> = emptyMap(), )
data class ScreebInitOptions( val isDebugMode: Boolean = false, val disableMirror: Boolean = false, )