Overview
Use the ppms.cm.api method to call Consent Manager commands from JavaScript.
After you install the container code on your site, it creates the _paq queue. Commands are added to the queue and executed after the library loads.
Syntax
ppms.cm.api(command, ...args)Parameters
command: string (required)
Command name.
args (optional)
Command arguments. The number of arguments and their meaning depend on the command.
Returns
Commands run asynchronously and return no value. Type: undefined.
Notes
- All commands work in the context of the current visitor and website. Some commands communicate with a Piwik PRO server and are asynchronous.
- Callback functions provide response values or error information.
onSuccess(...args)is required forgetComplianceSettings,getComplianceTypes,getNewComplianceTypes,sendDataRequest,setComplianceSettingsandsetInitialComplianceSettings. It is optional foropenConsentFormand tracking commands.onFailure(error)is optional. If specified, it receives anobject. If not specified, the error is logged in the console.- Command pages use TypeScript-style callback signatures, for example,
onFulfilled: (settings: ComplianceSettings) => void.
Available consent types
Here are the types of consent that are available:
analyticsab_testing_and_personalizationcustom_consentuser_feedbackmarketing_automationremarketingconversion_tracking
Consent status values
The following status values are used in consents[type].status:
-1: No decision. Returned only bygetComplianceSettings. For example, a visitor closes the consent popup without making a choice.0: Rejected1: Approved