Skip to main content
Version: Browser SDK

Browser SDK

npm versionLicense: MITminzipped sizedownloads

@screeb/sdk-browser is the Screeb SDK for vanilla JavaScript and framework-agnostic apps (Vue, Svelte, Next.js, Nuxt, etc.).

CI environments

Deactivate the Screeb SDK during CI execution to avoid creating anonymous users and exceeding your MTU limit.

Prerequisites

  • Node.js 14 or later
  • A modern browser (Chrome 60+, Firefox 60+, Safari 12+, Edge 79+)
  • SSR environments (Next.js, Nuxt): call Screeb.load() and Screeb.init() only on the client side

Add Screeb as a dependency

npm install @screeb/sdk-browser --save
# or
yarn add @screeb/sdk-browser

Setup the SDK

tip

You can find your channel id in your workspace settings.

import * as Screeb from "@screeb/sdk-browser";

// Initialize Screeb
Screeb.load();
Screeb.init("<YOUR-CHANNEL-ID>");

// With user identity
Screeb.load();
Screeb.init(
"<YOUR-CHANNEL-ID>",
"<USER-ID>", // optional
{ // optional user properties
firstname: "<user-firstname>",
lastname: "<user-lastname>",
plan: "<user-plan>",
last_seen_at: new Date(),
authenticated: true,
}
);

SDK lifecycle

Disable the Screeb SDK at any time:

Screeb.close();

Example app

See the example-browser for a working integration.