# Integrate using Google Tag Manager

This guide describes how to use Google Tag Manager (GTM) to integrate Agent Intelligence into your web app. For more information about GTM, see [Google's documentation](https://support.google.com/tagmanager/?hl=en#topic=3441530).

## Prerequisites

- A Mosaic application with client credentials. Create an application in the [Admin Portal](https://portal.transmitsecurity.io/) if you do not already have one.
- Your web application must already be integrated with Google Tag Manager. See [Google's quick start for web](https://developers.google.com/tag-platform/tag-manager/web).


## Step 1: Load SDK via GTM

Create a new custom HTML tag that loads and initializes the [Platform SDK](/sdk-ref/platform/introduction/), and set it to fire on all pages:

1. In your GTM workspace, go to **Tags** > **New**.
2. Click **Tag Configuration** > **Custom HTML** and add the code below. Replace `[CLIENT_ID]` with your client ID from the [Admin Portal](https://portal.transmitsecurity.io/).
3. Click **Triggering** and select the **All Pages** trigger so the SDK loads on every page.
4. Save the tag, then submit and publish the container.


Note
Set `agenticCollect: true` in the `drs` configuration to enable Agent Intelligence detection.

If you already use Mosaic Fraud Prevention, make sure the `clientId` and the region in `serverPath` match the ones configured for your existing integration.

```js
<script src="https://platform-websdk.transmitsecurity.io/platform-websdk/2.x/ts-platform-websdk.js" data-ts-agentic-self defer></script>
<script data-ts-agentic-self>
  (function () {
    if (window.__agenticSdkInit) return;
    window.__agenticSdkInit = true;
    document.addEventListener('TSAccountProtectionReady', function (e) {
      var Ctor = e && e.detail && e.detail.TSAccountProtection;
      if (typeof Ctor !== 'function' || window.__agenticSdkStarted) return;
      window.__agenticSdkStarted = true;
      try {
        new Ctor('<CLIENT_ID>', { /* Client ID of your app */
          serverPath: '<SERVER_PATH>', /* e.g. Set to https://api.transmitsecurity.io/risk-collect/ or other depending on your region or custom domain */
          agenticCollect: true
        }).init().catch(function () {});
      } catch (e) { /* never break the customer's page */ }
    });
  })();
</script>
```

## Step 2: Validate in Mosaic

After you publish the container and drive traffic through your pages, open **Agent Intelligence** in Mosaic and start with **Sessions**.

- Confirm that session records begin appearing for the applications and pages covered by your integration.
- Review fields such as **Activity Surface**, **Start Time**, **Agent Platform**, and **Origin Type** to verify that the expected traffic is being collected.
- Open individual sessions to inspect additional details such as **IP Address**, **Country**, **OS**, **Browser**, and path data when available.


If data doesn't appear, verify the following:

- The custom HTML tag is firing on all relevant pages (use GTM **Preview** mode to confirm)
- The Platform SDK script is being injected into the page source
- `serverPath` matches the correct region or your custom domain
- Your CSP allows the Platform SDK script and `risk-collect` endpoint. See [Enable API communication](/guides/quick_start/enable_communication/)


Note
First agent platforms typically surface within hours of activation. Agentic traffic volume builds gradually over the first several weeks—check trends across multiple weeks rather than a single day.