# Google Ad Manager Setup

The Google Ad Manager (GAM) setup for Direct InApp is identical to the standard InApp setup. The same targeting keys, creative code, and line item structure apply.

{% hint style="info" %}
On demand, we can handle the ad server setup, once you provided us with API access to GAM.
{% endhint %}

## Targeting Keys

Create the following key-values in your GAM account under **Inventory > Key-values**:

| Key             | Type       | Values                                            |
| --------------- | ---------- | ------------------------------------------------- |
| `hb_pb`         | Predefined | Price buckets (e.g., `0.01`, `0.02`, ... `20.00`) |
| `hb_partner`    | Predefined | `nexx360`                                         |
| `hb_env`        | Predefined | `mobile-app`                                      |
| `hb_format`     | Predefined | `banner`                                          |
| `hb_size`       | Dynamic    | Ad sizes                                          |
| `hb_bidder`     | Dynamic    | SSP names                                         |
| `hb_cache_id`   | Dynamic    | Cache UUIDs                                       |
| `hb_cache_host` | Dynamic    | Cache host                                        |
| `hb_cache_path` | Dynamic    | Cache path                                        |

## Line Item Setup

### Recommended Structure

1. **Key-Value Targeting**: Target `hb_partner` = `nexx360` and `hb_pb` for price buckets
2. **Creative Size**: Use fluid or specific sizes matching your ad units
3. **Priority**: Set appropriate priority based on your yield strategy

### Price Bucket Ranges

With `dense` granularity (default), price buckets are configured as follows:

| Range          | Increment |
| -------------- | --------- |
| $0.00 - $3.00  | $0.01     |
| $3.00 - $8.00  | $0.05     |
| $8.00 - $20.00 | $0.50     |
| $20.00+        | $1.00     |

## Creative

Use the following Prebid Universal Creative code, which includes `mobileResize` for proper ad rendering on mobile devices:

```html
<script src="https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/creative.js"></script>
<script>
  var ucTagData = {};
  ucTagData.adServerDomain = "";
  ucTagData.pubUrl = "%%PATTERN:url%%";
  ucTagData.adId = "%%PATTERN:hb_adid%%";
  ucTagData.cacheHost = "%%PATTERN:hb_cache_host%%";
  ucTagData.cachePath = "%%PATTERN:hb_cache_path%%";
  ucTagData.uuid = "%%PATTERN:hb_cache_id%%";
  ucTagData.mediaType = "%%PATTERN:hb_format%%";
  ucTagData.env = "%%PATTERN:hb_env%%";
  ucTagData.size = "%%PATTERN:hb_size%%";
  ucTagData.hbPb = "%%PATTERN:hb_pb%%";
  ucTagData.mobileResize = "hb_size:%%PATTERN:hb_size%%";

  try {
    ucTag.renderAd(document, ucTagData);
  } catch (e) {
    console.log(e);
  }
</script>
```

{% hint style="warning" %}
The `mobileResize` parameter is essential for proper ad sizing on mobile devices. Do not remove it.
{% endhint %}

## Cache URL

The ad creative is retrieved from the Nexx360 cache using the following URL pattern:

```
https://{hb_cache_host}{hb_cache_path}?uuid={hb_cache_id}
```

Example:

```
https://fast.nexx360.io/cache?uuid=testnexx-fast-diap-1234-abc123def456
```


---

# Agent Instructions: 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:

```
GET https://developer.nexx360.io/integration-methods/direct-inapp-sdkless/google-ad-manager-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
