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.
Get your write key
Each client account has its own write key. Log in to your account and go to:
SDK Keys tabUse 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.
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.
<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>
YOUR_WRITE_KEY is the only value specific to your site — everything else in the snippet stays the same for all accounts.
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.
Optional data attributes
Add these to the same <script> tag to control SDK behaviour without writing JavaScript:
| Attribute | Purpose |
|---|---|
| data-write-key | Required — identifies your account. |
| data-support-widget="false" | Disable the auto-mounted chat widget. |
| data-user-id-cookie | Auto-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. |
Verify
Confirm the SDK loaded and your write key is being picked up.
- 1Open your site and open DevTools → Console.
- 2Type
window.campaignand press Enter — you should see the SDK object, notundefined. - 3In the Network tab, confirm a request to
config.axilrate.com/sdk/campaign.min.jsreturns 200.
Once live, configure the widget's behaviour — bot mode, handoff rules, business hours, and appearance — from the Customer Support settings in your account.