How to add a chatbot to your website, on any platform
Most chatbot tools install the same way: one line of code (a script) pasted into your site’s template. What changes is where you paste it on each platform. This guide shows the right place on the popular ones, and what to check if the chat doesn’t appear.
Published · Updated
In short
To add a chatbot to your website, copy the embed code (a script tag) from your chatbot tool and paste it just before the closing </body> tag on every page, or into your platform’s footer or custom code field (a plugin on WordPress, theme.liquid on Shopify). With Gental the code is a single line, and the widget runs only on the domains you allow.
Before you start: what you need
- A chatbot that answers from your website content and files, tested before you publish it.
- The embed code from your chatbot tool (usually a single <script> line).
- Admin access to your website or store so you can edit the theme or add custom code.
- A list of your domains (like example.com and www.example.com) if the tool limits the widget to specific domains.
- A backup of your theme before any change, especially on Shopify and WordPress.
Add a chatbot to a plain HTML website
If your site is HTML files or built with a framework and you have access to the code:
Open the shared template
Find the file every page uses (the main template, layout or footer include).
Paste the code before </body>
Put the script line right before the closing body tag. The async attribute lets the page load without waiting for the chat.
Publish and test
Deploy the change, open the site in a private window and check that the chat icon appears and replies.
Worked example: the Gental widget code, part by part
This is what the widget code you copy from the Gental publish page looks like (the key here is a placeholder): <script async src="https://cdn.gental.ai/w.js" data-agent="pk_live_xxx" data-locale="en"></script>. Each part has a job:
| Part | What it does | When to change it |
|---|---|---|
| async src="…/w.js" | Loads the widget in the background without delaying the page | Never |
| data-agent | Your agent’s public key; it decides which agent answers | Never; copy it whole from the publish page |
| data-locale | The widget language: ar or en. Without it, the widget reads the page’s lang, then the browser language | On a bilingual site, set ar on Arabic pages and en on English ones |
| data-position | Pins the chat bubble to the right or left. By default it sits bottom-right on Arabic pages and bottom-left on English ones | When the bubble covers another button, like the cart or a WhatsApp button |
| data-color | The bubble colour before the panel opens; after that the agent’s colour applies | When you want it to match your site from the first moment |
You can also open the chat from your own button, such as “Talk to us”, by calling Gental("open") once the code has loaded.
React, Next.js and Vue sites (single-page apps)
On sites that move between pages without a full reload, add the code once, in the main template (such as index.html or the root layout), not on every page or component. That way the chat window stays open and the conversation continues as the visitor moves around.
On Next.js, put it in the root layout with the Script component and a strategy that loads after the page is interactive. Whatever the framework, the rule is the same: never load the code twice.
How to add a chatbot to WordPress
The easiest way without touching theme files is a header and footer code plugin:
Install a code plugin
Under Plugins, install a plugin such as WPCode (formerly Insert Headers and Footers) and activate it.
Paste the code in the footer
In WPCode go to Code Snippets, then Header & Footer, paste the chatbot line into the Footer box and save.
Clear the cache
If you use a caching plugin, clear it, then open the site and check the chat appears.
Add a chatbot to Shopify, Webflow, Wix, Salla and Zid
Where to paste the code on each platform. Menu names can change as platforms update, so check the official help centres, such as Shopify’s guide to editing theme code and Wix’s guide to custom code:
| Platform | Where to paste the code | Notes |
|---|---|---|
| Shopify | Online Store, then Themes; from the theme menu choose Edit code, open layout/theme.liquid and paste before </body> | Shopify recommends duplicating your theme before editing |
| Webflow | Site settings, then Custom code, in the Footer code field | Custom code needs a paid Site plan or a paid Workspace plan |
| Wix | Settings, then Custom Code (under Development & integrations); click Add Custom Code, choose All pages and Body - end | The site must be published with a connected domain |
| Salla and Zid | In your store settings, if your plan allows adding custom code or scripts | Check your plan or ask the platform’s support before relying on this |
Worked example: a Shopify perfume store, live in an afternoon
Let’s follow a perfume store on Shopify from the first step until the chat answers its first visitor. The same idea applies to any online store.
Build the agent from the store’s pages
Add the store URL so the agent reads the product pages and the shipping and returns policy, and upload a file with the questions you get every day: delivery times by city, payment methods, whether the perfumes are original.
Connect the Shopify store tool (optional)
The Shopify store tool (beta, from the Starter plan) lets the agent search your store’s policies directly, and products too once your store enables its catalog tools, so it replies with details and availability. Tools that edit the cart stay off unless you turn them on.
Test it in the playground
Ask the way customers ask: “Do you have a woody scent for summer?”, “How many days to Jeddah?”, “Can I return a perfume I’ve opened?”. Fix the knowledge until the replies are right.
Add the allowed domains
Add the store’s domain exactly as it shows in the browser, the www version if you use it, and any other domain the store opens on.
Paste the code into a copy of the theme
Duplicate the theme, open Edit code on the copy and paste the code into layout/theme.liquid before </body>. Open the preview and check the bubble doesn’t cover the cart button; if it does, use data-position.
Publish the copy and watch the first week
Publish the edited theme and follow the conversations in the inbox. The questions the agent couldn’t answer are your to-do list for next week.
Adding a Gental AI chatbot to your website
In Gental you prepare the agent first: upload files or add your website, pick a persona and try it in the playground. After you publish, copy the widget code from the publish page (a single script line) and paste it using the steps for your platform above. Everything about the widget is on the website chatbot page.
Once you add your domains to the allowed domains list, the widget runs only on them, so if someone copies your code onto another site it won’t work. It sets its direction automatically, right-to-left for Arabic and left-to-right for English, and replies to each visitor in their language.
Visitors can write in any dialect and send voice notes, and, when you turn on file reading, images and files too; the agent reads them and answers. When a person is needed, the chat moves to your team inbox and a teammate replies in the same chat window. The widget is available on the Free plan, and removing the Gental branding from it is available on the Growth and Business plans.
Chatbot not showing on your website? Check these
- Domain: did you add the domain exactly as it shows in the browser? example.com and www.example.com may count as different domains.
- Cache: clear your site cache, caching plugins and CDN, then test in a private window.
- Placement: make sure the code is in a template every page uses, not on one page or an inactive theme.
- Content Security Policy (CSP): if your site uses a CSP, add https://cdn.gental.ai to script-src (so the code loads) and to frame-src (so the chat window opens).
- Ad blockers: some extensions hide chat widgets. Test in a browser without extensions.
- Publishing: on Webflow, Wix and similar platforms you need to republish the site after adding code.
- Browser errors: open the developer tools (F12) and look at the Console tab. A message about the CSP or a domain that isn’t allowed points straight to the cause.
Common mistakes once the chat is live, and how to fix them
The chat shows up? Great. These are mistakes we see often after installation, and all of them are easy to fix:
- The allowed domains list is empty: the widget then runs on any site that pastes the code. Add your domains so it runs only on yours.
- The bubble covers an important button: the cart, a floating WhatsApp button or the cookie banner. Move it to the other side with data-position.
- The chat opens in the wrong language: make sure the html tag on your pages has the right lang, or set data-locale yourself on each language version.
- The code is pasted in two places: once in a plugin and once in the theme. Keep it in one place so you always know which one is live and can change it easily.
- The chat went live before the knowledge was ready: a visitor who asks about shipping or prices and gets “I don’t know” loses trust. Test in the playground first.
- The fact exists, but only inside an image: offer banners and price tables saved as pictures can’t be read as text from your site. Put the fact in text on a page or in a file.
- Your content changed and the agent didn’t notice: after changing prices or policies, check that website sync is running, or update the file yourself.
- Nobody picks up handovers: if “Talk to a person” is on, make sure the team watches the inbox during working hours.
Website first, or WhatsApp first?
Your website is the easiest start: one line of code, available on the Free plan, and you see what visitors ask before they decide to buy. But in Saudi Arabia and the Gulf most customers prefer to continue on WhatsApp, so the natural next step is a WhatsApp AI agent with the same agent and the same knowledge.
If you are still weighing a button-based chatbot against an agent that understands questions, read AI agent vs chatbot. If you want an agent that serves customers and also helps your team internally, see AI employee. And if you are comparing Gental with global website chat tools, we have a Gental vs Chatbase comparison.
Sources
- Shopify Help Center: Edit theme codeas of October 2026
- WPCode on WordPress.orgas of October 2026
- Wix Help Center: Embedding custom code on your siteas of October 2026
- MDN: The script element and the async attributeas of October 2026
- MDN: Content Security Policy (CSP)as of October 2026
Common questions
How do I add a chatbot to my website?
Copy the embed code from your chatbot tool and paste it before </body> in your site template, or into your platform’s footer custom code field, then publish and test.
Should the chatbot code go in the head or the body?
Just before the closing </body> is best, so it loads after the page content. If you use Google Tag Manager, you can add it as a Custom HTML tag that fires on all pages.
Can I show the chatbot on certain pages only?
On most platforms, yes: Wix and WPCode let you choose pages, and on a plain HTML site you add the code only to the pages you want.
Do I need a developer to add a chatbot?
Usually not. Pasting one line into a custom code field, or using a plugin on WordPress, is enough. You only need a developer if your theme is fully custom.
Can I add a chatbot to a Salla or Zid store?
It depends on your plan and the platform’s settings for custom code. Check your store settings or ask the platform’s support.
Does the chatbot support Arabic and right-to-left?
That depends on the tool. The Gental widget switches automatically between Arabic and English, replies in the visitor’s language and understands dialects.
Keep reading
- Website chatbotAn AI chatbot for your website that answers from your knowledge, added with one line.
- Arabic AI chatbotAn Arabic chatbot that understands dialects and Arabizi, and replies in the dialect you choose.
- Data privacyWhere your data is stored, what reaches the model provider, and how we protect it.
- E-commerce chatbotAn agent that answers on products, shipping and returns, and leaves disputes to your team.
- What is an AI agent?A plain explanation of AI agents, how they differ from chatbots and ChatGPT, and how to keep them accurate.
- Developers (API)Connect your agent to your app and systems with REST, streaming and signed webhooks.
Start today. It answers tonight.
Add your knowledge, pick a persona, publish it on your website. Free to start.
- No card
- No code
- Data stored in Saudi Arabia