68publishers-cookie-consent
Advanced tools
Comparing version 0.3.1 to 0.3.2-beta.1
{ | ||
"name": "68publishers-cookie-consent", | ||
"version": "0.3.1", | ||
"version": "0.3.2-beta.1", | ||
"description": "Cookie consent wrapper based on orestbida/cookieconsent with GTM integration.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://www.68publishers.io/", |
@@ -21,2 +21,3 @@ <div align="center" style="text-align: center; margin-bottom: 50px"> | ||
* [Triggering tags based on the consent](#triggering-tags-based-on-the-consent) | ||
* [Accessing the wrapper in the JavaScript](#accessing-the-wrapper-in-the-javascript) | ||
* [Development](#development) | ||
@@ -222,2 +223,23 @@ * [License](#license) | ||
## Accessing the wrapper in the JavaScript | ||
The wrapper is accessible in the `window` under the name `CookieConsentWrapper`. The recommended way how to manipulate with it is through event callbacks because the wrapper may not be fully initialized at the time your script is executed. | ||
Callbacks are attached with calling of the method `CookieConsentWrapper.on()`. | ||
### Init event | ||
The only currently available event is `init`. A callback is invoked when the wrapper is fully initialized or directly if everything has been already initialized. | ||
```html | ||
<script> | ||
CookieConsentWrapper.on('init', function (wrapper) { | ||
if (wrapper.allowedCategory('analytics_storage')) { | ||
// check if the analytics_storage is granted | ||
} | ||
wrapper.unwrap(); // get the original cookie consent plugin | ||
}); | ||
</script> | ||
``` | ||
## Development | ||
@@ -224,0 +246,0 @@ |
113918
273