Skip to main content
Version: Angular SDK

FAQ

Answers to common questions about @screeb/sdk-angular.

Can I use Screeb without identifying users?

Yes. Screeb assigns an anonymous ID automatically when you initialize the SDK. You don't need to call this.screeb.identity() if you want to track anonymous users. Anonymous users count toward your Monthly Tracked Users (MTU).

How do I prevent Screeb from loading in test/CI environments?

Use the shouldLoad config option when configuring the SDK:

// For standalone apps
provideScreeb({
websiteId: 'YOUR_WEBSITE_ID',
shouldLoad: environment.production
})

// For NgModule-based apps
ScreebModule.forRoot({
websiteId: 'YOUR_WEBSITE_ID',
shouldLoad: environment.production
})

This prevents Screeb from loading in development, testing, or CI environments.

Can I call init() multiple times?

No. The SDK initializes once when your app starts (via autoInit: true by default, or when you manually call this.screeb.init()). Calling init multiple times may cause unexpected behavior. If you need to switch users, use this.screeb.identityReset() followed by this.screeb.identity().

How do I switch to a different user (e.g., after login)?

Call this.screeb.identityReset() first to clear the current session, then call this.screeb.identity() with the new user ID:

this.screeb.identityReset();
this.screeb.identity('new-user-id', {
email: 'support@screeb.app',
// other properties
});

Where do I find my Channel ID (Website ID)?

Your Channel ID (also called Website ID) is available in the Screeb admin console under Settings > Install. It looks like a UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

Why is my survey not showing?

Common reasons a survey might not appear:

  1. Targeting rules: Check the survey targeting rules in the admin console
  2. User identification: Ensure the user is identified before the survey trigger fires
  3. shouldLoad is false: Check that shouldLoad is not set to false in your config
  4. Initialization timing: If autoInit: true, wait for the SDK to initialize

See the Troubleshooting page for more detailed debugging steps.

Should I use ScreebModule or provideScreeb()?

  • Use provideScreeb() for Angular 14+ standalone apps. Add it to your appConfig providers in app.config.ts.
  • Use ScreebModule.forRoot() for NgModule-based apps (Angular 13 and earlier, or apps not using standalone components).

Both methods work, but provideScreeb() is the modern approach for standalone apps.

Can I call Screeb methods before autoInit completes?

No. If you set autoInit: true (the default), the SDK initializes asynchronously when your app starts. Wait for the Angular lifecycle to complete before calling Screeb methods.

If you need manual control over initialization timing, set autoInit: false and call this.screeb.init() explicitly in your component or service:

provideScreeb({
websiteId: 'YOUR_WEBSITE_ID',
autoInit: false
})

// Later, in your component
ngOnInit() {
this.screeb.init();
}

Can I use ScreebService in a standalone component?

Yes. Inject ScreebService using standard Angular dependency injection:

import { Component, inject } from '@angular/core';
import { ScreebService } from '@screeb/sdk-angular';

@Component({
selector: 'app-my-component',
standalone: true,
template: '...'
})
export class MyComponent {
private screeb = inject(ScreebService);

ngOnInit() {
this.screeb.trackEvent('page_viewed', {
page: 'my-component'
});
}
}

Does Screeb work with Angular Universal (SSR)?

Yes, but Screeb only runs in the browser. The SDK detects the SSR environment and skips initialization on the server. Your Angular Universal app will initialize Screeb normally once the page hydrates in the browser.