# Get statistics

## Get Statistics

<mark style="color:blue;">`GET`</mark> `https://api-internal.commander1.com/v2/{siteId}/privacy/statistics`

This endpoint allows you to get the data from the consent dashboard on a specific date range

#### Path Parameters

| Name     | Type   | Description                           |
| -------- | ------ | ------------------------------------- |
| {siteId} | string | <p>Account ID<br>example: '12345'</p> |

#### Query Parameters

| Name                                | Type    | Description                                                                             |
| ----------------------------------- | ------- | --------------------------------------------------------------------------------------- |
| filter\[sup\_filters]\[location]\[] | integer | <p>Data inside and outside of the EU<br>0 : Out of EU<br>1 : EU</p>                     |
| filter\[sup\_filters]\[device]\[]   | integer | <p>Typical device types<br>0 : others<br>1 : mobile<br>2 : tablet<br>3 : desktop</p>    |
| token                               | string  | Authentication token. Optional if the header "Authorization' parameter is used instead. |
| filter\[begin\_date]                | string  | example: '2021-04-30'                                                                   |
| filter\[end\_date]                  | string  | example: '2021-04-31'                                                                   |

{% tabs %}
{% tab title="200 Data successfully retrieved." %}

```
{
    "data": [
        {
            "type": "privacy/statistic",
            "id": "1",
            "attributes": {
                "nb_banner_views": 198,
                "nb_banner_clicks_button": 32,
                "nb_optin": 34,
                "nb_optin_all": 33,
                "nb_optin_all_on_click_banner": 23,
                "nb_banner_clicks_links_not_PC": 1,
                "nb_PC_views": 1,
                "nb_optin_all_on_browsing": 10,
                "optin_rate": 0.1717171717171717,
                "optout_rate": 0,
                "nb_optin_category_1": 35,
                "optin_rate_category_1": 0.17676767676767677,
                "nb_optin_category_2": 35,
                "optin_rate_category_2": 0.17676767676767677,
                "nb_optin_category_3": 35,
                "optin_rate_category_3": 0.17676767676767677,
                "nb_optin_category_4": 35,
                "optin_rate_category_4": 0.17676767676767677,
                "nb_optin_category_5": 14,
                "optin_rate_category_5": 0.0707070707070707,
                "nb_optin_category_10001": 7,
                "optin_rate_category_10001": 0.03535353535353535,
                "nb_optin_category_10003": 7,
                "optin_rate_category_10003": 0.03535353535353535,
                "nb_optin_category_10005": 7,
                "optin_rate_category_10005": 0.03535353535353535,
                "nb_optin_category_10007": 7,
                "optin_rate_category_10007": 0.03535353535353535,
                "nb_optin_category_10009": 7,
                "optin_rate_category_10009": 0.03535353535353535,
                "nb_optin_category_10011": 7,
                "optin_rate_category_10011": 0.03535353535353535,
                "nb_optin_category_10013": 7,
                "optin_rate_category_10013": 0.03535353535353535,
                "nb_optin_category_10015": 7,
                "optin_rate_category_10015": 0.03535353535353535,
                "nb_optin_category_10017": 7,
                "optin_rate_category_10017": 0.03535353535353535,
                "nb_optin_category_10019": 7,
                "optin_rate_category_10019": 0.03535353535353535,
                "nb_optin_category_13001": 7,
                "optin_rate_category_13001": 0.03535353535353535,
                "nb_optin_category_13003": 7,
                "optin_rate_category_13003": 0.03535353535353535
            }
        },
        {
            "type": "privacy/statistic",
            "id": "20",
            "attributes": {
                "nb_PC_views": 1,
                "optin_rate": 0,
                "optout_rate": 0
            }
        }
    ]
}
```

{% endtab %}

{% tab title="401 Invalid token" %}

```
{
    "errors": [
        {
            "status": 401,
            "title": "Unauthenticated.",
            "detail": "The access token provided is expired, revoked, malformed, or invalid.",
            "context": []
        }
    ]
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Example Request" %}

```bash
https://api-internal.commander1.com/v2/siteId/privacy/statistics?token=XXXXXX&filter%5Bbegin_date%5D=2021-04-30&filter%5Bend_date%5D=2021-04-31&filter%5Bsup_filters%5D%5Bdevice%5D%5B%5D=1&filter%5Bsup_filters%5D%5Blocation%5D%5B%5D=0&filter%5Bsup_filters%5D%5Blocation%5D%5B%5D=1
```

{% endtab %}
{% endtabs %}

## How to get the token

For each API, you'll have to ask a token to your account manager or support team.


---

# 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://community.commandersact.com/trustcommander/platform-api/get-consent-statistics.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.
