openConsentForm

The openConsentForm() method opens the built-in consent form. It does not work if custom consent form mode is enabled.

Syntax

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

Parameters

onFulfilled: (popupId: string, consentTypes: string[], consents: string[]) => void

The fulfillment handler callback.

  • popupId: ID of the consent popup. Example: "ppms_cm_consent_popup_30a851b6-6bf4-45f9-9a53-583401bb5d60".
  • consentTypes: Array of consent types. Example: ["analytics", "conversion_tracking", "remarketing"].
  • consents: Array of consent types currently approved by the visitor. Example: ["analytics", "remarketing"].

onRejected: (error: object) => void

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

Examples

ppms.cm.api(
  'openConsentForm',
  function (popupId, consentTypes, consents) {
    console.log(popupId, consentTypes, consents)
  },
  function (error) {
    console.error(error)
  }
)