> For the complete documentation index, see [llms.txt](https://doc.commandersact.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.commandersact.com/fr/fonctionnalites/consent-management/platform-api/get-statistics.md).

# Obtenir les statistiques

## Obtenir les statistiques

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

Ce point de terminaison vous permet d'obtenir les données du Dashboard de consentement pour une plage de dates spécifique

#### Paramètres de chemin

| Nom                                | Type   | Description                              |
| ---------------------------------- | ------ | ---------------------------------------- |
| <p>{siteId}<br>(\*obligatoire)</p> | string | <p>ID du compte<br>exemple : '12345'</p> |

#### Paramètres de requête

| Nom                                          | Type   | Description                                                                                               |
| -------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------- |
| filter\[sup\_filters]\[location]\[]          | entier | <p>Données à l'intérieur et à l'extérieur de l'UE<br>0 : Hors UE<br>1 : UE</p>                            |
| filter\[sup\_filters]\[device]\[]            | entier | <p>Types d'appareils typiques<br>0 : autres<br>1 : mobile<br>2 : tablette<br>3 : ordinateur de bureau</p> |
| <p>token<br>(\*obligatoire)</p>              | string | Jeton d'authentification. Facultatif si le paramètre d'en-tête "Authorization" est utilisé à la place.    |
| filter\[begin\_date] (\*obligatoire)         | string | exemple : '2021-04-30'                                                                                    |
| <p>filter\[end\_date]<br>(\*obligatoire)</p> | string | exemple : '2021-04-31'                                                                                    |

{% tabs %}
{% tab title="200 Données récupérées avec succès." %}

```
{
    "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 Jeton invalide" %}

```
{
    "errors": [
        {
            "status": 401,
            "title": "Non authentifié.",
            "detail": "Le jeton d'accès fourni est expiré, révoqué, mal formé ou invalide.",
            "context": []
        }
    ]
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Exemple de requête" %}

```bash
https://api-internal.commander1.com/v2/siteId/privacy/statistics?token=XXXXXX&filter%5Bbegin_date%5D=YYYY-MM-DD&filter%5Bend_date%5D=YYYY-MM-DD&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 %}

## Comment obtenir le jeton

Pour chaque API, vous devrez demander un jeton à votre responsable de compte ou à l'équipe support.

## Comment utiliser des paramètres supplémentaires

**Filtres d'appareil**\
`&filter[sup_filters][device][]=2&filter[sup_filters][device][]=3&filter[sup_filters][device][]=0`\
1 = Mobile\
2 = Tablette\
3 = Ordinateur de bureau\
0 = Autres\
(dans l'exemple ci-dessus, l'appareil mobile est exclu)\
\
**Filtres de localisation**\
`&filter[sup_filters][location][]=0`\
1 = UE\
0 = Hors UE\
(dans l'exemple ci-dessus, la localisation de l'utilisateur dans l'UE est exclue)

## Exemple de résultat

```json
{
    "data": [{
        "type": "privacy/statistic",
        "id": "2",
        "attributes": {
            "nb_visitors_exposed_to_privacy": 11448,
            "nb_banner_views": 11445,
            "nb_banner_clicks_button": 10478,
            "nb_PC_views": 1863,
            "nb_PC_vendor_views": 100,
            "nb_PC_clicks_save": 1089,
            "nb_optin_PC_save": 373,
            "nb_optin": 8724,
            "nb_explicit_optin": 8776,
            "nb_optout": 2769,
            "nb_optout_on_click_banner": 2075,
            "optin_rate": 0.7620545073375262,
            "optout_rate": 0.2418763102725367,
            "nb_optin_category_1": 8718,
            "optin_rate_category_1": 0.7615303983228512,
            "nb_optin_category_3": 8708,
            "optin_rate_category_3": 0.7606568832983928,
            "nb_optin_category_5": 8708,
            "optin_rate_category_5": 0.7606568832983928
           
        }
    }, {
        "type": "privacy/statistic",
        "id": "4",
        "attributes": {
            "nb_visitors_exposed_to_privacy": 17623,
            "nb_banner_views": 17618,
            "nb_banner_clicks_button": 15029,
            "nb_PC_views": 2377,
            "nb_PC_vendor_views": 465,
            "nb_PC_clicks_save": 1917,
            "nb_optin_PC_save": 713,
            "nb_optin": 13280,
            "nb_explicit_optin": 13460,
            "nb_optout": 3484,
            "nb_optout_on_click_banner": 2282,
            "optin_rate": 0.7535606877376156,
            "optout_rate": 0.19769619247574194,
            "nb_optin_category_1": 13331,
            "optin_rate_category_1": 0.7564546331498609,
            "nb_optin_category_3": 13318,
            "optin_rate_category_3": 0.7557169607898768,
            "nb_optin_category_5": 13302,
            "optin_rate_category_5": 0.7548090563468195,
            "nb_optin_category_7": 13303,
            "optin_rate_category_7": 0.7548658003745106,
            "nb_optin_category_9": 13308,
            "optin_rate_category_9": 0.755149520512966
        }
    }]
}
```


---

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.commandersact.com/fr/fonctionnalites/consent-management/platform-api/get-statistics.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
