Skip to content

Content Security Policy

If your app uses a Content Security Policy, add the directives below so the SDK can load, call its APIs and render content.

script-src 'nonce-{SERVER-GENERATED-NONCE}' https://*.userguiding.com;
connect-src https://*.userguiding.com;
img-src https://*.userguiding.com;
style-src 'unsafe-inline';

Merge these values into your existing directives rather than replacing them. The wildcard covers both the US and EU hosts.

The inline snippet needs permission to run, and the container script it loads needs permission to load.

  • With a nonce (recommended). Generate an unguessable nonce per response, add it to script-src and set it on the snippet’s <script> tag. Keep https://*.userguiding.com in script-src as well, because the snippet adds the container script dynamically and that script does not carry your nonce.

    <script nonce="{SERVER-GENERATED-NONCE}">
    (function(g,u,i,d,e,s){ /* your container snippet */ })(window,document,'script','userGuiding','userGuidingLayer','YOUR_CONTAINER_ID');
    </script>

    If your policy uses 'strict-dynamic', scripts added by the nonced snippet are trusted automatically and the host entry is not needed.

  • Without a nonce. Allow inline scripts instead. This is less strict.

    script-src https://*.userguiding.com 'unsafe-inline';
  • Script tag install. If you use the one line <script async src="..."> tag instead of the inline snippet, https://*.userguiding.com in script-src is enough.

The SDK calls UserGuiding APIs to load content, identify users and record events.

connect-src https://*.userguiding.com;

Images in guides, checklists, banners and other content are served from UserGuiding hosts.

img-src https://*.userguiding.com;

The SDK renders its UI with styled-components, which inject <style> tags at runtime. styled-components does not support client side nonces, so inline styles must be allowed.

style-src 'unsafe-inline';

Some content pulls resources from third parties you choose. Allow those origins too:

  • Custom fonts. If your theme uses a custom font URL such as Google Fonts, add its host to style-src and its font host to font-src.
  • Embedded media. Videos and iframes in guides, for example from YouTube or Loom, need their hosts in frame-src.
  • External images. Images linked from your own CDN need that host in img-src.