What does setInitialComplianceSettings do?

So we are using a custom consent form and I’m looking at the following two functions setInitialComplianceSettings and setComplianceSettings and I don’t really understand when to use setInitialComplianceSettings.

Step 10 in the Third party cookie consent guide says to call the following code when the popup is displayed:

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?

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”.

Thank you for the reply, it makes more sense now :slight_smile:

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?

It’s just for the purpose of consent stats.