Skip to main content
Version: Vue SDK

How Screeb works

Tag loadingโ€‹

When ScreebPlugin is installed with shouldLoad: true (the default), it calls Screeb.load() immediately when your app boots. This injects the Screeb tag script into the DOM and connects to Screeb's servers.

Initializationโ€‹

Initialization (Screeb.init()) links the current browser session to a channel and optionally to a user identity. If autoInit: true is set in the plugin config, this happens automatically after loading.

If autoInit is false (the default), you must call init() manually:

const { init } = useScreeb();
await init("<YOUR-CHANNEL-ID>", "<USER-ID>");

Targeting engineโ€‹

Once initialized, Screeb continuously evaluates targeting rules in the background. When a rule matches (e.g. "user visited the pricing page 3 times"), the corresponding survey or message is triggered automatically โ€” no code needed on your side for standard targeting.

User identityโ€‹

Screeb assigns an anonymous ID to every session. If you call identity(userId), subsequent sessions for the same user are linked together, enabling user-level analytics and more precise targeting.

Plugin config reactivityโ€‹

The userId field in the plugin config is watched reactively. If you change it after initialization (e.g. on login/logout), Screeb automatically calls identity(newId) or identityReset():

// main.ts
const userId = ref<string | undefined>(undefined);

createApp(App)
.use(ScreebPlugin, { websiteId: "...", autoInit: true, userId })
.mount("#app");

// Later, on login:
userId.value = "user-123"; // Screeb.identity("user-123") is called automatically

Methodsโ€‹

All Screeb methods are available via the useScreeb() composable. They return Promises and reject with a descriptive message if called before initialization.