PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 3.7.0
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v3.7.0
4.7.2 4.7.1 trunk 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 3.0.0 3.0.1 3.1.0 3.10.0 3.10.1 3.11.1 3.11.2 3.11.3 3.2.0 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.5 3.6.6 3.7.0 3.7.1 3.8.0 3.9.0 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.2.0 4.2.1 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.3.10 4.3.11 4.3.12 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.7.1 4.3.8 4.3.9 4.3.9.1 4.4.0 4.4.1 4.4.2 4.5.0 4.5.1 4.5.10 4.5.11 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 4.5.9 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.7.0
cookiebot / CookiebotAPI.md
cookiebot Last commit date
addons 5 years ago assets 7 years ago bin 5 years ago css 5 years ago documentation 7 years ago js 5 years ago langs 8 years ago tests 5 years ago widgets 7 years ago CookiebotAPI.md 7 years ago LICENSE.txt 8 years ago README.md 7 years ago cookiebot-logo.png 8 years ago cookiebot.php 5 years ago phpunit.xml 7 years ago readme.txt 5 years ago
CookiebotAPI.md
93 lines
1 # How do I make my plugin support Cookiebot?
2 If you favourite plugins doesn’t support Cookiebot you are always welcome to ask the author to add support for Cookiebot.
3 Cookiebot provides a helper function to check if there is an active, working version of Cookiebot on the website.
4 The easiest way for at developer to implement Cookiebot support is to add a check for Cookiebot where tags are outputted to the visitor.
5
6 This can be done following way:
7
8 ```php
9 $scriptTag = ";
10 if(function_exists('cookiebot_active') && cookiebot_active()) {
11 $scriptTag = '<script'.cookiebot_assist('statistics').'>';
12 }
13 ```
14
15 A users consent state can be be aquired through Cookiebots JS API.
16
17 The following properties are available on the Cookiebot object:
18
19 | Name | Type | Default | Description |
20 |---------------------|:----:|:-------:|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
21 | consent.necessary | bool | true | True if current user has accepted necessary cookies. <br> The property is read only. |
22 | consent.preferences | bool | false | True if current user has accepted preference cookies. <br> The property is read only. |
23 | consent.statistics | bool | false | True if current user has accepted statistics cookies. <br> The property is read only. |
24 | consent.marketing | bool | false | True if current user has accepted marketing cookies. <br> The property is read only. |
25 | consented | bool | false | True if the user has accepted cookies. <br> The property is read only. |
26 | declined | bool | false | True if the user has declined the use of cookies. <br> The property is read only. |
27 | hasResponse | bool | false | True if the user has responded to the dialog with either 'accept' or 'decline'. |
28 | doNotTrack | bool | false | True if the user has enabled the web browser's 'Do not track' (DNT) setting. <br> If DNT is enabled Cookiebot will not set the third party cookie CookieConsentBulkTicket used for bulk consent. <br> The property is read only. |
29
30 Callbacks
31
32 | Name | Description |
33 |-------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
34 | CookiebotCallback_OnLoad | The asynchronous callback is triggered when the cookie banner has loaded to get the user's consent. |
35 | CookiebotCallback_OnAccept | The asynchronous callback is triggered when the user clicks the accept-button of the cookie consent dialog and whenever a consented user loads a page. | |
36 | CookiebotCallback_OnDecline | The asynchronous callback is triggered when the user declines the use of cookies by clicking the decline-button in the cookie consent dialog. The callback is also triggered whenever a user that has declined the use of cookies loads a page. | |
37
38
39 And through PHP:
40
41 ```php
42 if (isset($_COOKIE["CookieConsent"]))
43 {
44 switch ($_COOKIE["CookieConsent"])
45 {
46 case "0":
47 //The user has not accepted cookies - set strictly necessary cookies only
48 break;
49
50 case "-1":
51 //The user is not within a region that requires consent - all cookies are accepted
52 break;
53
54 default: //The user has accepted one or more type of cookies
55
56 //Read current user consent in encoded JavaScript format
57 $valid_php_json = preg_replace('/\s*:\s*([a-zA-Z0-9_]+?)([}\[,])/', ':"$1"$2', preg_replace('/([{\[,])\s*([a-zA-Z0-9_]+?):/', '$1"$2":', str_replace("'", '"',stripslashes($_COOKIE["CookieConsent"]))));
58 $CookieConsent = json_decode($valid_php_json);
59
60 if (filter_var($CookieConsent->preferences, FILTER_VALIDATE_BOOLEAN))
61 {
62 //Current user accepts preference cookies
63 }
64 else
65 {
66 //Current user does NOT accept preference cookies
67 }
68
69 if (filter_var($CookieConsent->statistics, FILTER_VALIDATE_BOOLEAN))
70 {
71 //Current user accepts statistics cookies
72 }
73 else
74 {
75 //Current user does NOT accept statistics cookies
76 }
77
78 if (filter_var($CookieConsent->marketing, FILTER_VALIDATE_BOOLEAN))
79 {
80 //Current user accepts marketing cookies
81 }
82 else
83 {
84 //Current user does NOT accept marketing cookies
85 }
86 }
87 }
88 else
89 {
90 //The user has not accepted cookies - set strictly necessary cookies only
91 }
92 ```
93 More details are available at https://www.cookiebot.com/goto/developer/