Skip to content
Open Screeb

Every public method of the JavaScript tag, with its signature.

After the tag loads, the global $screeb function runs these commands in order and returns a Promise: $screeb(command, argument1, argument2, ...). New to Screeb? Start with the install guide.

Command Description
$screeb("init", channelId, userId?, userProperties?, hooks?, language?) Start the tag and attach the session to your channel. Optionally identify the user; without a user id, the visitor stays anonymous until identity.
$screeb("close") Stop the tag. The opposite of init.
$screeb("debug") Print the tag configuration: channel id, user id, session duration.
$screeb("survey.start", surveyId, options?) Start a survey by its id. Targeting rules in the admin need no code: prefer them when you can.
$screeb("survey.close") Close the survey on screen.
$screeb("message.start", messageId, options?) Start a message by its id. Targeting rules in the admin need no code: prefer them when you can.
$screeb("message.close") Close the message on screen.
$screeb("message.debug") Print the status of each active message and its targeting rules.
$screeb("session-replay.start") Start recording the session for Session Replay.
$screeb("session-replay.stop") Stop recording the session.
$screeb("targeting.debug") Print the status of each targeting rule of each survey.
$screeb("identity", userId, userProperties?) Tell Screeb who the current user is, on login for example. When the tag only runs behind login, pass the user id to init instead.
$screeb("identity.reset") Forget the current user and switch to a new anonymous visitor. The tag keeps running until close.
$screeb("identity.anonymous_id", anonymousId) Tell Screeb which anonymous id your CDP already uses for the current visitor.
$screeb("identity.properties", userProperties) Add or update properties of the current user, to personalize and target surveys.
$screeb("identity.group.assign", groupType?, groupName, groupProperties?) Add the current user to a group, with optional group properties.
$screeb("identity.group.unassign", groupType?, groupName) Remove the current user from a group.
$screeb("identity.get") Get the current user identity and properties.
$screeb("event.track", eventName, eventProperties?) Track an action of the current user, with properties describing it.
$screeb("event.copilot", eventName, eventProperties?) Track an action of the user with an AI copilot, with properties describing it.
$screeb("event.screen", screenName, screenProperties?) Report a screen change to the targeting engine. Only in a webview of an app running a Screeb mobile SDK.
$screeb("color-scheme.set", scheme) Force the color scheme surveys and messages render in: “light”, “dark” or “auto”. Overrides the colorScheme init option; “auto” goes back to automatic detection.

Privacy annotations are HTML classes and attributes, not $screeb commands: see Privacy helpers.