# /stats

This endpoint is for getting a list of selected items and the stats associated with them.

## Example GET request

```http
https://api.adnuntius.com/api/v1/stats/
    ?context=<networkId>
    &advObjectLabel=
    &auth_token=f92LGtCLx1TA6vrLQ6UfaDz_5w_P...
    &startDate=2020-02-02T23:00:00.000Z
    &endDate=2020-02-10T14:00:00.000Z
    &all=lineItem
    &groupBy=LINE_ITEM
    &includeAll=false
    &includeChunkRange=true
    &aggregateTo=ORDER
```

| Parameter         | Scope    | Value                                                  | Function                                                         |
| ----------------- | -------- | ------------------------------------------------------ | ---------------------------------------------------------------- |
| context           | required | String                                                 | Network to get information from                                  |
| auth\_token       | required | String                                                 | Authorization                                                    |
| startDate         | required | <p>Date in UTC</p><p>(2020-01-01T23:00:00:00.000Z)</p> | Start date of the report                                         |
| endDate           | required | <p>Date in UTC</p><p>(2020-01-01T23:00:00:00.000Z)</p> | End date of the report                                           |
| all               | optional | lineItem, order, creative, advertiser                  | Selects the endpoint for which to get the data.                  |
| groupBy           | optional | ORDER, LINE\_ITEM, ADVERTISER                          | Defines how to group the "chunks"                                |
| includeAll        | optional | Boolean                                                | Weather or not to show items that has 0 impressions.             |
| includeChunkRange | optional | boolean                                                | Includes all the dates even if there are no stats on those dates |
| aggregateTo       | optional | ORDER, LINE\_ITEM, ADVERTISER                          | Determine what chunks should be in the response.                 |

### Example request

```javascript
/stats
    ?auth_token=PDXS2YodiUqV0ur...
    &aggregateTo=LINE_ITEM
    &all=lineItem
    &context=<networkId>
    &endDate=2021-07-15T22:00:00.000Z
    &startDate=2021-07-14T22:00:00.000Z
    &groupBy=ORDER
    &includeChunkRange=true
    &includeAll=true
```

### Example Response

```javascript
{
    "chunks": [
        {
            "order": {
                "id": "lkvk7qf1y9y...",
                "name": "Testorder",
                "labels": [
                    "car"
                ],
                "source": "DIRECT",
                "url": "/api/v1/orders/lkvk7qf1y9y..."
            },
            "chunks": [
                {
                    "ctr": 0.0,
                    "viewability": 0.0,
                    "cost": {
                        "currency": "NOK",
                        "amount": 0
                    },
                    "visibility": 0.0,
                    "viewables": 0,
                    "lineItem": {
                        "id": "8z6bvgphm...",
                        "name": "TestLineitem1",
                        "labels": [],
                        "source": "DIRECT",
                        "url": "/api/v1/lineitems/8z6bvgphm..."
                    },
                    "averageAuctionRank": 0.0,
                    "impressionsPerUniqueUser": 0.0,
                    "impressions": 0,
                    "visibles": 0,
                    "rendered": 0,
                    "eCpm": {
                        "currency": "NOK",
                        "amount": 0
                    },
                    "uniqueUsers": 0,
                    "clicks": 0
                }
            ],
            "totals": {
                "ctr": 0.0,
                "viewability": 0.0,
                "cost": {
                    "currency": "NOK",
                    "amount": 0
                },
                "visibility": 0.0,
                "viewables": 0,
                "averageAuctionRank": 0.0,
                "impressionsPerUniqueUser": 0.0,
                "impressions": 0,
                "visibles": 0,
                "rendered": 0,
                "eCpm": {
                    "currency": "NOK",
                    "amount": 0
                },
                "uniqueUsers": 0,
                "clicks": 0
            }
        }
	]
}
```

| Key                      | Value      | Description                                                                                                   |
| ------------------------ | ---------- | ------------------------------------------------------------------------------------------------------------- |
| chunks                   | Array      | An array of the data for the selected scope.                                                                  |
| totals                   | Object     | The aggregated totals for selected scope.                                                                     |
| ctr                      | Percentage | Click through rate                                                                                            |
| viewability              | Percentage | The percentage of impressions being more than one second in screen.                                           |
| cost                     | Number     | the total cost of the scope between selected dates.                                                           |
| visibility               | Percentage | Percentage of impressions that has been in screen.                                                            |
| viewables                | Number     | Number of impressions that have been in screen.                                                               |
| lineItem                 | Object     | The Object containing line item information.                                                                  |
| averageAuctionRank       | Number     | The average auction rank of the selected scope. (The average placement if ad unit can hold more than one ad.) |
| impressionsPerUniqueUser | Number     | Number of impressions a unique user makes.                                                                    |
| impressions              | Number     | Total amount of impressions                                                                                   |
| visibles                 | Number     | Number of impressions that has been in screen.                                                                |
| rendered                 | Number     | Number of impressions rendered in the browser.                                                                |
| eCpm                     | Number     | Effective cost per thousand impressions.                                                                      |
| currency                 | String     | Currency                                                                                                      |
| amount                   | Number     | Amount of cost                                                                                                |
| uniqueUsers              | Number     | Number of users that have seen the ad.                                                                        |
| clicks                   | Number     | The number of clicks on the ad.                                                                               |


---

# 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://docs.adnuntius.com/adnuntius-advertising/admin-api/endpoints/stats.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.
