getComplianceSettings

The getComplianceSettings() method retrieves the current privacy settings. Use this command to check visitor decisions. If no decisions have been saved yet, this command returns {consents: {}}.

Syntax

ppms.cm.api('getComplianceSettings', onFulfilled, onRejected);

Parameters

onFulfilled: (settings: ComplianceSettings) => void (required)

The fulfillment handler callback.

Type:

interface ComplianceSettings {
  consents: Record<string, {
    status: -1 | 0 | 1;
    updatedAt: string | null;
  }>;
}

consents is an object keyed by consent type. Each consent type contains:

  • status (number): The visitor's consent decision. See Consent status values.
  • updatedAt (string | null): The ISO 8601 date and time when the consent type was last saved. This property is always present. Its value is null only when the value stored in the ppms_privacy_[appId] cookie doesn't include a timestamp, for example, in older cookie data.

onRejected: (error: object) => void

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

Examples

ppms.cm.api(
  'getComplianceSettings',
  function (settings) {
    console.log(settings)
  },
  function (error) {
    console.error(error)
  }
)