How to add an AI chatbot to Google Tag Manager
Updated · 3 min read
If your website already loads Google Tag Manager, you can add the chatbot without touching the site's code at all. It's one Custom HTML tag that fires on every page.
Before you start
- Build your assistant in the Chatty4All editor: pick a design, then teach it about your business.
- Under Go live → Websites it may run on, add your website's address. The assistant only loads on the sites listed there, so nobody can copy your code onto theirs.
- Publish it. The editor then shows your code with your own assistant id in place of
YOUR_BOT_ID.
Your code
This is the whole install. Copy yours from Go live in the editor: it's the same line with your id filled in.
<script src="https://chatty4all.design/widget.js" data-bot="YOUR_BOT_ID" async></script>Add it to Google Tag Manager
- In Google Tag Manager, create a new tag → Custom HTML and paste the line.
- Trigger: All Pages. Submit and publish the container.
- No developer needed — works on any site already using GTM.
Tips for Google Tag Manager
- Use GTM's Preview mode to check the chat appears before you publish the container.
- GTM only runs where its own container code is installed. If some pages don't load GTM, the chat won't show on them either.
- Add every domain the container runs on under Go live → Websites it may run on.
Showing the chat inside a page instead
The Inline layout renders where its tag sits on the page, which GTM doesn't control. For an in-page chat, paste the line into the page itself instead.
Check it worked
- Open your live site in a private window. The chat button should appear in the corner within a few seconds.
- If it says it isn't enabled for this site, add that exact domain under Go live → Websites it may run on.
- If nothing appears, check that you published the assistant and that the line is on the page (view the page source and search for
widget.js).
Would you rather let your AI coding assistant do it? See install the chatbot with Cursor, Claude, Lovable, v0 or Bolt.