Javascript-APIs
CCM19 offers several Javascript-APIs that can be used to access the functionalities of the Cookie-Manager and respond to user interactions.
Global object
The direct control options of CCM19 are bundled in the global Javascript-object CCM
:
Variable/method | Type | Description |
---|---|---|
CCM.acceptedCookies | string[] | List of the names of all accepted cookies. |
CCM.acceptedEmbeddings | [ { id: string , name: string , } , ... ] |
List of all accepted embeddings. (from version 2020.10.28) |
CCM.availableLocales() | string[] | List of active languages - e.g. ['de_DE', 'en_US'] (from version 2022.03.24) |
CCM.closeControlPanel() | Closes the dialog for selecting the purposes to be accepted. | |
CCM.closeWidget() | Closes the cookie-dialog. | |
CCM.consent | boolean | Indicates whether the site visitor has defined and saved their consent-settings. This can also mean that everything has been rejected. |
CCM.crossDomainConsentString | string | Fragment identifier for manually composing a URL for the Consent-division. (as of version 2020.10.14) |
CCM.fullConsentGiven | boolean | Indicates whether the site visitor has consented to all options. A positive result implies the same for CCM.consent . (after version 2023.03.29) |
CCM.navigate(url[, replace[, navigateTop]]) | Navigates to a different URL (like location.href = url ), but takes into account the Consent-split. replace controls whether location.replace is used and navigateTop controls whether the complete page is navigated for frames. (from version 2020.10.14) |
|
CCM.openControlPanel() | Opens the dialog for selecting the purposes to be accepted. | |
CCM.openWidget() | Opens the cookie-dialog again. | |
CCM.switchLocale(localeName) | Switches the language - see CCM.availableLocales() (from version 2022.03.24) |
|
CCM.ucid | ?string | The unique Consent-ID, or null if no Consent has yet been issued. |
CCM.version | string | Contains the current CCM19-version. (from version 2020.10.28) |
Alternatively, the dialogs can also be controlled via links with the targets #CCM.openWidget
, #CCM.closeWidget
, #CCM.openControlPanel
and #CCM.closeControlPanel
.
Extension for advertising- and tracking-free networks
If the option "My website is part of an advertising- and tracking-free network " is active in the Developer-Settings > Frontend-Behavior section of the domain, the following endpoints are defined and can be used in the frontend.
The following endpoints were published with version 2023.03.20 and are not available in older versions.