Put the chat on your website
It is one line of code. Paste it once, in the part of your site every page shares, and the chat appears on every page.
Step 1: Copy your code
Sign in and open Install. Your code is one line, with your own site key in place of
st_your_site_key. We also email it to you when you add your website.
<script async src="https://app.aichatforwebsite.com/w.js" data-site="st_your_site_key"></script>Step 2: Paste it once, just before </body>
Put it in the footer, layout or template that every page shares, on the line just before
</body>. Paste it once there, not on each page: every page that uses that footer gets the chat.
Not sure where that is? See where to paste it for your website builder.
Step 3: Open your site
Open any page. The chat button appears in the bottom right corner. In the portal, the Install page says Widget is live the first time a page with the code loads, and Check my site looks for the code for you.
Where to paste it
Pick your website builder or framework. Each one has a place for code that runs on every page.
WordPress
- Download our WordPress plugin.
- In WordPress, go to Plugins, Add New Plugin, Upload Plugin, choose the file, then Install Now and Activate.
- Go to Settings, AI Chat for Website, paste your site key (the
st_…part of your code) and save. - The chat is now on every page. The plugin hides it from logged-in editors and administrators, so open a private window to see it as a visitor.
- Prefer not to use the plugin? Install a header and footer plugin such as WPCode, then paste the code into its Footer box and save.
Shopify
- Go to Online Store, Themes, then Edit code.
- Open
theme.liquid. - Paste the code on the line just before
</body>and save.
Squarespace
- Go to Settings, Advanced, Code injection. This needs a plan that allows code injection.
- Paste the code into the Footer box and save.
Wix
- Go to Settings, Custom code, then Add custom code.
- Paste the code, choose All pages and Body - end, then apply.
Webflow
- Open Site settings, Custom code.
- Paste the code into Footer code and save.
- Publish the site. Custom code only runs on the published site.
Plain HTML
- Open the file every page shares as its footer. If each page is a file of its own, open each one.
- Paste the code on the line just before
</body>, then upload the files.
The end of the file then looks like this:
<footer>…</footer>
<script async src="https://app.aichatforwebsite.com/w.js" data-site="st_your_site_key"></script>
</body>
</html>Next.js
Add it once to the root layout, so every route gets it. In app/layout.tsx:
import Script from 'next/script'
// inside <body>, after {children}
<Script src="https://app.aichatforwebsite.com/w.js" data-site="st_your_site_key" strategy="afterInteractive" />React, Vue or Svelte (Vite)
Add it once to the root layout, so every route gets it. In index.html:
<script async src="https://app.aichatforwebsite.com/w.js" data-site="st_your_site_key"></script>
</body>SvelteKit
Add it once to the root layout, so every route gets it. In src/app.html:
<script async src="https://app.aichatforwebsite.com/w.js" data-site="st_your_site_key"></script>
</body>Astro
Add it once to the root layout, so every route gets it. In src/layouts/Layout.astro (the layout every page uses):
<script async src="https://app.aichatforwebsite.com/w.js" data-site="st_your_site_key"></script>
</body>Let the AI that builds your site add it
If Claude, ChatGPT, Cursor, Lovable or another AI builds or edits your website, give it this prompt. The Install page and the email we send you have it with your own site key already in it, so copy it from there.
Add the AI Chat for Website chat widget to my website (example.com). It is this one script tag:
<script async src="https://app.aichatforwebsite.com/w.js" data-site="st_your_site_key"></script>
- Load it on every page: add it once to the shared layout, template or footer, just before the closing </body> tag, not to each page separately.
- Copy the tag exactly. Keep async and do not change the data-site value: it identifies my site.
- If the site is built with a framework (Next.js, React, Vue, Nuxt, Svelte, Astro), add it once in the root layout. In Next.js use next/script with strategy="afterInteractive" and the same src and data-site.
- If the site sends a Content-Security-Policy, allow https://app.aichatforwebsite.com in script-src and connect-src, and inline styles (style-src 'unsafe-inline') if style-src is restricted.
- Do not add it twice, and change nothing else.
When you are done, tell me which file you changed and how to publish the change.
How it works
- We read your public pages when you add your website, and again from time to time, so the assistant answers from your own content.
- The line is the only change to your site. It loads the chat from
app.aichatforwebsite.comwithasync, so your page does not wait for it. - Questions and answers go between the visitor's browser and us. They never pass through your website or your host.
- Colours, greeting and everything else are set in the portal and apply at once. You do not change the code again.
If the chat does not appear
- You are signed in to WordPress. The plugin hides the chat from editors and administrators. Open a private window.
- Your site is cached. Clear the cache in your caching plugin, host or CDN, then reload.
- The page is on another domain. The chat works on the address you added and its www form. Add a shop or booking domain in the portal under Settings, Website and privacy, Other domains that may show the chat.
- Your site sends a Content-Security-Policy. Allow
https://app.aichatforwebsite.cominscript-srcandconnect-src, and'unsafe-inline'instyle-srcif that is restricted. - Webflow. Publish the site after saving: custom code only runs on the published site.
Still stuck? Email support@aichatforwebsite.com or reply to any email from us, and a person will help.