> This page is for Advertising Protection.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.humansecurity.com/llms.txt.

# Deploy with Google Tag Manager

Deploy Page Intelligence with Google Tag Manager (GTM) to manage your tag implementation and deployment. Review the [integration options](/advertising/page-intelligence/integration-options) guide before you begin.

## Prerequisites

Before you deploy Page Intelligence with GTM, ensure you meet the following requirements:

* You have a Google Tag Manager account.
* You have a Page Intelligence tag and regex pattern from HUMAN.

> **Note**
>
> The steps below use Google Tag Manager. You can adapt them for another tag management solution.

## Deploy the Page Intelligence tag

In Google Tag Manager, create a new tag with the following settings:

* **Tag Type:** **Custom HTML**
* **HTML:** Paste the Page Intelligence tag from HUMAN.
* **Firing Triggers:** **All Pages**
* Name the tag **HUMAN Page Intelligence** or similar.

Select **Save**.

For more information, see Google’s [Custom HTML tag](https://support.google.com/tagmanager/answer/6107167) help article.

## Decrypt the IVT response

Follow the steps below to set up a custom event trigger. This trigger runs JavaScript that retrieves and decrypts the IVT response and stores the resulting true or false value in a dataLayer variable.

In Google Tag Manager:

1. Create a new trigger with the following settings:

   * **Trigger Type:** **Custom Event**
   * **Event name:** `miDec`
   * **This trigger fires on:** **All Custom Events**
   * Name the trigger **HUMAN IVT Response** or similar.

   ![Create a new trigger](/_fern-img/d19ebd01c7efee96d5998dd49d56a8d7b7b9b007df693ad2b27d8ef16dc98ec9.webp)

2. Create a new variable with the following settings:

   * **Variable Type:** **Data Layer Variable**
   * **Data Layer Variable Name:** `hmns-dec`
   * **Data Layer Version:** 2
   * Name the variable `hmns-dec` or similar.

   ![Create a new variable](/_fern-img/d28edea962fb731729765fc360703ceed98a47e315293db281e3dad15a8ef1d9.webp)

3. Create a new tag with the following settings:

   * **Tag Type:** **Custom HTML**
   * **HTML:** Paste the code below.
   * **Firing Trigger:** Select the trigger you created (**HUMAN IVT Response**).
   * Name the tag **Decrypt and Store HUMAN IVT Response** or similar.

   ```html wordWrap showLineNumbers={false}
   <script>
   (function () {
   function getMiDecValue() {
      for(var i=0; i < window.dataLayer.length; i++)
         if(window.dataLayer[i].event === 'miDec')
         return window.dataLayer[i].value;
   }

   var miDecValue = getMiDecValue();
   var regexKey = /PASTE REGEX HERE/;
   var IvtValue = ! regexKey.test(miDecValue);

   window.dataLayer.push({'hmns-dec': IvtValue});
   })();
   </script>
   ```

4. Select **Save** to create the tag.

   ![Create a new tag](/_fern-img/6c2131850e3a32971b759793397dd7b207b69f696072b7965cef612ae4bcfcdc.webp)

## Publish

After you complete all the steps above, publish the GTM container to apply the update.

When you complete the steps above, you add a `hmns-dec` variable to the local dataLayer. This variable holds a boolean (`true` or `false`) value:

* If `hmns-dec` is `true`, classify the traffic as IVT (invalid).
* If `hmns-dec` is `false`, classify the traffic as valid (not IVT).

Use the `hmns-dec` variable to trigger additional workflows as needed (see [Mitigation strategy](/advertising/page-intelligence/mitigation-strategy)).