Troubleshooting
The Screeb widget doesn't appearโ
- Check that
websiteIdmatches your channel ID in workspace settings. - Check the browser console for errors from
@screeb/sdk-svelte. - Verify
shouldLoadis not set tofalsein the provider config. - If using
autoInit: false, make sure you callinit()before any other Screeb method.
useScreeb returns undefined methodsโ
useScreeb() must be called inside a component that is rendered under the component where setScreebContext is called. If it returns undefined, you'll see a warning:
`useScreeb` must be called inside a component tree where `setScreebContext` or `provideScreeb` has been called.
Make sure setScreebContext(...) is called in a parent component before using useScreeb().
Methods reject with "Screeb has not been initialized"โ
This happens when you call a Screeb method before init() completes. Either:
- Set
autoInit: truein the provider config, or - Wait for
init()to resolve before calling other methods.
Screeb loads but no surveys appearโ
- Check that your targeting rules match the current user (properties, events, URL).
- Use
targetingDebug()to inspect the current targeting state:
const { targetingDebug } = useScreeb();
console.log(await targetingDebug());
SSR / SvelteKit compatibilityโ
The Svelte SDK guards against SSR with an isSSR check, so load() is not called on the server. In SvelteKit, call setScreebContext from a browser-rendered root layout or page component:
<!-- +layout.svelte -->
<script lang="ts">
import { setScreebContext } from "@screeb/sdk-svelte";
setScreebContext({
websiteId: "<YOUR-CHANNEL-ID>",
autoInit: true,
});
</script>
<slot />
Use shouldLoad: false in tests or CI if you do not want the Screeb tag to be injected.