The web widget is a chat window that visitors open from a button on your website. It answers with your agent's live commit. You add it to your site once: changes to the agent reach the widget when you make a new commit live, and changes to how it looks and behaves reach it when you save them in Web Widget Settings, with no change to your site's code.
#Before you start
- A live commit. See Make a commit live, lock a branch, and roll back.
- A Client API key for this agent. Create one under Organization > API Keys > Client API Keys; see API keys. Client API keys are made for web pages, so it's expected that this key appears in your site's code.
- Access to edit your site's HTML, or to add tags in Google Tag Manager.
#Add it with a code snippet
- In the side rail, open Deployment > Deploy web-widget.
- Select the Deploy by code snippet tab.
- Under Insert the module script, click Copy and paste the script right before the closing
</head>tag of your pages. - Under Add the widget root to your body, click Copy and paste the tag anywhere inside
<body>. - Under Initialize the widget, click Copy and paste the script right before the closing
</body>tag. - In the script you pasted, replace
your-publishable-keywith your Client API key. - Update your site with the changed pages and open one of them. The widget's button appears in the corner.
Copy the code from the page rather than retyping it. The initialization script is where the key goes:
<script>
window.addEventListener('DOMContentLoaded', () => {
window.auiSettings.init({
apiKey: 'your-publishable-key',
});
});
</script>#Add it with Google Tag Manager
- Open Deployment > Deploy web-widget and select the Deploy by GTM tab.
- Under Prepare the widget code, copy the three pieces: the Module script, the Custom HTML tag for body and the Initialization script. Replace
your-publishable-keyin the initialization script with your Client API key. - In Google Tag Manager, create a tag of type Custom HTML and paste the module script. Trigger it on all pages, or on the pages where the widget should load.
- Create a second Custom HTML tag with the custom HTML tag for the body.
- Create a third Custom HTML tag with the initialization script, with the same trigger as the others.
- Submit your changes in Google Tag Manager so they reach your site. Name the change after the widget, so it's easy to find later.
- Visit your site to check that the widget appears. Use Google Tag Manager's Preview mode to confirm the tags fire.
The Deploy by GTM tab repeats these steps, with a link to Google's own setup guide.
#If the widget doesn't appear
- Check that the key in the initialization script is a Client API key for this agent, and that its status is active on the Client API Keys page.
- Check that all three pieces are on the page, with the module script in the
<head>. - Check that the agent has a live commit.
- Look for errors in the browser's console.
#Customize the widget
Open Deployment > Web Widget Settings in the side rail to set how one agent's widget looks and behaves. Your website picks up saved changes on its own.
The page has four tabs on the left (Appearance, Behavior, Follow-ups and Advanced), the settings in the middle, and a Live preview of the widget on the right. The preview needs a Client API key for the agent. Without one, it says the widget can't load and links to where you add a key.
The Ready to go live? box on the left links to Deploy widget, the code for your site described above. If you have unsaved changes, it reminds you to save first.
#Save or discard
Changed fields are marked, and the bar at the bottom counts them, for example "2 unsaved changes". Click Save to apply them to the widget on your website, or Discard to return to the saved settings. Your website always shows the saved settings.
#Appearance
The Appearance tab has five sections:
| Section | What you set |
|---|---|
| Widget | Position on the page (Bottom right, Bottom left, Top right or Top left) and Font. |
| Launcher | The button visitors click to open the widget: its Style (Image and Text, Image + arrow or Icon), its image or icon, its text, and its colors. |
| Header | Header style (Agent name and image or Company logo), the Agent name and Agent image, or the Logo and Logo alignment, the header colors, and the Close widget icon (Chevron, Straight line or Close (X)). |
| Chat panel | The colors of the agent's and the visitor's messages, and of their text. |
| Footer | The message box's Placeholder text, Send button background and Send icon color. |
The Header section also has four switches:
- Allow close chat shows the close button in the widget's header.
- Allow new chat lets visitors start a fresh conversation from the header.
- New-chat confirmation asks visitors to confirm before starting a new chat.
- Show online status shows "Online" under the agent's name. It isn't available with the Company logo header style.
#Behavior
Under General:
- Enable new message sound plays a sound when a new message from the agent arrives.
- Allow transcript download lets visitors download the conversation from the widget header's menu.
Some options on this tab, such as partial mode, swipe and the default state on desktop and mobile, aren't available yet and appear dimmed.
#Follow-ups
Suggestion colors sets the Text, Background and Border colors of the follow-up suggestion chips the widget shows.
#Advanced
Agent variables is a code editor for JavaScript that passes agent variables with the widget's conversations, such as the ID of the customer signed in to your site. The editor checks the code as you type, and Code contains syntax errors blocks saving until you fix it.
The agent only uses variables its program declares. See Agent variables and test callers, and agent variables in the developer docs.