cookie-consent-js
Advanced tools
Comparing version 1.3.5 to 1.3.6
{ | ||
"name": "cookie-consent-js", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"description": "A simple dialog and framework to handle the German and EU law (may 2020) about cookies in a website", | ||
@@ -5,0 +5,0 @@ "main": "src/cookie-consent.js", |
@@ -48,7 +48,26 @@ # cookie-consent-js | ||
### 6. Enable or disable tracking depending on configuration | ||
Client side JavaScript: Surround your tracking code with | ||
```js | ||
if(cookieConsent.trackingAllowed()) { | ||
// Google Analytics code and/or other tracking code | ||
} | ||
``` | ||
Server side PHP: Surround your tracking code with | ||
```php | ||
if($_COOKIE['cookie-consent-tracking-allowed'] === 'true') { | ||
// do some tracking | ||
} | ||
``` | ||
All other languages: Just read, if the cookie `cookie-consent-tracking-allowed` is "true" | ||
## API | ||
This framework writes a cookie (it's default name is `cookie-consent-tracking-allowed`) | ||
with the value `true`, if the user has accepted tracking. You can read the value with the JavaScript | ||
API (`cookieConsent.trackingAllowed()`) or from any other language, which can read cookies. | ||
with the value `"true"`, if the user has accepted tracking. You can read the value with the JavaScript | ||
API (`cookieConsent.trackingAllowed()`) or from any other language, server or client side, which can read cookies. | ||
@@ -126,3 +145,4 @@ ### JavaScript API | ||
You should disable `autoShowModal` in the privacy policy page to make _that_ page readable. | ||
You can disable `autoShowModal`, for instance, in the privacy policy and legal notice pages to make _these_ pages (better) readable. | ||
```js | ||
@@ -138,2 +158,4 @@ var cookieConsent = new CookieConsent({linkPrivacyPolicy: "privacy-policy.html", autoShowModal: false}) | ||
Please read the [LICENSE](./LICENSE). | ||
cookie-consent-js is a project of [shaack.com](https://shaack.com). | ||
If you use anything from this project, do so under the [MIT-License](./LICENSE). | ||
27486
159