# 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](https://developers.screeb.app/sdk-ionic/identity) to attach your own user id.

Your channel id is on the [Install page of your workspace settings](https://admin.screeb.app/org/last/settings/install). The steps on the admin side are in the help center: [Install Screeb on your website](https://help.screeb.app/install/install-web/) and [Install Screeb in your mobile app](https://help.screeb.app/install/install-mobile/).

> [!TIP]
> Turn the SDK off in your CI and end-to-end test runs. Every run creates new anonymous users, which count toward your monthly tracked users.

## 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

```sh
npm install @screeb/sdk-angular
```

## Start the SDK

```ts
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](https://developers.screeb.app/sdk-ionic/identity)). To keep Screeb from loading in tests or CI, set `shouldLoad` to `false` there.

### Start the SDK from an NgModule

If your app still bootstraps an `NgModule`, import `ScreebModule.forRoot` there instead:

```ts
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

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](https://developers.screeb.app/sdk-react/install), [Vue](https://developers.screeb.app/sdk-vue/install) or [Browser](https://developers.screeb.app/sdk-browser/install) pages.

## Stop the SDK

Stop Screeb at any time, for example when the user withdraws consent. It stays off until you start it again.

```ts
await this.screeb.close();
```

## Next steps

- [Identify your users](https://developers.screeb.app/sdk-ionic/identity) to follow them across devices and target surveys on their properties.
- [Track events](https://developers.screeb.app/sdk-ionic/event-tracking) to trigger surveys and messages on what users do.
- [Start a survey from your code](https://developers.screeb.app/sdk-ionic/start-survey-programmatically) when the targeting rules are not enough.
