Install
Add the Screeb SDK to your app and start it with your channel id, so surveys, messages and session replay can run.
Install the Screeb SDK once, at the start of your app, with the channel id of your workspace. Until a user is identified, Screeb tracks them as an anonymous visitor: see Identity to attach your own user id.
Your channel id is on the Install page of your workspace settings. The steps on the admin side are in the help center: Install Screeb on your website and Install Screeb in your mobile app.
Requirements
Section titled “Requirements”- Node.js 14 or later.
- React 17+, Vue 3+, Angular 12+ (14+ for standalone bootstrapping), Svelte 4+, or Ionic 6+ with Capacitor 4+, depending on your package.
- The same browsers as the JavaScript tag: Chrome 94+, Firefox 91+, Safari 15+, iOS 15+, Edge 94+, with a legacy bundle for older ones.
- With server-side rendering (Next.js, Nuxt, SvelteKit), load and start Screeb on the client side only.
Add the SDK to your project
Section titled “Add the SDK to your project”npm install @screeb/sdk-angularStart the SDK
Section titled “Start the SDK”import { importProvidersFrom } from "@angular/core";import { bootstrapApplication } from "@angular/platform-browser";import { provideIonicAngular } from "@ionic/angular/standalone";import { ScreebModule } from "@screeb/sdk-angular";import { AppComponent } from "./app/app.component";
bootstrapApplication(AppComponent, { providers: [ provideIonicAngular(), importProvidersFrom( ScreebModule.forRoot({ autoInit: true, websiteId: "<YOUR-CHANNEL-ID>", }), ), ],});autoInit starts Screeb as soon as the SDK has loaded. When the user is already logged in at that point, pass userId and userProperties too, so Screeb never creates an anonymous visitor for them (see Identity). To keep Screeb from loading in tests or CI, set shouldLoad to false there.
Start the SDK from an NgModule
Section titled “Start the SDK from an NgModule”If your app still bootstraps an NgModule, import ScreebModule.forRoot there instead:
import { NgModule } from "@angular/core";import { ScreebModule } from "@screeb/sdk-angular";
@NgModule({ imports: [ ScreebModule.forRoot({ autoInit: true, websiteId: "<YOUR-CHANNEL-ID>", }), ],})export class AppModule {}Choose the package for your Ionic stack
Section titled “Choose the package for your Ionic stack”Ionic apps run in a WebView, so the web SDK works as on a website and no native plugin is needed, including when you ship with Capacitor. This page uses @screeb/sdk-angular for Ionic Angular. For Ionic React, Vue or vanilla JavaScript, follow the React, Vue or Browser pages.
Stop the SDK
Section titled “Stop the SDK”Stop Screeb at any time, for example when the user withdraws consent. It stays off until you start it again.
await this.screeb.close();Next steps
Section titled “Next steps”- Identify your users to follow them across devices and target surveys on their properties.
- Track events to trigger surveys and messages on what users do.
- Start a survey from your code when the targeting rules are not enough.