Skip to content

Install the Axoryn widget

Add the Axoryn chat widget to your site with one script tag. Covers platforms, Content-Security-Policy, allowed sites and confirming the install.

7 min read 7 sections

The Axoryn widget is a single script tag that you paste before </body> on every page of your site. This page is for whoever edits your site’s code. It covers the snippet, where it goes on common platforms, the Content-Security-Policy a strict site needs, how to limit the widget to your own domains, and how to confirm it is live.

The install snippet

Every project has its own widget key. The dashboard fills the key into this snippet for you:

<script src="https://api.axoryn.io/widget.js"
  data-project-key="YOUR_WIDGET_KEY" async></script>

Paste it right before </body> on every page, or once in your shared layout or template. The snippet is the same on every platform. Only the place you paste it changes.

The script is small. It shows the chat launcher right away and loads the rest of the widget in the background once the page is idle, or when the visitor hovers over, focuses or touches the launcher. Returning visitors with a conversation in progress get the full widget straight away, so new replies and unread badges show without the visitor opening the chat.

The widget key is public and is meant to appear in your page source. To control which sites can use it, see Limit the widget to your sites.

Find your snippet and widget key

You can copy the snippet in three places:

  • Onboarding. The Install the widget step shows the snippet, a Copy button and the Widget key:.
  • Project home. The Get your support live panel has a Put the widget on your site step with Copy snippet and platform guides (React, Next.js, WordPress guides).
  • Account settings. Open Account settings and go to the Install section. It lists one snippet per project with its Widget key and install status.

If someone else edits your site, select Copy instructions for your developer in the onboarding install step. It copies the snippet with a short note on where to paste it.

Add it to your platform

Plain HTML

  1. Open the HTML of every page, or your shared layout or template.
  2. Paste the snippet right before </body>.
  3. Publish, then open any page on your site.

React single-page apps

  1. Open index.html (or public/index.html) in your app.
  2. Paste the snippet right before </body>. There is no package to install.
  3. Deploy, then open your app in a browser.

The widget stays mounted across client-side route changes. To pass the signed-in user, see Use the widget with React and Next.js.

Next.js

Add the Script tag inside <body> in app/layout.tsx (or pages/_document.tsx):

import Script from 'next/script'

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        {children}
        <Script src="https://api.axoryn.io/widget.js"
          data-project-key="YOUR_WIDGET_KEY"
          strategy="afterInteractive" />
      </body>
    </html>
  )
}

WordPress

  1. Go to Appearance → Theme File Editor, or use a header and footer plugin.
  2. Paste the snippet in footer.php, right before </body>.
  3. Save, then open your site.

Shopify

  1. In Shopify admin, go to Online Store → Themes → Edit code.
  2. Open layout/theme.liquid and paste the snippet right before </body>.
  3. Save, then open your store.

To put the widget inside a Shopify admin app instead, see Shopify stores and apps.

Webflow

  1. Open Site settings → Custom code.
  2. Paste the snippet in Footer code.
  3. Save and publish, then open your site.

Start the widget from your own code

By default the widget starts as soon as the script loads. To start it yourself, for example only on some pages or after your app knows who is signed in, add data-auto-init="false" and call Axoryn.init():

<script src="https://api.axoryn.io/widget.js"
  data-auto-init="false" async></script>
window.Axoryn.init({ projectKey: 'YOUR_WIDGET_KEY' })

window.Axoryn exists once widget.js has run. Calls made after that, but before the full widget has loaded, are queued and replayed in order. Every method and script attribute is listed in the Widget JavaScript API reference.

Content-Security-Policy

The widget works under a strict Content-Security-Policy. It does not need 'unsafe-inline' or 'unsafe-eval':

  • Its styles live inside a shadow root. On current browsers they are constructed stylesheets, which style-src does not govern.
  • It never writes inline style="…" markup.
  • Its launcher icon is built with DOM APIs, so pages that enforce Trusted Types work too.
  • It uses system fonts, so font-src needs nothing.

Add these sources to your existing directives (keep your own 'self' and other hosts):

script-src https://api.axoryn.io; connect-src https://api.axoryn.io wss://api.axoryn.io [STORAGE-HOST]; img-src https://api.axoryn.io https: data: blob:
DirectiveWhy
script-srcLoads widget.js and the widget bundles it imports from the same origin.
connect-srcThe REST API (https://), the realtime connection (wss://) and, when it differs, the storage host that visitor file uploads are sent to.
img-srcTeam and AI avatars, image attachments and images in replies are https URLs. blob: shows the preview of a file the visitor is about to send.

[STORAGE-HOST] is the host visitor uploads go to when it is not the API origin. The onboarding Install the widget step builds this line with the storage host filled in: expand Not detected yet? Check these and select Copy CSP. If uploads fail, open the browser console, find the blocked host in the Refused to connect message, and add it to connect-src.

If you use 'strict-dynamic', the bundles the loader imports are trusted once the loader script itself is allowed.

Nonces on older browsers

Browsers without constructed stylesheets fall back to a <style> element. If your policy uses nonces, put your nonce on the script tag. The widget reuses it for that fallback element. Set both nonce and data-nonce: browsers hide the nonce attribute value, while data-nonce is always readable.

<script src="https://api.axoryn.io/widget.js"
  data-project-key="YOUR_WIDGET_KEY"
  nonce="RANDOM_PER_REQUEST_NONCE"
  data-nonce="RANDOM_PER_REQUEST_NONCE" async></script>

Limit the widget to your sites

By default your widget key works on any site. To limit it:

  1. Open the project and select Settings.
  2. Go to the Identity verification and allowed sites section (Security in the section list).
  3. In Allowed sites, enter one entry per line.
  4. Select Save changes.
EntryMatches
acme.comacme.com on any scheme and port. Subdomains do not match.
*.acme.comacme.com and every subdomain, such as app.acme.com.
https://app.acme.comOnly that exact origin (scheme, host and port).

You can add up to 50 entries. Leave the field empty to allow any site. When the list is not empty, the widget on any other site gets an origin_not_allowed error and cannot load its settings or chat.

Note: Add every domain you test on, including staging and preview domains. Requests from a site that is not on the list are refused.

Confirm the widget is live

You do not need to confirm anything. The first time a page with the snippet loads on a real site, Axoryn records it:

  • the onboarding install step shows Widget detected on your site, with the time of the first ping,
  • the project home panel shows Widget detected on your site,
  • the Install section of Account settings shows the project as Installed.

The project home panel checks every 10 seconds. The onboarding step also has Check now.

Some visits do not count as the install:

  • Local development addresses (localhost, 127.0.0.1, 0.0.0.0, ::1, and hosts ending in .local, .test or .localhost) are recorded as a test install. The onboarding step shows Test install detected on that address and keeps waiting for your live site.
  • Axoryn’s own domains are ignored.

Preview and staging domains count once a page with the snippet loads there.

If the widget is not detected

  1. View the page source and search for axoryn. If the snippet is not there, the page was not published or a cached copy is being served.
  2. If you use a CDN or a cache plugin, purge it and reload.
  3. If your site has a strict Content-Security-Policy, check the browser console for Refused to messages and add the sources above.
  4. If you set Allowed sites, make sure this site is on the list.
  5. If you used data-auto-init="false", make sure your code calls Axoryn.init().

If the full widget fails to load, the launcher shows a red dot and its screen-reader label reads Chat unavailable. Tap to retry. Selecting the launcher tries again.

Install status in Account settings

StatusMeaning
”Installed”The widget has been seen on a real site.
”Not installed yet”No page with the snippet has loaded on a real site yet.
”Offline while billing is paused”The project is paused with your subscription.
”Read-only on this plan”The project is over your plan’s project limit.
”Offline until deletion is canceled”The workspace is scheduled for deletion.
Still stuck? Check Troubleshooting or the FAQ. What changed recently