AskMavis
HelpChangelogRoadmapFeedback
  • Getting started
  • Your AI agent
  • Actions and procedures
  • Install your agent
    • Add the messenger to your website
    • Share a chat page link
    • Sign in your visitors (identity verification)
    • Add your agent to a Next.js site on Vercel
  • Helpdesk
  • Contacts
  • Help center and boards
  • Workspace and account
  • FAQ
Install your agent

Add the messenger to your website

Paste one snippet to put your AI agent on any website, with steps for popular site builders.

AT
Written by AskMavis Team
Published 54m ago

The messenger is the chat widget your AI agent answers in. You add it to your website by pasting a short install code once.

The Install tab of an AI agent, with the Enable widget button, the Website install code and steps for each website builder.

Animation: on the Install tab the widget is enabled, the install code is copied and pasted into the footer code of a website builder and saved, then the launcher appears on the website and opens the messenger.

What the animation shows:

  1. On Install, click Enable widget.
  2. Copy the website install code.
  3. Paste it into your site's footer code and save.
  4. Open your website. The launcher appears, and clicking it opens the messenger.

Before you start

  • Your agent has some training content and you've tested it in the Playground.
  • You can edit your website's code, or its site builder lets you add custom code.

1. Allow your website

  1. Open your agent and go to Guardrails.
  2. Under Allowed domains, type each website the widget may load on, for example example.com, and click Add. A note under the box shows how a pasted address will be saved.
  3. Click Save changes.

The plain address and its www version count as the same site, so example.com covers www.example.com. You can paste a full page address: the path and port are ignored. Other subdomains such as shop.example.com need their own line, or *.example.com to cover them all. The widget won't load on sites that aren't listed.

2. Turn on the widget

Go to Install and click Enable widget. The button appears once you have saved an allowed domain. You can click Take offline at any time to hide it everywhere.

3. Paste the install code

Copy the Website install code from the Install tab. Paste it at the end of the body on every page where the messenger should appear, just before the closing </body> tag. It looks like this:

<script src="https://mavis.help/messenger.js" referrerpolicy="strict-origin-when-cross-origin" async></script>
<script>
  window.AskMavisMessenger = window.AskMavisMessenger || [];
  window.AskMavisMessenger.push({
    messengerConfigId: "your-agent-id",
    consent: 'granted',
  });
</script>

Always copy the code from your own Install tab, since it contains your agent's ID. If your site has a Content Security Policy, allow https://mavis.help.

Site builders

Under Where to paste the code on the Install tab, pick your website builder to see its steps.

WordPress: install a free header and footer code plugin, such as WPCode (Insert Headers and Footers). Open its Header & Footer settings, paste the code into the Footer box and save. Or add a Custom HTML block to your footer in Appearance > Editor and paste the code there.

Wix: open Settings > Custom Code and click Add Custom Code. Paste the code, choose All pages, Load code once and Body - end, then apply and publish. Wix needs a paid plan with a connected domain for this.

Squarespace: open Code Injection and paste the code into the footer, then save. It needs a plan that includes code injection.

Shopify: go to Online Store > Themes, open the ... menu on your theme and choose Edit code. Open layout/theme.liquid, paste the code just before </body> and save.

Webflow: open Site settings > Custom code, paste the code into Footer code and save. Webflow needs a paid site plan for this.

Google Tag Manager: create a Custom HTML tag, paste the code, set the trigger to All Pages, then submit and publish the container.

Check it works

Open your website in a new tab. The chat launcher appears in the corner. Ask it a question.

If it doesn't appear:

  • Check your site's address is in Allowed domains. Whether you type https:// doesn't matter, but a subdomain such as shop.example.com needs its own line or *.example.com.
  • Check the widget is enabled on the Install tab.
  • Check your country isn't in Country blocking.
  • Clear your browser cache or try a private window.

Related

  • Customise the messenger
  • Share a chat page link
  • Sign in your visitors

Was this article helpful?

Contact support

Related articles

  • Share a chat page linkGive your AI agent its own page, with the chat already open, to share in emails, social profiles or a QR code.
  • Sign in your visitors (identity verification)Let your agent recognise signed-in customers securely, so nobody can pretend to be someone else.
  • Add your agent to a Next.js site on VercelLoad the messenger in a Next.js or Vercel project using an environment variable.
← Back to Help Center

On this page

  • Before you start
  • 1. Allow your website
  • 2. Turn on the widget
  • 3. Paste the install code
  • Site builders
  • Check it works
  • Related
Powered by AskMavis