> For the complete documentation index, see [llms.txt](https://community.commandersact.com/customer-success/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community.commandersact.com/customer-success/faqs/consent-and-preference-management/sdk-cmp-consent-mode.md).

# SDK CMP : Consent Mode

<details>

<summary>How do I initialise the privacy module?</summary>

Here's how to do it:

<img src="/files/DkSuxm2XCRh8VB9nICqF" alt="" data-size="original">

2 parameters must be entered:&#x20;

* The siteID&#x20;
* The privacyID

</details>

<details>

<summary>What is the purpose of the json file?</summary>

This file is optional!

The json file allows you to display the privacy centre (2nd level of the CMP) without the need for any specific development and therefore at a lower cost.

Please note, however, that the json file does not allow for much customisation. If your graphic expectations are very high, we recommend that you develop this UI yourself, using our

One of the main advantages of json is that it allows you to update the privacy centre without having to resubmit your application to the store.&#x20;

\*The assistance of a consultant is required for json configuration.

</details>

<details>

<summary>What if I don't want to use the json file?</summary>

You can create your own privacy centre

You can develop your own interface if you wish, but make sure you use the recommended methods (later in this document) so that the consent is correctly interpreted by the SDK.

</details>

<details>

<summary>What if I develop my own UI ?</summary>

All you need to do is add the SDK methods for each user action on your main banner and your privacy centreTo track user actions correctly, and feed the dashboards (to find out the opt-in rate) you'll need to implement a few functions

You can find the entire library here <https://github.com/CommandersAct/tcconsent-flutter-plugin/blob/master/lib/tc_consent.dart>

</details>

<details>

<summary>Can the first level of CMP be managed via json?</summary>

The json file only manages the privacy centre

If you want to configure a first level of CMP (with the buttons accept all, set cookies, refuse all) you will have to develop it yourself. To track user actions correctly, and feed the dashboards (to find out the opt-in rate) you will have to implement a few functions (detailed later in this document).

You can also consult the entire library here <https://github.com/CommandersAct/tcconsent-flutter-plugin/blob/master/lib/tc_consent.dart>

</details>

<details>

<summary>How do you manage the accept all and reject all buttons?</summary>

On your first banner&#x20;

With json, all you have to do is integrate these methods on the buttons

<img src="/files/IpshTlnLFzJrO4WiHxQ3" alt="" data-size="original">

Without json Use the saveConsentFromConsentSourceWithPrivacyAction method By feeding the consent, source and action parameters

<img src="/files/ie4lemxLVwJMheWCNPKL" alt="" data-size="original">

</details>

<details>

<summary>How do you feed the consent parameter? </summary>

On your first banner & On your custom privacy centre (if you don't use json)&#x20;

Use the method saveConsentFromConsentSourceWithPrivacyAction method&#x20;

Fill the consent parameter as follows Define the consent table with the correct values&#x20;

Remember: 1 means accept, 0 means refuse

* For an accept all button, everything will have a value of 1
* For a refuse all button, everything will have a value of 0

<img src="/files/W3CMjW8rAeWfeKpUJytQ" alt="" data-size="original">

\*If you use json, this part will be managed natively by the SDK in the privacy centre.

</details>

<details>

<summary>What are the right IDs to use?</summary>

On your first banner AND on your custom privacy centre (if you don't use json)

Don't know your category and vendor IDs?&#x20;

You can view them easily on the platform in the&#x20;

Trust => Categories & Tags tab.

&#x20;If you prefer, you can ask your consultant to provide them for you.

</details>

<details>

<summary>How do you feed the source parameter?</summary>

On your first banner AND on your custom privacy centre (if you're not using json)

In the method saveConsentFromConsentSourceWithPrivacyAction method&#x20;

Set the source parameter to the correct value

<img src="/files/WAkwHY170R1ybBkU6Nz8" alt="" data-size="original">

Possible values

<img src="/files/JFAOvH6N6QwuEQZLOfSU" alt="" data-size="original">

\*if you use json, this part will be managed natively by the SDK for the privacy centre.

</details>

<details>

<summary>How can I obtain statistics from the dashboards in the consent analysis tab?</summary>

Prerequisite:

In the SDK settings, you need to enter a banner ID.

To obtain this ID, we strongly recommend that you create a banner dedicated to your app on the interface (Source => Privacy Banners).

This banner does not need any text or graphic style. It simply needs to include the same categories (privacy centre) as those of your application.

No need to generate and/or deploy this banner

Its main purpose is to create a column in the dashboard interface

</details>

<details>

<summary>How can I obtain statistics from the dashboards in the consent analysis tab (with JSON) ?</summary>

Main banner (with json)

Here are the functions to integrate if you use json :

<img src="/files/FTVI0W2ttIOC2NXjTJo5" alt="" data-size="original">

</details>

<details>

<summary>How can I obtain statistics from the dashboards in the consent analysis tab (without JSON) ?</summary>

Main banner (without json)

Here are the functions to integrate if you don't use json :

<img src="/files/4bDkxATknwrEpBEf2fMl" alt="" data-size="original">

</details>

<details>

<summary>Privacy Center (with json) : How can I obtain statistics from the dashboards in the consent analysis tab?</summary>

Privacy Center (with json)

You don't have to do a thing, it's all native

<img src="/files/y9DYTENZicEfJoLiIVcN" alt="" data-size="original">

</details>

<details>

<summary>Privacy Center (without json) : How can I obtain statistics from the dashboards in the consent analysis tab?</summary>

Privacy Center (without json)

Here are the functions to integrate if you don't use json :

<img src="/files/peWMvAsyWnelx4Q051Hz" alt="" data-size="original">

</details>

<details>

<summary>How do I transfer consent to a webview?</summary>

Only 2 steps to follow!

Prerequisite: have a Commanders Act banner on your website

Step 1: Your IT team must retrieve the consent using the method below and transfer it via a local storage

\*Recommendation for naming the local storage key: rgpd\_consent

<img src="/files/3AankiF9AadQ7m9lToX7" alt="" data-size="original">

Step 2: A consultant must implement custom javascript code in the web banner to interpret the local storage correctly.

</details>

<details>

<summary>How do I set the consent validity period?</summary>

The CNIL recommends setting the duration at 6 months

Here's how to set the validity period

<img src="/files/3GxxOQUMdNj75XmrHQnW" alt="" data-size="original">

</details>

<details>

<summary>Why and how do you reset consent?</summary>

If you make major changes to your privacy

If, for example, you want to add a new category to your privacy centre, you will need to ask for the user's consent to opt-in to this new category.

To do this, you need to use the following method

<img src="/files/xDEzHbvXVPYteN8327pI" alt="" data-size="original">

</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 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://community.commandersact.com/customer-success/faqs/consent-and-preference-management/sdk-cmp-consent-mode.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.
