> For the complete documentation index, see [llms.txt](https://docs.claimr.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.claimr.io/widget/claimr-widget-integrations/google-tag-manager-integration.md).

# Google Tag Manager integration

Google Tag Manager provides a centralized platform for managing tracking codes (tags) for various services, including Google Analytics, advertising platforms, and more.&#x20;

claimr supports two methods for integrating with GTM:

## **Method 1: Using the `data-gtm` attribute in the embed script**

This method is the most straightforward and is recommended for most setups. You add your GTM Container ID (which looks like GT-XXXXXXXXX, G-XXXXXXXXX, or AW-XXXXXXXXX) directly to the claimr embed script.

1. **Find Your GTM Container ID:**

   * Log in to your Google Tag Manager account.
   * Select the container you want to use for your claimr widget.
   * Your Container ID will be displayed prominently on the container's overview page (e.g., `GT-XXXXXXX`).

   For more detailed instructions, refer to Google Tag Manager's documentation: [Set up and install Tag Manager](https://support.google.com/tagmanager/answer/6103696?hl=en)
2. **Modify Your claimr Embed Script:** Add the `data-gtm` attribute to your claimr script tag, replacing `"GTM-TAG"` with your actual GTM Container ID:

   HTML

   ```
   <script src="https://widgets.claimr.io/claimr.min.js"
       id="claimr-script"
       data-gtm="GT-XXXXXXX"
       data-organization="ORGANIZATION_NAME"
       data-campaign="CAMPAIGN_NAME"
       data-autoresize="true"
       data-container="CLAIMR_CONTAINER_ID">
   </script>
   ```

Replace `ORGANIZATION_NAME`, `CAMPAIGN_NAME`, and `CLAIMR_CONTAINER_ID` with actual values.

## **Method 2: Passing the GTM container ID in the URL**

This method is useful if you can't directly modify the embed script or if you need to dynamically change the GTM Container ID.

1. **Find Your GTM Container ID:** (Same as Method 1)
2. **Construct the URL:** Add the `gtm` parameter to your claimr campaign URL, replacing `"GTM-TAG"` with your actual GTM Container ID:

   ```
   https://campaign?gtm=GTM-XXXXXXX
   ```

Replace `https://campaign` with your actual claimr campaign URL.

## **Verifying GTM Integration**

After implementing either method, you'll need to configure your claimr events *within* Google Tag Manager. This typically involves creating:

1. **Triggers:** These define *when* to fire a tag (e.g., when a specific claimr event occurs).
2. **Tags:** These send data to your analytics or marketing platforms (e.g., a Google Analytics 4 event tag).
3. **Variables**

View our documentation for the specific event names and data that are available for tracking.&#x20;

Once your GTM configuration is complete and published, you should start seeing claimr events in your connected platforms (e.g., Google Analytics). Use the Real-time reports in those platforms to verify that data is being received correctly.


---

# 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.claimr.io/widget/claimr-widget-integrations/google-tag-manager-integration.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.
