> For the complete documentation index, see [llms.txt](https://adagio-io.gitbook.io/adagio-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://adagio-io.gitbook.io/adagio-documentation/prebid/additional-useful-information/attention-measurement.md).

# Attention Measurement

What to do if you don’t use the following adServer: GAM, Smart AdServer, Appnexus.

### Natively supported ad servers

The attention measurement of each placement has to be collected during the entire user’s visit.

In order to be synced with the reports provided by your ad server, we listen to the events it produces and start our measurer on the one best fit the moment an ad is rendered on the page.

**Supported Ad Servers**

| Supported Ad Server Names                    | Event name used to start measurer |
| -------------------------------------------- | --------------------------------- |
| Google Ad Manager (via Google Publisher Tag) | `slotRenderEnded`                 |
| Smart AdServer                               | `load`                            |
| Appnexus (via Xandr)                         | `adLoaded`                        |

### Integration with other ad servers

The following information explains the generic process to interface not natively supported ad server with Adagio. You need to get in touch with your Adagio Support contact <csm@adagio.io> in order to validate the setup.

For ad servers who are not natively supported, it is up to the proprietary ad server owner (or the publisher) to provide the signal to start a measurer for a placement when the creative is rendered.

Adagio requires the following information:

* a flag which determines if the ad-server response is empty (no creative to render)
* the `id` attribute of the HTML element in which the creative is rendered. This should match the parameter `adUnitElementId` in Adagio’s bidder configuration.
* the id of the ad server creative
* the size of the creative served

To start a measurer, call the Prebid.js adagioBidAdapter function: `window.top.ADAGIO.queue.push(queueOptions)` *(see definitions below).*

<details>

<summary>Definition ADAGIO.queue.push</summary>

Type: `(options: queueOptions) => void`

**queueOptions**

The AdagioQueue accepts only a few whitelisted actions. The queueOptions object provides the params that are related.

**queueOptions.action**\
Type: `string`\
The Adagio action name to trigger. This name has to be whitelisted by Adagio.

**queueOptions.data**Type: `object`\
A generic object to pass any data. Each action has a specific `data` object which fits the needs of the action.

**queueOptions.ts**Type: `number`\
The timestamp on which the `push()` function is called. It should always be `Date.now()`.

</details>

<details>

<summary>Definition Custom Event detail</summary>

The custom event dispatched by the ad server owner (or publisher) must implement the following properties.

**detail.isEmpty**\
Type: `boolean`\
The ad server sent an empty response (no creative to render)

**detail.elementId**\
Type: `string`\
The `id` attribute of the HTML element in which the creative is rendered. This id should match the parameter `adUnitElementId` in Adagio’s bidder configuration.

**detail.creativeId**\
Type: `string`\
The id of the ad server creative

**detail.creativeSize**\
Type: `string|array`\
The size of the served creative. Must match the format `width x height` or `[width, height]` where both `width` and `height` are numbers.E.g. `300x250`, `[300,250]`

</details>

<details>

<summary>Example with basic javascript <em>CustomEvent</em> api</summary>

First dispatch the right event in your own code source

```jsx
// proprietary ad server js script
…
document.dispatchEvent(new CustomEvent('myRenderEvent', {
  detail: {
    isEmpty: false,
    elementId: 'adunit-id-xxx',
    creativeId: 'crea-1111',
    creativeSize: [300,250]
  }
}));
…
```

Then register a listener to this event and call the `window.top.ADAGIO.queue.push()` function to pass data to Adagio

```jsx
(function() {
  try {
    // Actually Adagio must have access to top level window.
    if (window.top.location.href) {
      window.top.ADAGIO = window.top.ADAGIO || {};
      window.top.ADAGIO.queue = window.top.ADAGIO.queue || [];

      window.document.addEventListener('myRenderEvent', function(evt) {
        window.top.ADAGIO.queue.push({
          action: 'adagio-my-adserver-events', // Adagio whitelisted action
          data: {
            eventName: 'renderEvent',
            args: evt.detail
          },
          ts: Date.now()
        });
      });
    }
  } catch (error) {
    return false;
  }
})();
```

</details>


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://adagio-io.gitbook.io/adagio-documentation/prebid/additional-useful-information/attention-measurement.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
