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.
Full policy
Section titled “Full policy”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.
What each directive is for
Section titled “What each directive is for”script-src
Section titled “script-src”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-srcand set it on the snippet’s<script>tag. Keephttps://*.userguiding.cominscript-srcas 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.cominscript-srcis enough.
connect-src
Section titled “connect-src”The SDK calls UserGuiding APIs to load content, identify users and record events.
connect-src https://*.userguiding.com;img-src
Section titled “img-src”Images in guides, checklists, banners and other content are served from UserGuiding hosts.
img-src https://*.userguiding.com;style-src
Section titled “style-src”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';Content you add yourself
Section titled “Content you add yourself”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-srcand its font host tofont-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.