Customer Support

Add the chat widget

No build step, no npm install — two script tags in your <head>and you're done. The first queues any calls made before the SDK loads; the second loads the SDK itself using your write key.

1

Get your write key

Each client account has its own write key. Log in to your account and go to:

Log in to your accountConfigurationsSDK Keys tab
NOTE

Use the prod key (ax_prod_…) for your live site and the staging key (ax_stg_…) for development — they're prefixed so they're easy to tell apart.

2

Paste the snippet into your <head>

Copy the block below and paste it inside <head>, before the closing </head> tag. Replace YOUR_WRITE_KEY with the key from step 1.

index.html — paste before </head>
<script>
(function (w, d, s) {
  var q = [];
  function stub() { q.push(arguments); }
  stub.q = q;
  w.campaign = w.campaign || stub;
})(window, document, 'script');
</script>
<script async
  src="https://config.axilrate.com/sdk/campaign.min.js"
  data-write-key="YOUR_WRITE_KEY"
></script>
REPLACE

YOUR_WRITE_KEY is the only value specific to your site — everything else in the snippet stays the same for all accounts.

2a

What each piece does

The first <script> block is a synchronous stub that queues any campaign(…) calls made before the real script finishes loading — nothing is lost if your own code calls it higher up the page. The second loads the SDK itself with async, so it never blocks page render. data-write-key identifies which account it belongs to.

2b

Optional data attributes

Add these to the same <script> tag to control SDK behaviour without writing JavaScript:

AttributePurpose
data-write-keyRequired — identifies your account.
data-support-widget="false"Disable the auto-mounted chat widget.
data-user-id-cookieAuto-identify a returning logged-in visitor from a cookie your login flow already sets.
data-webpush-prompt="true"Auto-show the web push opt-in prompt a few seconds after load.
3

Verify

Confirm the SDK loaded and your write key is being picked up.

  1. 1Open your site and open DevTools → Console.
  2. 2Type window.campaign and press Enter — you should see the SDK object, not undefined.
  3. 3In the Network tab, confirm a request to config.axilrate.com/sdk/campaign.min.js returns 200.
NEXT

Once live, configure the widget's behaviour — bot mode, handoff rules, business hours, and appearance — from the Customer Support settings in your account.

Campaign SDK — Chat Widgetcampaign.min.js