Installing the Widget with Google Tag Manager

Last updated: September 29, 2026

You can add the Docket widget to your site through Google Tag Manager, so nobody has to edit the site's HTML. Choose this route when your web team already manages third-party scripts in GTM, or when a direct code change would wait for the next release.

What do I need before I add the Docket tag in GTM?

You need access to the Google Tag Manager container that serves the site, permission to publish changes in it, and the script from your agent's Deploy tab.

  • Access to the GTM container used by the website where the widget should appear.

  • Permission to create and publish tags in that container.

  • The agent's script, copied from Deploy > Add widget to your domain or page.

  • The website domain added on the agent's Widget tab, under Whitelist Domains. See Whitelisting Domains for Your Marketing Agent Widget.

Where do I copy the Docket script for the GTM tag?

The script is on the agent's Deploy tab, in the Add widget to your domain or page section.

  1. Open Marketing Agent Configuration in the left sidebar.

  2. Open the agent you want to deploy.

  3. Go to the Deploy tab.

  4. In Add widget to your domain or page, click Copy Script.

Docket Deploy tab with the Add widget to your domain or page section open, Copy Script marked 1 and Email to Web Admin marked 2

Each agent has its own script, so copy it from the agent you intend to deploy. Do not reuse the script from another agent.

If someone else owns the GTM container, click Email to Web Admin to send them the script instead. See Sending Deployment Instructions to a Web Admin.

How do I install the Docket widget with Google Tag Manager?

Paste the Docket script into a Custom HTML tag in your GTM container, give the tag a trigger, then publish the container.

  1. Open Google Tag Manager.

  2. Select the container for the website where the widget should load.

  3. Go to Tags.

  4. Click New.

  5. Give the tag a name that a future admin will recognize, such as Docket Marketing Agent Script.

  6. Open Tag Configuration.

  7. Choose Custom HTML.

  8. Paste the Docket script you copied.

  9. Click Triggering.

  10. Choose All Pages.

  11. Save the tag.

  12. Submit and publish the container change, following your team's process.

Docket recommends All Pages for the widget script. Narrow where the widget appears in Docket rather than in the GTM trigger, so there is one tag to maintain.

If your team uses GTM environments, publish to the environment used by the site you are testing. Wait for the published container to be live on the website before you check the page.

What is the difference between the GTM trigger and Docket's Widget Behaviour setting?

The GTM trigger decides when the Docket script loads on a page. The Widget Behaviour setting in Docket decides when the widget appears to the visitor.

Widget Behaviour is on the agent's Widget tab. For each domain, Show Widget on offers All Pages, Selected Pages, and On Click (Function Call).

On Click (Function Call) means the widget will not open by itself. Your site has to call a JavaScript function to open it. If that is the setting and you only publish the GTM tag, nothing appears on the page and the install can look broken. See Setting up OnClick Trigger for the widget for the function your site needs to call.

How do I confirm the GTM tag delivered the Docket script?

Check GTM Preview mode first, then the live page, then the script detection on the agent's Widget tab in Docket.

  1. Open GTM Preview mode on a page where the tag should fire.

  2. Confirm the Docket tag fires once for the expected trigger.

  3. Publish the container only after the preview succeeds.

  4. Open the live page in a private browser window.

  5. Confirm the widget appears, or that it waits for the function call if Show Widget on is set to On Click (Function Call).

  6. Complete a short interaction with the widget.

  7. Confirm pages outside the trigger conditions do not load the script.

Check the script detection in Docket

Docket reports whether it has detected the script on each whitelisted domain, on the Widget tab in the Whitelist Domains section. A domain that reads "We couldn't find the DocketAI Script on your domain" is a domain where Docket has not seen the script. There is a rescan control next to the Add Domain field, so you can rescan after publishing the container and then read the row again. For a GTM install this is the most direct confirmation that the tag delivered the script to the page.

Why does the Docket tag fire but the widget never appear?

A consent manager, a GTM consent rule, or a network rule can block the Docket script even though the tag fired. GTM reports that the tag ran; it does not report whether the browser was allowed to fetch and run Docket's script.

Ask whoever owns those rules to allow both hosts:

  • docketai.com and its subdomains, which covers cdn.docketai.com, app.docketai.com and aiseller.app.docketai.com.

  • d33t2173eag6fx.cloudfront.net

The host in the generated script differs by agent, so read it from your own agent's script before you send the request. The two hosts above are the current list, not a permanent one.

Check all of these places, not only the consent manager:

  • The consent manager's script rules, including the consent category the Docket script sits in.

  • script-src and connect-src in your Content Security Policy.

  • Any firewall, WAF, proxy, DNS or content-blocking rule.

A WAF screen that allowlists URLs or parameters on your own site cannot allow an external script. Go-lives have been held up by an allowlist entered on that kind of screen. If the widget still does not appear, see Troubleshooting Widget Not Loading or Displaying.

What else should I check when the widget does not load through GTM?

Work through the container, the tag, the trigger and the domain, in that order.

Issue

What to Check

Widget does not load

Confirm the GTM container is published and the Docket tag is active.

Tag fires on the wrong pages

Review the GTM trigger and the Widget Behaviour settings in Docket.

GTM preview works but production does not

Confirm the container version was published to the correct environment.

Widget loads on staging but not production

Confirm the production domain is in Whitelist Domains and uses the published container.

Visitors get an HTTP 403

The domain is not whitelisted, or an IP Access Rules entry is restricting that visitor.

Frequently asked questions

Do I still have to whitelist the domain if the GTM tag fires?

Yes. The widget only works on whitelisted domains, so add the site on the agent's Widget tab under Whitelist Domains. A request from a domain that is not whitelisted returns an HTTP 403.

Which hosts should I send to my security or consent team?

Send docketai.com and its subdomains, plus d33t2173eag6fx.cloudfront.net. The host in the generated script differs by agent, so read your own agent's script to confirm which one it uses. Those hosts belong in the consent manager's script rules and in script-src and connect-src, not in a WAF table that allowlists URLs on your own site.

Can one GTM tag serve two Docket agents?

No. Each agent's script carries its own agent id, so create a separate Custom HTML tag for each agent you deploy. Copy each script from that agent's own Deploy tab.

The tag fires, but the widget only opens when a visitor clicks something. Why?

The domain's Show Widget on setting is On Click (Function Call). In that mode the widget never opens on its own, and your site has to call a JavaScript function to open it. Change the setting to All Pages or Selected Pages if you want the widget to appear without a function call.

Should the Docket tag fire on every page?

Docket recommends All Pages for the tag trigger. Control which pages show the widget with Show Widget on in Docket, so page targeting lives in one place and the GTM tag stays unchanged.

Related articles