# What does setInitialComplianceSettings do?

**URL:** <https://community.piwik.pro/t/what-does-setinitialcompliancesettings-do/1586>\
**Category:** Privacy\
**Created:** [February 2, 2023, 10:53am UTC](https://community.piwik.pro/t/what-does-setinitialcompliancesettings-do/1586 "2023-02-02T10:53:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![malmberg](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@malmberg](https://community.piwik.pro/u/malmberg)\
**Post date:** [February 2, 2023, 10:53am UTC](https://community.piwik.pro/t/what-does-setinitialcompliancesettings-do/1586/1 "2023-02-02T10:53:42Z")

</div>

So we are using a custom consent form and I’m looking at the following two functions [setInitialComplianceSettings](https://developers.piwik.pro/en/latest/consent_manager/js_api/index.html#set-initial-compliance-settings) and [setComplianceSettings](https://developers.piwik.pro/en/latest/consent_manager/js_api/index.html#set-compliance-settings) and I don’t really understand when to use `setInitialComplianceSettings`.

Step 10 in the [Third party cookie consent guide](https://help.piwik.pro/support/privacy/how-can-i-integrate-a-third-party-cookie-consent-tool-with-piwik-pro/?pk_vid=1675332667c4c957#integrate-with-a-cookie-consent-tool) says to call the following code when the popup is displayed:

```auto
ppms.cm.api(
  "setInitialComplianceSettings",
  {
    consents: ["analytics"],
  },
  function onSuccess() {},
  function onError() {}
);

```

But what does it do? What does it actually mean that we send “analytics” when we display the popop? Should we send an empty consent array if we don’t allow analytics until the visitor have agreed to tracking, eg `consents: []`. And then when the user agrees we call `setComplianceSettings` with the actual consents given by the user, in that case what’s the purpose of initialCompliance?

I guess my question is: What does `setInitialComplianceSettings` actually do?

---

<div class="post-metadata">

**Author:** ![Admin](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Admin](https://community.piwik.pro/u/Admin)\
**Post date:** [February 2, 2023, 1:45pm UTC](https://community.piwik.pro/t/what-does-setinitialcompliancesettings-do/1586/2 "2023-02-02T13:45:30Z")

</div>

It’s an additional method that makes it possible to display reminder bar if the consent decision was not made. You should list here all available consent types - it won’t set the status, because that has to be done via the other metod that finally sets it. One more thing - you can skip it entirely, but in this case our consent stats module will not record “first consent” event. It’ll be always recognized as “consent changed”.

---

<div class="post-metadata">

**Author:** ![malmberg](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@malmberg](https://community.piwik.pro/u/malmberg)\
**Post date:** [February 3, 2023, 11:50am UTC](https://community.piwik.pro/t/what-does-setinitialcompliancesettings-do/1586/3 "2023-02-03T11:50:33Z")

</div>

Thank you for the reply, it makes more sense now 🙂

> One more thing - you can skip it entirely, but in this case our consent stats module will not record “first consent” event. It’ll be always recognized as “consent changed”.

Does this have any effect on the gathered data, or is it just a “cosmetic” thing when looking at the sessions / consent stats?

---

<div class="post-metadata">

**Author:** ![Admin](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Admin](https://community.piwik.pro/u/Admin)\
**Post date:** [February 3, 2023, 11:53am UTC](https://community.piwik.pro/t/what-does-setinitialcompliancesettings-do/1586/4 "2023-02-03T11:53:29Z")

</div>

It’s just for the purpose of consent stats.
