Skip to content

Install the website widget

Copy the installation code from Portal → Domains and add it once to your site’s shared template or custom-code field. Approve the site’s domain in the portal first. The public widget key identifies your chatbot; it is safe to include in HTML. Never put a developer secret key in this snippet.

<script src="https://chatbot-norge.no/cdn/widget.js?key=pk_live_0123456789abcdef0123456789abcdef" defer></script>

The key above is an example. Replace it with the code from your account. The same snippet works in the document head, before </body>, or when inserted after the page has loaded. Keep it in your shared template when navigating a single-page application. Repeated loads of the same chatbot reuse its existing instance.

Check your smallest supported screen with sticky checkout, cookie and navigation controls visible. Keep the chatbot button clear of these controls. Optional offsets are distances in CSS pixels from the configured left/right edge and bottom of the screen; safe-area insets are added by the widget.

<script
src="https://chatbot-norge.no/cdn/widget.js?key=pk_live_0123456789abcdef0123456789abcdef"
data-offset-x="20"
data-offset-y="100"
data-offset-mobile-x="12"
data-offset-mobile-y="96"
defer></script>

These are example distances, not a fit for every layout. Test opening, typing and closing with the mobile keyboard visible. Do not hide checkout controls behind the chatbot.

The widget executes on your website and creates a closed Shadow DOM for CSS isolation. Your document’s CSP still applies. Merge the required sources into your existing policy; do not replace your entire policy with an example.

For the self-hosted Sora or system font:

Directive Required permission
script-src https://chatbot-norge.no, or the site’s trusted nonce with an appropriate strict-dynamic policy
connect-src https://chatbot-norge.no for configuration and chat requests
font-src https://chatbot-norge.no when using Sora
style-src A matching nonce on the script below; without a nonce, the generated stylesheet needs your inline-style permission
img-src The origins used by your configured logo/avatar; include data: if your branding uses data images

If your selected font uses Google Fonts, also allow https://fonts.googleapis.com in style-src and https://fonts.gstatic.com in font-src.

For a nonce-based policy, use the same fresh, server-generated nonce in the document CSP and the installation script. The loader forwards it to its runtime script and widget stylesheet:

<script nonce="YOUR_SERVER_GENERATED_NONCE"
src="https://chatbot-norge.no/cdn/widget.js?key=pk_live_0123456789abcdef0123456789abcdef"
defer></script>

For example, the site’s existing style-src must allow 'nonce-YOUR_SERVER_GENERATED_NONCE'. Generate a new unpredictable nonce for each HTML response; the example string is not a production nonce. A nonce on an external script does not by itself grant permission for API calls or fonts.

Ordinary route changes do not require reinstalling the widget. When your application deliberately removes the widget host, its document listeners, timers and active request are cleaned up. To remove it explicitly, use your tenant ID:

window.ChatbotNorge?.destroy('your-tenant-id');

This stops that chatbot on the current page. Insert the original script again to remount it. Other tenants on the page are not removed. Existing data-key and legacy data-tenant installation formats remain supported.

The widget uses your website’s local/session storage with tenant-specific keys for conversation and session state. It does not need third-party cookies. If storage is unavailable, it continues with temporary in-memory state; history then does not survive a reload. Your site’s own JavaScript can access its storage, so include the widget in your site’s privacy assessment.

Keep the stable /cdn/widget.js URL. It receives updates automatically and points to a retained bundle with a content hash in its filename. Updating documents or appearance does not require another script. Public-key rotation is different: replace the snippet within the rotation window shown in the portal.

If the chatbot does not appear, check the public key, approved domain, CSP and whether the browser can load the script. If configuration or runtime loading temporarily fails, the widget offers Prøv igjen. A completely blocked or missing entry script cannot display its own error; your website remains usable.

An interrupted response is marked incomplete and can be retried. Closing the panel does not start another request or discard the active reply. Stopp svar deliberately cancels it.