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

# Configuring Ad Server Targeting

> How to configure Clean Room targeting in Google Ad Manager or Microsoft Monetize

## Overview

Once clean room audiences have been created, you need to configure targeting in your ad server. This guide covers setup for both Google Ad Manager and Microsoft Monetize.

<Info>
  **Prerequisites:**

  * Permutive SDK properly configured with your ad server integration
  * For GAM: DFP integration enabled in your Permutive SDK
  * For Microsoft Monetize: AppNexus Seller Tag installed and configured
</Info>

## Understanding Clean Room Targeting Values

Clean room audiences use unique targeting values specific to each publisher-advertiser connection. You can find these targeting values in the Permutive Platform under **Connections** when viewing a specific advertiser connection.

These values are:

* Stored in the `_pcrprs` local storage key on the user's browser
* Automatically populated by the Permutive SDK when a user is in a clean room audience

## Google Ad Manager (GAM)

Targeting is **automatic** - no manual activation steps required. The Permutive SDK's DFP addon automatically reads targeting values from `_pcrprs` and applies them to ad requests.

<Steps>
  <Step title="Verify SDK configuration">
    Ensure your Permutive SDK is configured with the DFP integration enabled. The DFP addon will automatically:

    * Read targeting values from the `_pcrprs` local storage key
    * Call Google Publisher Tag's `setTargeting()` method
    * Attach targeting to every ad request
  </Step>

  <Step title="Create or update a line item in GAM">
    In GAM, go to **Delivery** > **Line Items** and create or edit a line item.
  </Step>

  <Step title="Add key-value targeting">
    Add key-value targeting using the targeting values from your advertiser connection. The key-value pairs will match what's in `_pcrprs`.
  </Step>

  <Step title="Configure additional targeting">
    Configure additional targeting criteria as needed (geography, device, etc.). Set frequency caps if desired.
  </Step>

  <Step title="Associate with order and creative">
    Associate the line item with the appropriate order and creative.
  </Step>

  <Step title="Launch campaign">
    Launch your campaign.
  </Step>
</Steps>

## Microsoft Monetize (formerly Xandr)

Targeting requires **manual setup** in your on-page code to read from `_pcrprs` and pass values to the AppNexus Seller Tag.

<Steps>
  <Step title="Install AppNexus Seller Tag">
    Ensure you have the AppNexus Seller Tag installed on your site. See the [Microsoft Monetize integration guide](/integrations/advertising/ad-servers/xandr) for details.
  </Step>

  <Step title="Add targeting JavaScript">
    Add the following JavaScript to read clean room targeting values and set keywords on your ad tags:

    ```javascript theme={"dark"}
    window.apntag = window.apntag || {};
    window.apntag.anq = window.apntag.anq || [];

    window.apntag.anq.push(function () {
      var original = window.apntag.defineTag;
      window.apntag.defineTag = function (arg) {
        original(arg);
        try {
          if (arg.targetId) {
            // Read clean room targeting values from _pcrprs
            var kvs = window.localStorage.getItem("_pcrprs");
            window.apntag.setKeywords(
              arg.targetId,
              { permutive: kvs ? JSON.parse(kvs) : [] },
              { overrideKeyValue: true }
            );
          }
        } catch (e) {
          /* Ignore */
        }
      };
    });
    ```
  </Step>

  <Step title="Deploy the code">
    Deploy this code before or alongside your Permutive tag.
  </Step>

  <Step title="Create or update a line item">
    In Microsoft Monetize, create or update a line item. Set targeting to use the `permutive` key-value. Values will match the targeting values shown in your connection details.
  </Step>

  <Step title="Configure and launch">
    Configure additional targeting criteria as needed and launch your campaign.
  </Step>
</Steps>

<Note>
  This setup is similar to the regular Microsoft Monetize integration but reads from `_pcrprs` (clean room values) instead of `_papns` (regular cohorts). See the full [Microsoft Monetize integration documentation](/integrations/advertising/ad-servers/xandr) for more details.
</Note>

## Verification Tips

* Check browser local storage for `_pcrprs` key to verify targeting values are being set
* Use browser developer tools to inspect ad requests and confirm targeting key-values are present
* Create test campaigns with low budget to verify targeting is working before full launch

## Next Steps

<CardGroup cols={2}>
  <Card title="Sharing Proposal and Deal Information" icon="handshake" href="/guides/clean-room/sharing-proposal-and-deal-information">
    Set up PMP deals in GAM
  </Card>

  <Card title="Back to Clean Room" icon="arrow-left" href="/products/clean-room">
    Return to product overview
  </Card>
</CardGroup>
