Implementation & How-To· 5 min read· By The SpideyChat Team

Installing a Chat Widget Through Google Tag Manager

Install a chat widget with Google Tag Manager: a Custom HTML tag, the right trigger, consent settings, testing in Preview, and the trade-offs of GTM.


You can install a chat widget through Google Tag Manager by creating a Custom HTML tag, pasting the widget's script tag into it, triggering it on All Pages and publishing the container. It's the usual route for marketers who can change tags but not site code, and SpideyChat lists Tag Manager as a supported install method. The two things to decide on purpose are the trigger and the consent settings, because a Custom HTML tag fires regardless of consent unless you tell it otherwise.

Here is the setup, then the parts that need thought.

Create the tag

At the time of writing (October 2026), the steps in Tag Manager are:

  1. Open your container and go to Tags, then New.
  2. Click Tag Configuration and choose Custom HTML.
  3. Paste your chatbot's script tag into the HTML box exactly as you copied it, including the data-bot-id attribute. The widget reads your bot ID from that attribute, so don't strip it out. If you need the ID, see find your bot ID.
  4. Leave Support document.write unticked. The SpideyChat widget doesn't use document.write.
  5. Name the tag something you'll recognise, such as "Chat widget".

Google's help center notes that Tag Manager minifies Custom HTML and can change single quotes to double quotes. That doesn't affect a one-line script tag.

Pick the trigger

For chat on every page, choose the All Pages trigger. It's a Page View trigger, which Google's documentation says fires as soon as the browser begins to load a page. That's early, before the page body exists. The SpideyChat widget handles this: if the body isn't there yet, it waits for the page to finish loading before adding the chat button.

If you want chat on some pages only, create a Page View trigger set to fire on Some Page Views and add a condition on Page Path. Two common patterns:

  • Exclude a section: Page Path does not start with /checkout.
  • Only key pages: Page Path matches your pricing, contact and service pages.

You don't need a DOM Ready or Window Loaded trigger for the widget. Those fire later and only delay the chat button.

Don't worry about the tag firing twice in an edge case. The widget mounts once per bot and ignores a second load on the same page.

Decide on consent

This is the part most installs skip.

Google's Tag Manager help says Custom HTML tags do not have built-in consent checks. Each tag has Consent Settings under Advanced Settings, with three choices:

  • Not set: no additional checks. The tag fires whenever its trigger fires.
  • No additional consent required: the same behaviour, but recorded as a deliberate decision.
  • Require additional consent for tag to fire: the tag fires only if every consent type you list is granted.

The consent types Tag Manager supports include functionality_storage, analytics_storage, personalization_storage, security_storage and the advertising ones.

Which you choose is a decision for whoever owns your privacy setup, not something a vendor should make for you. To help that conversation, here is exactly what SpideyChat's widget stores in the browser:

  • It sets no cookies.
  • The script on your page keeps one session storage flag, so the greeting bubble shows only once per visit.
  • When a visitor opens the chat, the chat frame (served from spideychat.com) stores an anonymous visitor ID in local storage to count returning visitors, plus the visitor's sound on or off choice.

If you require consent before the tag fires, remember the trade-off. Visitors who decline won't see the chat at all, including the ones with a question about your service. Our GDPR checklist for a website assistant covers what to tell visitors and how long to keep transcripts.

Tag Manager can show all of this in one place. Google's help says you can turn on Enable consent overview under Admin, Container Settings, and the overview then lists which tags have consent configured.

Test in Preview, then publish

Saving a tag doesn't put it live. Use Preview first: Tag Manager opens your site connected to Tag Assistant, which shows which tags fired and in what order. Check that the chat tag fired on a normal page, and didn't fire on any page your trigger excludes.

Then click Submit and publish. Google's help says every publish records a version of the container, so if something goes wrong you can roll back to the previous version.

Finally, test the live site in a private window. If the chat button doesn't appear:

  1. Open the browser console and filter for "SpideyChat". The widget writes a line there for a missing bot ID or a website that isn't on the chatbot's license.
  2. Check the license. A SpideyChat chatbot registers the first website it loads on, and other websites need adding under License & websites on the chatbot's page. Free covers 1 website per chatbot, Starter 3 and Pro 10.
  3. Work through our troubleshooting checklist for caches and security policies.

The trade-offs of installing through GTM

Tag Manager is convenient, but it adds a layer.

  • It depends on the container. If Tag Manager doesn't load, for example because a browser extension blocks it, every tag inside it goes too, including the chat. A script tag in your site's footer doesn't have that dependency.
  • It's one more place to look. When someone asks "where does the chat come from?", a developer reading the site's code won't find it. Note it in your container's tag name and in your site documentation.
  • It's the right choice when code access is the bottleneck. If changing the footer means a ticket to a developer, Tag Manager gets the chat live today, and you can move it into the code later.

If you do have access to your platform's footer or code settings, the integrations page lists the direct route for WordPress, Shopify, Wix, Squarespace and Webflow.

Next step

Build the tag, test in Preview, publish, and check the console once. The install the widget doc has the snippet to paste into your tag, plus the direct routes for the common platforms if you later move it into your site's code.

Frequently asked questions

Can I install a chat widget with Google Tag Manager?
Yes. Create a Custom HTML tag, paste the widget's script tag, trigger it on All Pages, then submit and publish the container. SpideyChat lists Tag Manager as a supported install method.
Which trigger should a chat widget tag use?
All Pages, so the chat is available everywhere. Use a Page View trigger with conditions on Page Path if you only want it on certain pages, or want to exclude a path such as /checkout.
Does a Custom HTML tag respect consent mode automatically?
No. Google's Tag Manager help says Custom HTML tags have no built-in consent checks. If your setup requires it, use the tag's Consent Settings to require a consent type before it fires.
Why doesn't my chat widget show after I saved the tag in GTM?
Saving doesn't publish. Until you click Submit and publish the container, the tag only runs in Preview mode. Publish, then test in a private window.

Want a 24/7 AI Employee for Your Website?

See how SpideyChat can answer customer questions, capture leads and handle enquiries while your team is offline.

No obligation. We will review your website and show you how SpideyChat could work for your business.

Keep reading