> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rivvi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Tag Manager template

> Install the web-chat widget via a GTM Custom HTML tag or the Rivvi template.

You can install the Rivvi web-chat widget through Google Tag Manager with no
site-code edit. Two options:

## Option 1 — Custom HTML tag (fastest)

<Steps>
  <Step title="New tag → Custom HTML">
    In GTM, create a tag of type **Custom HTML** and paste your embed snippet (from
    the Rivvi Install tab). It looks like:

    ```html theme={null}
    <script src="https://api.rivvi.ai/public/widget/YOUR_ORG_ID/embed.js" async></script>
    ```
  </Step>

  <Step title="Trigger: All Pages">
    Add the built-in **All Pages** trigger so the widget loads site-wide.
  </Step>

  <Step title="Support document.write off">
    Leave **Support document.write** unchecked — the widget uses standard DOM APIs.
  </Step>

  <Step title="Submit + publish">
    Publish the container. The launcher appears on the next page view.
  </Step>
</Steps>

## Option 2 — Rivvi template with variables

For a guided tag where the org id and API host are fields (instead of a pasted
`<script>`), import the Rivvi GTM template:

1. In GTM, go to **Templates → Tag Templates → New → Import**.
2. Import `extensions/gtm-rivvi-webchat/template.tpl` from the Rivvi repo (or the
   copy your Rivvi contact provides).
3. Create a tag from the template, fill in **Organization ID** and **API host**,
   and set the **All Pages** trigger.

Both options load the same first-party script — see
[CSP requirements](/web-chat/csp) if your site enforces a Content Security Policy.
