setInitialComplianceSettings

The setInitialComplianceSettings() method sets initial compliance settings in the cookie, recording no decision for each consent type. Use this command to confirm that a visitor has viewed the form. You can pass the result from the getNewComplianceTypes() method directly.

Syntax

ppms.cm.api('setInitialComplianceSettings', settings, onFulfilled, onRejected);

Parameters

settings: string[] | { consents: string[] } (required)

The consent types to initialize.

This command saves status: -1 for each consent type passed to the command. Consent Manager automatically sets updatedAt when saving the cookie.

onFulfilled: (types: string[]) => void (required)

The fulfillment handler callback. It receives the initialized consent type names.

onRejected: (error: object) => void

The rejection handler callback. If not specified, the error is logged in the console.

Examples

ppms.cm.api(
  'setInitialComplianceSettings',
  ['analytics', 'remarketing'],
  function (types) {
    console.log('Initialized consent types:', types)
  },
  function (error) {
    console.error(error)
  }
)