Skip to content

Javascript SDK Troubleshooting

Samuel Berthe edited this page Nov 18, 2022 · 12 revisions

Missed Login or Signup

When you call the identity or alias command from the client-side, right after user registration, the visitor can be redirected to a new page with limited access.

In that case, Screeb recommends making those calls from the welcome page.

Check Javascript tag is loaded correctly

Open the developer console and call the following Screeb command: $screeb('debug');.

You will get contextual information about the running user session:

image

Error cases

  • The error Uncaught ReferenceError: $screeb is not defined means the Javascript Tag was not injected into the page.
  • An empty channel id means you didn't call the $screeb('init', ...) command.
  • An empty respondent id means you exceeded your respondent quota.

Debug targeting rules

Since the targeting engine built by Screeb runs in the background, you may not understand which rules prevent your survey from being displayed to a user.

Open the developer console and call the following Screeb command: $screeb('targeting.debug');.

You will get a list of available surveys and the associated targeting rules:

image

The rules with a green dot 🟢 are the ones that have been validated for this user. The rules with a red dot 🔴 are not validated and maybe the reason why your survey is not displayed.

Content Security Policy (CSP)

You want to display Screeb surveys while being sure your app is secured and protected against injection attacks, here's how to make Screeb compatible with your Content Security Policy (CSP).

Your CSP should -at least- look like this:

default-src 'unsafe-inline' https://*.screeb.app wss://*.screeb.app

And don't forget to add your own domains.

An example:

content-security-policy: default-src https: 'unsafe-eval' 'unsafe-inline' https://*.screeb.app wss://*.screeb.app; object-src 'self'; report-uri /csp-violation-report; frame-ancestors 'self' https://admin.example.com https://vip.example.com
Clone this wiki locally