> For the complete documentation index, see [llms.txt](https://docs.reo.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reo.dev/install-the-tracking-snippet-with-google-tag-manager.md).

# Install the tracking snippet with Google Tag Manager

### Overview

Google Tag Manager (GTM) lets you add the Reo.dev tracking script to your site without editing its source code. **If your team already manages tags through GTM, this is usually the easiest way to install Reo.dev, and you don't need to be a developer to do it.**

#### **What you need to know about GTM before proceeding**

* GTM works through its own small piece of code, **called the container snippet**, that gets pasted into the site's pages once.
* One block in the <mark style="color:red;">`<head>`</mark>, and another right after the opening <mark style="color:red;">`<body>`</mark> tag.&#x20;
* That one-time step needs a developer, since it means editing the site's code directly.
* Once that snippet is live, every tag after that, including Reo's, gets added, changed, or removed entirely through GTM's web interface. No more code edits, no more developer needed.&#x20;
* That's the part anyone with GTM access can do, and it's what the rest of this page covers.&#x20;

{% hint style="info" %}
**Not sure if that one-time step has already happened on your site?** Ask whoever manages your GTM account, or have a developer check the site's page source for a script referencing a container ID that starts with <mark style="color:red;">`GTM-`</mark>.
{% endhint %}

***

### Before you start

* **Configure your Base URL in Reo.dev first. If you skip this, the Reo.dev tag you create in GTM will still fire correctly, but Reo.dev won't have anywhere to attribute that traffic to, so you'll see no data.**
* You need access to your site's Google Tag Manager account.
* You need your Reo.dev Client ID.&#x20;

***

### Configure your Base URL in Reo.dev

#### **For Website Tracking via GTM**

Go to **Settings → Integrations → Website → Configure**, and add your website's base URL. For the full walkthrough, including what a Base URL is, see the [Website integration guide](https://docs.reo.dev/integrations/input-sources/developer-insights/website).

#### **For Documentation Tracking via GTM**

Go to **Settings → Integrations → Documentation → Configure**, and add your documentation site's base URL. You can add more than one subdomain if needed. For the full walkthrough, see the [Documentation integration guide](https://docs.reo.dev/integrations/input-sources/developer-insights/documentation).

Once your Base URL is set, follow the steps below. The GTM steps are the same whether you're tracking your Website or your Documentation.

***

#### **Glossary**

A quick glossary before you start:

* a **tag** is the piece of tracking code GTM manages for you
* a **trigger** is the rule for when that tag runs
* **Custom HTML** is the tag type you use to paste in a script like Reo's

***

### Add the tag in Google Tag Manager

1. Log in to Google Tag Manager at [tagmanager.google.com](https://tagmanager.google.com/). From the top-left corner (next to the Google Tag Manager logo), select the account linked to your documentation or website.

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/20bcb30e-3802-4f61-8c96-9f70bcb84b6a.png)

2. From the left menu, choose **Tags.** If you have existing tags, they will appear here.&#x20;

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/6372077c-0e0f-40ce-b224-9e16ef8a41a8.png)

3. Click **New >** select '**Choose a tag type to begin setup...**'&#x20;

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/1f524f9d-8811-4445-bc14-921dca7dffa5.png)

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/617dc6a9-f0f2-4e2d-bd07-284359fa48ae.png)

4. Under Tag Configuration, choose **Custom HTML** as the tag type.

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/00875ec5-4e2c-4f69-8153-a27d10f87443.png)

5. **Paste the script below into the HTML box**, replacing <mark style="color:red;">`XXXXXXXX`</mark> with your Client ID.

```javascript
<!-- Start of Reo Javascript -->
<script type="text/javascript">
  !function(){var e,t,n;e="XXXXXXXX",t=function(){Reo.init({clientID:"XXXXXXXX"})},(n=document.createElement("script")).src="https://static.reo.dev/"+e+"/reo.js",n.async=!0,n.onload=t,document.head.appendChild(n)}();
</script>
<!-- End of Reo Javascript -->
```

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/685714cf-3ef5-4721-a809-be4219461943.png)

6. Once that's done, you have to choose a trigger for the script to load. Under Triggering, choose **Initialization - All Pages**. This makes the tag run as soon as any page loads.

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/7bc7e9ca-06ca-4801-b3fa-849fed1dd81c.png)

7. Click **Save**.&#x20;

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/e13ed228-9c8d-4c23-be77-a0a04888dd83.png)

8. Upon saving, you will land on the Tags page. Click **Submit** to proceed.&#x20;

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/eaf0f233-0424-4413-80de-7d1f6230aa87.png)

9. Then **Publish**, to make the tag live ***(this is important)*****:**&#x20;
   1. Submit stages your changes as a new version.&#x20;
   2. **Publish is the step that actually deploys them to your site.**
   3. While publishing, you can choose to fill other details pertaining to the container version.&#x20;

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/1dc46e10-c341-4568-a0cc-4051fb93ad47.png)

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/766cdbcd-4cce-4876-8f9c-48685cff0bf2.png)

10. Once you're finished, **a screen like this confirms your changes are published.** You can now move on to verify the snippet is installed on your documentation site or website.

![](https://usercontent.us.prod.clueso.io/d06f019c-da0b-4d5b-9fdd-9630e7fd5d0f/ab68717c-d829-481d-b595-f318b975f566/4d3780cc-9b0e-469d-8853-5b3063b09bf8/images/7e3180a1-0e04-4b3a-b202-eb947e801634.png)

***

### **Verify the snippet is installed**

The fastest way: on the Website or Documentation configuration page in Reo.dev (**Settings → Integrations**), click Check status in the top-right corner. It tells you whether Reo.dev is receiving data.

To check manually instead:

1. Open your documentation page
2. Right-click anywhere on the page and select **Inspect** to open developer tools
3. In the **Network tab**, search for <mark style="color:red;">`reo`</mark> and check if the network calls are being registered (status code: 200)

***

### CSP requirements

If your site enforces a Content Security Policy (CSP), allow these domains. This is usually set in your site's HTTP response headers or a CSP meta tag, ask whoever manages your hosting if you're not sure where.

* <mark style="color:red;">`script-src <https://static.reo.dev>`</mark>
* <mark style="color:red;">`connect-src <https://api.reo.dev>`</mark>

For cookies and data handling, see the [cookie management guide](https://docs.reo.dev/integrations/tracking-beacon/reo.dev-javascript-cookies-and-consent-guide).

***

### Same safeguards as a direct install

This is the same Reo.dev tracking script used in every install method, just deployed through GTM instead of pasted directly.

The same protections apply:

* HTTPS encryption
* anonymous data collection only
* asynchronous loading so it doesn't slow your page down
* fail-safes so an error in the script never breaks your site

***

### FAQs

{% hint style="info" %}
For questions about the tracking script itself, safety, performance, PII, browser support, and compliance, check out the FAQ on the [Website integration guide](https://docs.reo.dev/integrations/input-sources/developer-insights/website) or [Documentation integration guide](https://docs.reo.dev/integrations/input-sources/developer-insights/documentation). Those apply for installation through Google Tag Manager as well.
{% endhint %}

* **Does publishing this tag also publish other tags in my container?**\
  **Y**es, GTM's Submit and Publish pushes every pending change in the container live, not just the Reo tag. If a teammate has other untested changes sitting in the same container, publishing your tag ships theirs too. Check with your team before you publish if you're not the only one working in that container.<br>
* **Can I test the tag before it goes live?**\
  Yes, use GTM's Preview mode to confirm the tag fires correctly on your site before you publish, so you're not troubleshooting on a live page.<br>
* **Do I have to paste my Client ID directly into the script, or can I use a GTM variable?**\
  You can use a GTM variable instead of hardcoding it. This is useful if you manage multiple environments, like staging and production, with different Client IDs.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.reo.dev/install-the-tracking-snippet-with-google-tag-manager.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
