
Once your chat widget is set up in AiEngage CRM, one piece of code, the install script, puts it on your website. You paste it once, and the chat button appears on every page that has it. Anything you change later in the CRM (colours, messages, AI agent, routing, pre-chat form) reaches your website automatically. You never need to paste the script again.
This article takes you through the whole job, one screen at a time:
| Part | What you do |
|---|---|
| 1 | Open the Chat Widget tab, pick your widget and copy its install script. |
| 2 | Understand the four parts of the script, and change the visitor lines if you need to. |
| 3 | Set up signed-in customers (optional): the Logged-in visitors section and the login page. |
| 4 | Paste the script into your website, or into your website builder’s footer code. |
| 5 | Make the widget Active, save, and test it on your website. |
A chat widget set up in the CRM. If you don’t have one yet, follow Set Up the Website Chat Widget first.
Admin access to Customer Support Settings.
Access to your website’s code or its builder settings (WordPress, Shopify, Wix, Squarespace, Webflow, Google Tag Manager…), or the help of whoever manages your site.
About 10 minutes.
Click Customer Support (the headset icon in the left rail), then Settings at the bottom of its sidebar, then the Chat Widget tab. You can also go straight to app.aiengagecrm.com/dashboard/settings/service-support/chat-widget.

What this screenshot shows. The Customer Support Settings page. Its title and row of tabs are ringed, and the arrow points at the selected tab, Chat Widget · Install script & routing (orange).
Customer Support Settings: the page title, with the line “Mailboxes your support team syncs from, the address replies are sent from, and how incoming mail becomes tickets.”
Support Email, From Email, Notifications and General Settings: the other support settings tabs. You don’t need them for this article.
Chat Widget: the tab you need. Its subtitle, “Install script & routing”, tells you the install script lives here.
Below the tabs (faded): “Add live chat to your website and route incoming chats to the right team.”, your list of widgets on the left, and the settings of the selected widget on the right.
On the far left (faded), the Customer Support sidebar: channels, ticket views, teams, and Settings at the bottom, which is how you got here.

What this screenshot shows. The widget list on the left is ringed. Website Support Chat is selected (highlighted), and its settings fill the right-hand side.
Website Support Chat and Help Centre Chat: two sample widgets. Each widget has its own install script, so select the right one first. If you run several websites or brands, you’ll usually have one widget for each.
The small orange dot before each name marks a widget in the list. Click a name to open its settings.
+ New widget: creates another widget. Setting one up is covered in the previous article.
On the right (faded), the header of the selected widget: its name, Agents online (green) and its status, Active. Part 5 explains status.
The install script is near the bottom of the widget’s settings, below Pre-chat form.

What this screenshot shows. The Install script section is ringed: its title, its instruction, the script in the dark box, and the two notes under it.
Install script: the section title.
“Paste this just before the closing </body> tag on every page you want the widget on.” This is the one rule to remember. Part 4 shows exactly where that is.
The dark box: the script itself. It already contains this widget’s ID, so it’s ready to use as it is. Part 2 explains each part.
Copy (top-right corner of the dark box): copies the whole script for you (Step 4).
Signed in customers. and Past tickets: two short notes about the visitor lines, explained in Step 7.
Below (faded), the start of the Logged-in visitors section (Part 3), and the bar with Delete widget and Save changes, which stays at the bottom of the screen.

What this screenshot shows. The Copy button in the top-right corner of the dark script box is ringed.
Click Copy to put the complete script on your clipboard. Copying with the mouse risks missing the first or last character, and then the script won’t run.
The button sits in its own band above the code, so it never hides a line of the script.

What this screenshot shows. Straight after you click it, the button changes to ✓ Copied (ringed). After about two seconds it changes back to Copy.
The script is now on your clipboard. Paste it into your website (Part 4), or into an email to whoever manages your site.
If your browser blocks copying, you’ll see the message “Could not copy. Select the snippet and copy it manually.” In that case, click inside the dark box, press Ctrl + A (Cmd + A on a Mac) to select it, then Ctrl + C (Cmd + C).
You don’t have to understand the script to use it. But it has four parts, and knowing them helps you decide what to change and what to leave alone.
| Part | What it does | Change it? |
|---|---|---|
| The stub (top lines) | Prepares a place for your settings before the widget arrives, so the order things load in never matters. | No |
| The visitor lines | Tell the widget who is signed in on your website. | Yes: replace or delete them (Step 6) |
| The store lines (comments) | Optional: keep chats separate when one widget runs on several stores. | Only if you run several stores (Step 7) |
| The loader (bottom lines) | Loads your widget from AiEngage using its widget ID. | No |

What this screenshot shows. Near the bottom of the script, the two lines that set data-widget-id and data-backend-url are ringed.
js.setAttribute('data-widget-id', '…'); tells the script which widget to show. The value is filled in for you (here a sample ID, wsample1websitesupport7k2). Each widget has its own ID.
js.setAttribute('data-backend-url', 'https://app.aiengagecrm.com/cback/api'); tells the widget where to send chats. Leave it as it is.
Never edit these values. If you want a different widget on a page, copy that widget’s own script instead.

What this screenshot shows. The last block of the script, from var js = d.createElement(s); to the line ending in crm-widget-loader.js');, is ringed.
These lines add the widget loader, crm-widget-loader.js, to your page. It loads in the background (js.async = true), so it never slows your page down.
Because the widget is loaded from AiEngage every time, updates and setting changes reach your site without you touching the code.
The two lines from Step 5 sit inside this block.

What this screenshot shows. Inside the script, the two lines that set the visitor’s name and email are ringed.
w.crmwidget.visitor.name('Mark Holt'); and w.crmwidget.visitor.email('mark@example.com'); are examples only. Don’t leave them as they are.
If customers sign in to your website, replace the example values with the signed-in customer’s real name and email, written into the page by your website (see below).
If your website doesn’t know who is visiting (no customer accounts), delete both lines. Visitors then fill in the pre-chat form, if you set one up.
The email is what counts. It identifies the visitor, so they skip the pre-chat form and see their own tickets under My tickets. The name only pre-fills the form.
Most website platforms have a template tag for the signed-in customer. Your developer replaces the example values with it. It looks something like this, but the exact tag depends on your platform:
w.crmwidget.visitor.name('{{ customer.name }}');
w.crmwidget.visitor.email('{{ customer.email }}');
What this screenshot shows. The comment block starting // KEEP CHATS SEPARATE PER STORE (optional). is ringed.
These lines start with //, which means they are switched off. Nothing happens unless you use them.
Running one store or one website? Leave them as they are, or delete them.
Running several stores with the same widget? Give each store a different ID, for example w.crmwidget.visitor.account('store_1'); on the first store and 'store_2' on the second. The same customer’s chats and tickets then stay separate per store instead of mixing.
The full walkthrough is in the next article, One Chat Widget Across Several Stores.

What this screenshot shows. The two notes directly under the script are ringed.
“Signed in customers. Swap the values for your own, rendered by your server — or delete both lines if your pages do not know who is visiting.”
“email is what identifies the visitor: they skip the chat form, and My tickets shows the tickets on that customer’s record. The name only pre-fills the form.”
“Call crmwidget('logout') when they sign out, or the widget keeps recognising them on that browser.” See Step 9.
“Past tickets need nothing more — the email above selects the customer, so My tickets shows the tickets on their record.” You don’t have to set anything else up for customers to see their old tickets.
Skip this part if your website has no customer accounts.

What this screenshot shows. The Logged-in visitors section, directly under the install script, is ringed. Its badge reads Enabled.
“Let visitors see their own tickets in the widget. Tell the widget who is visiting with crmwidget.visitor.email() and My tickets works — nothing to compute, and no secret needed.”
“Applies to every chat widget in your organization.” This section is shared, so a change here affects all your widgets.
Login page URL, with Save URL: explained in the next figure.
How visitors are recognised: your site calls crmwidget.visitor.email('customer@example.com') with the signed-in customer’s address (the visitor line from Step 6 does exactly this). That address selects the customer, so they can chat and raise tickets without the form. A visitor who fills in the form instead is remembered the same way on later visits.
The last note: call crmwidget('logout') when a customer signs out (Step 9).

What this screenshot shows. The Login page URL field is ringed, with its Save URL button and its hint.
Login page URL: the address of your website’s sign-in page, for example https://yourcompany.com/login.
“Where the widget’s Log in button takes a visitor who is not signed in. Leave empty to hide the button.” A visitor who isn’t signed in sees a Log in button on the widget’s Tickets tab. It takes them to this page.
Save URL: saves the address straight away. It doesn’t need Save changes. It stays greyed out until you change the address, and it must be a full https:// address, or you’ll see “Enter a full https:// address.”
The widget remembers a recognised customer in their browser. When they sign out of your website, have your site run:
// when the customer signs out of your website
crmwidget('logout');If customers sign in without a page reload (for example in a single-page app), call the same visitor line the install script uses, with the values you already hold:
// signed in without a page reload (single-page apps)
crmwidget.visitor.email('customer@yourcompany.com');crmwidget('logout') matters most on shared computers. Without it, the next person using that browser is still treated as the previous customer.The script goes just before the closing </body> tag of your pages. Put it in the part of your site that appears on every page, such as the footer or main layout template. Then you only add it once.

What this screenshot shows. The source code of a sample website (in Chrome: right-click the page → View page source). The ringed block, lines 29 to 63, is the chat widget script, pasted just before </body>.
Line 29: a comment, <!-- AiEngage chat widget: pasted just before </body> -->, so whoever edits the site later knows what the code is for. Optional, but helpful.
Lines 30 to 62: the script exactly as copied, from <script> to </script>. Here the widget ID is a placeholder, YOUR-WIDGET-ID. Yours holds your real ID.
Lines 40 and 41: the example visitor lines. On a real site they are replaced or deleted (Step 6).
Line 63: </body>. The script comes directly before it.
Everything above (lines 14 to 27) is the website’s own content and styles. Leave it as it is.
Use this same View page source check on your live site afterwards: press Ctrl + F and search for crm-widget-loader to confirm the script is there.
Most builders have a “custom code” setting that adds code to every page. Paste the whole script there. Common places to look:
| Platform | Where to paste the script |
|---|---|
| WordPress | Your theme’s footer.php, just before </body>, or a “header and footer scripts” plugin. Paste into the footer box. |
| Shopify | Online Store → Themes → ⋯ → Edit code → theme.liquid, just before </body>. |
| Wix | Settings → Custom code → Add custom code → place it in Body – end, on all pages. |
| Squarespace | Settings → Developer tools (or Advanced) → Code injection → Footer. |
| Webflow | Site settings → Custom code → Footer code, then publish. |
| Google Tag Manager | A Custom HTML tag containing the script, firing on All Pages. |
The script only shows the chat button when the widget’s status is Active. A Draft or Inactive widget stays hidden, even with the script on your site. That’s useful: you can install the script first and go live when you’re ready. The CRM warns you in three places if the widget isn’t live yet.

What this screenshot shows. Here the second sample widget, Help Centre Chat, is selected. The ring runs from its name in the list to its status at the top right, which reads Draft.
Help Centre Chat (highlighted in the list): the selected widget. Its name also appears as the heading on the right.
Agents online (green): at least one agent who can take chats is available right now.
Draft: this widget is still being set up, so it won’t appear on any website yet.

What this screenshot shows. In the Install script section of the Draft widget, the title, its instruction and the red warning are ringed.
“This widget is a draft, so the script above will not load on your site — the widget answers Widget not found until it is live. Set its status to Active and save.”
For an Inactive widget the warning says “inactive” instead of “a draft”.
Below it (faded) is the same script as before, with this widget’s own ID. You can copy and install it now. It starts working as soon as the widget is Active.
The warning disappears once the widget is Active and saved.

What this screenshot shows. If you click Copy on a widget that isn’t live, this message appears in the bottom-right corner (ringed).
“Copied — but this widget is not live yet.” The script was copied anyway.
“It is still a draft, so it will not load on your site. Set it to Active and save.” (For an Inactive widget: “It is inactive, so it will not load on your site…”)
It reminds you at the moment you’re about to paste the script into a real site.

What this screenshot shows. At the bottom of the section, under Logged-in visitors, a third reminder is ringed.
“This widget is draft. The script will load, but the widget stays hidden until you set it to Active.”
Put simply: the code on your website is fine, but visitors won’t see a chat button until you complete Steps 13 and 14.
Scroll back to the top of the widget’s settings and click the status list at the top right.

What this screenshot shows. The status list at the top right of the widget is open and ringed. Draft has a tick because it’s the current status.
Draft: being set up. Hidden from visitors.
Active: live. Visitors see the chat button on every page that has the script. Choose this one.
Inactive: switched off, for example while you pause chat on that site. The script can stay on your site and the button simply disappears.

What this screenshot shows. The bar at the bottom of the widget’s settings is ringed.
Save changes (orange, right): saves the new status and any other change on this widget. Choosing Active doesn’t take effect until you click it.
Delete widget (red, left): removes the widget. Its script then stops working on every site it’s installed on, and a new widget gets a new ID. So only delete a widget you’ve already taken off your website.
This bar stays at the bottom of the screen wherever you are on the page, so you don’t need to scroll down to save.

What this screenshot shows. A confirmation appears in the bottom-right corner (ringed): Widget saved.
The status at the top right now reads Active.
The rest of the page (faded) is the same widget, Help Centre Chat, with its settings unchanged.

What this screenshot shows. Scroll back down: the Install script section is ringed again, and the red warning has gone.
The instruction and the script are unchanged, so code you pasted before going Active keeps working. You don’t need to copy it again.
The widget ID in the script (here wsample2helpcentre9q4x) is this widget’s own.
Open your website in a new browser tab, or a private window, and reload the page.

What this screenshot shows. A sample website (“YourCompany”) with the chat widget installed. The chat button in the bottom-right corner is ringed.
The round chat button, in your widget’s accent colour. It floats above your page content on every page that has the script.
Its corner (bottom right or bottom left) and distance from the edges come from the widget’s Launcher position settings in the CRM.
The rest of the page (faded) is the website itself. The widget doesn’t change it.

What this screenshot shows. After clicking the chat button, the open chat window is ringed.
The header: your widget’s logo, heading (Website Support Chat) and sub heading (We are here to help you!) in your colours, with ✕ to close it.
Send us a message / We typically reply in a few minutes: the home card (its title and subtitle are set in the widget). Visitors click it to start chatting.
Home, Messages and Tickets: the tabs at the bottom. Messages lists the visitor’s conversations, and Tickets their support tickets.
The round button below: while the chat is open, the chat button turns into a down arrow. Click it to close the window.
What visitors see after that, chatting with the AI agent, reaching a person, offline messages and tickets, is covered in What Customers See in the Chat Widget.
The chat button doesn’t appear. Check in this order: the widget is Active and saved (no red warning under Install script); the script is on the page (View page source, search for crm-widget-loader); it’s complete, from <script> to </script>; it sits before </body>; your site was published; and you reloaded without the cache (Ctrl + Shift + R).
“Widget not found”. This is what the widget answers when it is Draft or Inactive, or has been deleted. Set it to Active and save, or copy the script of a widget that exists.
It appears on some pages but not others. The script is only on those pages. Move it to the shared footer or layout template.
Every visitor is treated as “Mark Holt”. The example visitor lines were left in. Replace them with the signed-in customer’s details, or delete them (Step 6).
The wrong widget shows. The script belongs to a different widget. Select the widget you want (Step 2) and copy its own script.
A customer still appears signed in after logging out. Your site needs to run crmwidget('logout') when they sign out (Step 9).
The Log in button is missing from the Tickets tab. Login page URL is empty. Enter your sign-in page and click Save URL (Step 8).
A customer sees chats from another of my stores. Give each store its own ID with the store line (Step 7), as described in One Chat Widget Across Several Stores.
The button covers something on my site. Change Launcher position (bottom right or bottom left) and the distance from the bottom and side in the widget’s settings, then save. No code change is needed.
Changes in the CRM don’t show. Click Save changes on the widget, then reload your site. You never need to paste the script again.
Next: One Chat Widget Across Several Stores: Keep Each Store’s Chats and Tickets Separate (Step-by-Step)
OpenAI Engage and apply what you just learned to your own workspace.
Open AI Engage CRM