Version Description
Download this release
Release Info
Developer | cookiebot |
Plugin | Cookiebot | GDPR Compliant Cookie Consent and Notice |
Version | 3.9.0 |
Comparing to | |
See all releases |
Code changes from version 3.8.0 to 3.9.0
- README.md +1 -1
- addons/addons.json +6 -0
- addons/controller/addons/google-site-kit/google-site-kit.php +331 -0
- addons/controller/addons/woocommerce-google-analytics-pro/woocommerce-google-analytics-pro.php +339 -0
- addons/cookiebot-addons-init.php +1 -1
- addons/tests/integration/addons/test-google-site-kit.php +21 -0
- cookiebot.php +173 -10
- readme.txt +17 -4
README.md
CHANGED
@@ -39,7 +39,7 @@ See [Admin UI](documentation/admin-ui.md)
|
|
39 |
# Roadmap
|
40 |
|
41 |
Following plugins have native (built-in) support for Cookiebot:
|
42 |
-
* [MonsterInsights](https://www.monsterinsights.com/addon/eu-compliance/)
|
43 |
* [PixelYourSite](https://wordpress.org/plugins/pixelyoursite/)
|
44 |
|
45 |
Released and tested addons:
|
39 |
# Roadmap
|
40 |
|
41 |
Following plugins have native (built-in) support for Cookiebot:
|
42 |
+
* [MonsterInsights](https://www.monsterinsights.com/addon/eu-compliance/) (only in the Plus / Pro version)
|
43 |
* [PixelYourSite](https://wordpress.org/plugins/pixelyoursite/)
|
44 |
|
45 |
Released and tested addons:
|
addons/addons.json
CHANGED
@@ -88,5 +88,11 @@
|
|
88 |
},
|
89 |
"Official_Facebook_Pixel": {
|
90 |
"class": "cookiebot_addons\\controller\\addons\\official_facebook_pixel\\Official_Facebook_Pixel"
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
}
|
88 |
},
|
89 |
"Official_Facebook_Pixel": {
|
90 |
"class": "cookiebot_addons\\controller\\addons\\official_facebook_pixel\\Official_Facebook_Pixel"
|
91 |
+
},
|
92 |
+
"Woocommerce_Google_Analytics_Pro": {
|
93 |
+
"class": "cookiebot_addons\\controller\\addons\\woocommerce_google_analytics_pro\\Woocommerce_Google_Analytics_Pro"
|
94 |
+
},
|
95 |
+
"Google_Site_Kit": {
|
96 |
+
"class": "cookiebot_addons\\controller\\addons\\google_site_kit\\Google_Site_Kit"
|
97 |
}
|
98 |
}
|
addons/controller/addons/google-site-kit/google-site-kit.php
ADDED
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cookiebot_addons\controller\addons\google_site_kit;
|
4 |
+
|
5 |
+
use cookiebot_addons\controller\addons\Cookiebot_Addons_Interface;
|
6 |
+
use cookiebot_addons\lib\Cookie_Consent_Interface;
|
7 |
+
use cookiebot_addons\lib\Settings_Service_Interface;
|
8 |
+
use cookiebot_addons\lib\script_loader_tag\Script_Loader_Tag_Interface;
|
9 |
+
use cookiebot_addons\lib\buffer\Buffer_Output_Interface;
|
10 |
+
|
11 |
+
class Google_Site_Kit implements Cookiebot_Addons_Interface {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var Settings_Service_Interface
|
15 |
+
*
|
16 |
+
* @since 1.3.0
|
17 |
+
*/
|
18 |
+
protected $settings;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var Script_Loader_Tag_Interface
|
22 |
+
*
|
23 |
+
* @since 1.3.0
|
24 |
+
*/
|
25 |
+
protected $script_loader_tag;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var Cookie_Consent_Interface
|
29 |
+
*
|
30 |
+
* @since 1.3.0
|
31 |
+
*/
|
32 |
+
public $cookie_consent;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @var Buffer_Output_Interface
|
36 |
+
*
|
37 |
+
* @since 1.3.0
|
38 |
+
*/
|
39 |
+
protected $buffer_output;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Jetpack constructor.
|
43 |
+
*
|
44 |
+
* @param $settings Settings_Service_Interface
|
45 |
+
* @param $script_loader_tag Script_Loader_Tag_Interface
|
46 |
+
* @param $cookie_consent Cookie_Consent_Interface
|
47 |
+
* @param $buffer_output Buffer_Output_Interface
|
48 |
+
*
|
49 |
+
* @since 1.3.0
|
50 |
+
*/
|
51 |
+
public function __construct(
|
52 |
+
Settings_Service_Interface $settings,
|
53 |
+
Script_Loader_Tag_Interface $script_loader_tag,
|
54 |
+
Cookie_Consent_Interface $cookie_consent,
|
55 |
+
Buffer_Output_Interface $buffer_output
|
56 |
+
) {
|
57 |
+
$this->settings = $settings;
|
58 |
+
$this->script_loader_tag = $script_loader_tag;
|
59 |
+
$this->cookie_consent = $cookie_consent;
|
60 |
+
$this->buffer_output = $buffer_output;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Loads addon configuration
|
65 |
+
*
|
66 |
+
* @since 1.3.0
|
67 |
+
*/
|
68 |
+
public function load_configuration() {
|
69 |
+
add_action( 'wp_loaded', array( $this, 'cookiebot_addon_google_site_kit' ), 5 );
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Disable scripts if state not accepted
|
74 |
+
*
|
75 |
+
* @since 1.3.0
|
76 |
+
*/
|
77 |
+
public function cookiebot_addon_google_site_kit() {
|
78 |
+
// Google Tag Manager
|
79 |
+
$this->script_loader_tag->add_tag( 'google_gtagjs', $this->get_cookie_types() );
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Return addon/plugin name
|
84 |
+
*
|
85 |
+
* @return string
|
86 |
+
*
|
87 |
+
* @since 1.3.0
|
88 |
+
*/
|
89 |
+
public function get_addon_name() {
|
90 |
+
return 'Google Site Kit';
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Default placeholder content
|
95 |
+
*
|
96 |
+
* @return string
|
97 |
+
*
|
98 |
+
* @since 1.8.0
|
99 |
+
*/
|
100 |
+
public function get_default_placeholder() {
|
101 |
+
return 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable Google Analytics.';
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Get placeholder content
|
106 |
+
*
|
107 |
+
* This function will check following features:
|
108 |
+
* - Current language
|
109 |
+
*
|
110 |
+
* @param $src
|
111 |
+
*
|
112 |
+
* @return bool|mixed
|
113 |
+
*
|
114 |
+
* @since 1.8.0
|
115 |
+
*/
|
116 |
+
public function get_placeholder( $src = '' ) {
|
117 |
+
return $this->settings->get_placeholder( $this->get_option_name(), $this->get_default_placeholder(),
|
118 |
+
cookiebot_addons_output_cookie_types( $this->get_cookie_types() ), $src );
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Option name in the database
|
123 |
+
*
|
124 |
+
* @return string
|
125 |
+
*
|
126 |
+
* @since 1.3.0
|
127 |
+
*/
|
128 |
+
public function get_option_name() {
|
129 |
+
return 'google_site_kit';
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Plugin file name
|
134 |
+
*
|
135 |
+
* @return string
|
136 |
+
*
|
137 |
+
* @since 1.3.0
|
138 |
+
*/
|
139 |
+
public function get_plugin_file() {
|
140 |
+
return 'google-site-kit/google-site-kit.php';
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Returns checked cookie types
|
145 |
+
* @return mixed
|
146 |
+
*
|
147 |
+
* @since 1.3.0
|
148 |
+
*/
|
149 |
+
public function get_cookie_types() {
|
150 |
+
return $this->settings->get_cookie_types( $this->get_option_name(), $this->get_default_cookie_types() );
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Returns default cookie types
|
155 |
+
* @return array
|
156 |
+
*
|
157 |
+
* @since 1.5.0
|
158 |
+
*/
|
159 |
+
public function get_default_cookie_types() {
|
160 |
+
return array( 'marketing', 'statistics' );
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Check if plugin is activated and checked in the backend
|
165 |
+
*
|
166 |
+
* @since 1.3.0
|
167 |
+
*/
|
168 |
+
public function is_addon_enabled() {
|
169 |
+
return $this->settings->is_addon_enabled( $this->get_option_name() );
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Checks if addon is installed
|
174 |
+
*
|
175 |
+
* @since 1.3.0
|
176 |
+
*/
|
177 |
+
public function is_addon_installed() {
|
178 |
+
return $this->settings->is_addon_installed( $this->get_plugin_file() );
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Checks if addon is activated
|
183 |
+
*
|
184 |
+
* @since 1.3.0
|
185 |
+
*/
|
186 |
+
public function is_addon_activated() {
|
187 |
+
return $this->settings->is_addon_activated( $this->get_plugin_file() );
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Retrieves current installed version of the addon
|
192 |
+
*
|
193 |
+
* @return bool
|
194 |
+
*
|
195 |
+
* @since 2.2.1
|
196 |
+
*/
|
197 |
+
public function get_addon_version() {
|
198 |
+
return $this->settings->get_addon_version( $this->get_plugin_file() );
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Checks if it does have custom placeholder content
|
203 |
+
*
|
204 |
+
* @return mixed
|
205 |
+
*
|
206 |
+
* @since 1.8.0
|
207 |
+
*/
|
208 |
+
public function has_placeholder() {
|
209 |
+
return $this->settings->has_placeholder( $this->get_option_name() );
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* returns all placeholder contents
|
214 |
+
*
|
215 |
+
* @return mixed
|
216 |
+
*
|
217 |
+
* @since 1.8.0
|
218 |
+
*/
|
219 |
+
public function get_placeholders() {
|
220 |
+
return $this->settings->get_placeholders( $this->get_option_name() );
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Return true if the placeholder is enabled
|
225 |
+
*
|
226 |
+
* @return mixed
|
227 |
+
*
|
228 |
+
* @since 1.8.0
|
229 |
+
*/
|
230 |
+
public function is_placeholder_enabled() {
|
231 |
+
return $this->settings->is_placeholder_enabled( $this->get_option_name() );
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Adds extra information under the label
|
236 |
+
*
|
237 |
+
* @return string
|
238 |
+
*
|
239 |
+
* @since 1.8.0
|
240 |
+
*/
|
241 |
+
public function get_extra_information() {
|
242 |
+
return '<p>' . __( 'Blocks Google Analytics scripts', 'cookiebot-addons' ) . '</p>';
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Returns the url of WordPress SVN repository or another link where we can verify the plugin file.
|
247 |
+
*
|
248 |
+
* @return string
|
249 |
+
*
|
250 |
+
* @since 1.8.0
|
251 |
+
*/
|
252 |
+
public function get_svn_url() {
|
253 |
+
return 'http://plugins.svn.wordpress.org/google-site-kit/trunk/google-site-kit.php';
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Placeholder helper overlay in the settings page.
|
258 |
+
*
|
259 |
+
* @return string
|
260 |
+
*
|
261 |
+
* @since 1.8.0
|
262 |
+
*/
|
263 |
+
public function get_placeholder_helper() {
|
264 |
+
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
|
265 |
+
}
|
266 |
+
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Returns parent class or false
|
270 |
+
*
|
271 |
+
* @return string|bool
|
272 |
+
*
|
273 |
+
* @since 2.1.3
|
274 |
+
*/
|
275 |
+
public function get_parent_class() {
|
276 |
+
return get_parent_class( $this );
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Action after enabling the addon on the settings page
|
281 |
+
*
|
282 |
+
* @since 2.2.0
|
283 |
+
*/
|
284 |
+
public function post_hook_after_enabling() {
|
285 |
+
//do nothing
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Cookiebot plugin is deactivated
|
290 |
+
*
|
291 |
+
* @since 2.2.0
|
292 |
+
*/
|
293 |
+
public function plugin_deactivated() {
|
294 |
+
//do nothing
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* @return mixed
|
299 |
+
*
|
300 |
+
* @since 2.4.5
|
301 |
+
*/
|
302 |
+
public function extra_available_addon_option() {
|
303 |
+
//do nothing
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Returns boolean to enable/disable plugin by default
|
308 |
+
*
|
309 |
+
* @return bool
|
310 |
+
*
|
311 |
+
* @since 3.6.3
|
312 |
+
*/
|
313 |
+
public function enable_by_default() {
|
314 |
+
return false;
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Sets default settings for this addon
|
319 |
+
*
|
320 |
+
* @return array
|
321 |
+
*
|
322 |
+
* @since 3.6.3
|
323 |
+
*/
|
324 |
+
public function get_default_enable_setting() {
|
325 |
+
return array(
|
326 |
+
'enabled' => 1,
|
327 |
+
'cookie_type' => $this->get_default_cookie_types(),
|
328 |
+
'placeholder' => $this->get_default_placeholder(),
|
329 |
+
);
|
330 |
+
}
|
331 |
+
}
|
addons/controller/addons/woocommerce-google-analytics-pro/woocommerce-google-analytics-pro.php
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cookiebot_addons\controller\addons\woocommerce_google_analytics_pro;
|
4 |
+
|
5 |
+
use cookiebot_addons\controller\addons\Cookiebot_Addons_Interface;
|
6 |
+
use cookiebot_addons\lib\buffer\Buffer_Output_Interface;
|
7 |
+
use cookiebot_addons\lib\script_loader_tag\Script_Loader_Tag_Interface;
|
8 |
+
use cookiebot_addons\lib\Cookie_Consent_Interface;
|
9 |
+
use cookiebot_addons\lib\Settings_Service_Interface;
|
10 |
+
|
11 |
+
class Woocommerce_Google_Analytics_Pro implements Cookiebot_Addons_Interface {
|
12 |
+
/**
|
13 |
+
* @var Settings_Service_Interface
|
14 |
+
*
|
15 |
+
* @since 1.3.0
|
16 |
+
*/
|
17 |
+
protected $settings;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var Script_Loader_Tag_Interface
|
21 |
+
*
|
22 |
+
* @since 1.3.0
|
23 |
+
*/
|
24 |
+
protected $script_loader_tag;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @var Cookie_Consent_Interface
|
28 |
+
*
|
29 |
+
* @since 1.3.0
|
30 |
+
*/
|
31 |
+
public $cookie_consent;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var Buffer_Output_Interface
|
35 |
+
*
|
36 |
+
* @since 1.3.0
|
37 |
+
*/
|
38 |
+
protected $buffer_output;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Jetpack constructor.
|
42 |
+
*
|
43 |
+
* @param $settings Settings_Service_Interface
|
44 |
+
* @param $script_loader_tag Script_Loader_Tag_Interface
|
45 |
+
* @param $cookie_consent Cookie_Consent_Interface
|
46 |
+
* @param $buffer_output Buffer_Output_Interface
|
47 |
+
*
|
48 |
+
* @since 1.2.0
|
49 |
+
*/
|
50 |
+
public function __construct( Settings_Service_Interface $settings, Script_Loader_Tag_Interface $script_loader_tag, Cookie_Consent_Interface $cookie_consent, Buffer_Output_Interface $buffer_output ) {
|
51 |
+
$this->settings = $settings;
|
52 |
+
$this->script_loader_tag = $script_loader_tag;
|
53 |
+
$this->cookie_consent = $cookie_consent;
|
54 |
+
$this->buffer_output = $buffer_output;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Loads addon configuration
|
59 |
+
*
|
60 |
+
* @since 1.3.0
|
61 |
+
*/
|
62 |
+
public function load_configuration() {
|
63 |
+
/**
|
64 |
+
* We add the action after wp_loaded and replace the original GA Google
|
65 |
+
* Analytics action with our own adjusted version.
|
66 |
+
*/
|
67 |
+
add_action( 'wp_loaded', array( $this, 'cookiebot_addon_woocommerce_google_analytics_pro_tracking_code' ), 5 );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Manipulate the scripts if they are loaded.
|
72 |
+
*
|
73 |
+
* @since 1.3.0
|
74 |
+
*/
|
75 |
+
public function cookiebot_addon_woocommerce_google_analytics_pro_tracking_code() {
|
76 |
+
|
77 |
+
add_filter( 'wc_google_analytics_pro_script_attributes', array( $this, 'cookiebot_addon_woocommerce_google_analytics_pro_script_attributes' ) );
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Return attributes for script tags
|
83 |
+
*/
|
84 |
+
function cookiebot_addon_woocommerce_google_analytics_pro_script_attributes() {
|
85 |
+
$attr = array();
|
86 |
+
$attr['type'] = 'text/plain';
|
87 |
+
$attr['data-cookieconsent'] = implode(',',$this->get_cookie_types());
|
88 |
+
return $attr;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Return addon/plugin name
|
93 |
+
*
|
94 |
+
* @return string
|
95 |
+
*
|
96 |
+
* @since 1.3.0
|
97 |
+
*/
|
98 |
+
public function get_addon_name() {
|
99 |
+
return 'WooCommerce Google Analytics Pro';
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Default placeholder content
|
104 |
+
*
|
105 |
+
* @return string
|
106 |
+
*
|
107 |
+
* @since 1.8.0
|
108 |
+
*/
|
109 |
+
public function get_default_placeholder() {
|
110 |
+
return 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable facebook shopping feature.';
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Get placeholder content
|
115 |
+
*
|
116 |
+
* This function will check following features:
|
117 |
+
* - Current language
|
118 |
+
*
|
119 |
+
* @param $src
|
120 |
+
*
|
121 |
+
* @return bool|mixed
|
122 |
+
*
|
123 |
+
* @since 1.8.0
|
124 |
+
*/
|
125 |
+
public function get_placeholder( $src = '' ) {
|
126 |
+
return $this->settings->get_placeholder( $this->get_option_name(), $this->get_default_placeholder(), cookiebot_addons_output_cookie_types( $this->get_cookie_types() ), $src );
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Option name in the database
|
131 |
+
*
|
132 |
+
* @return string
|
133 |
+
*
|
134 |
+
* @since 1.3.0
|
135 |
+
*/
|
136 |
+
public function get_option_name() {
|
137 |
+
return 'woocommerce_google_analytics_pro';
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Plugin file name
|
142 |
+
*
|
143 |
+
* @return string
|
144 |
+
*
|
145 |
+
* @since 1.3.0
|
146 |
+
*/
|
147 |
+
public function get_plugin_file() {
|
148 |
+
return 'woocommerce-google-analytics-pro/woocommerce-google-analytics-pro.php';
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Returns checked cookie types
|
153 |
+
* @return mixed
|
154 |
+
*
|
155 |
+
* @since 1.3.0
|
156 |
+
*/
|
157 |
+
public function get_cookie_types() {
|
158 |
+
return $this->settings->get_cookie_types( $this->get_option_name(), $this->get_default_cookie_types() );
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Returns default cookie types
|
163 |
+
* @return array
|
164 |
+
*
|
165 |
+
* @since 1.5.0
|
166 |
+
*/
|
167 |
+
public function get_default_cookie_types() {
|
168 |
+
return array( 'statistics' );
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Check if plugin is activated and checked in the backend
|
173 |
+
*
|
174 |
+
* @since 1.3.0
|
175 |
+
*/
|
176 |
+
public function is_addon_enabled() {
|
177 |
+
return $this->settings->is_addon_enabled( $this->get_option_name() );
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Checks if addon is installed
|
182 |
+
*
|
183 |
+
* @since 1.3.0
|
184 |
+
*/
|
185 |
+
public function is_addon_installed() {
|
186 |
+
return $this->settings->is_addon_installed( $this->get_plugin_file() );
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Checks if addon is activated
|
191 |
+
*
|
192 |
+
* @since 1.3.0
|
193 |
+
*/
|
194 |
+
public function is_addon_activated() {
|
195 |
+
return $this->settings->is_addon_activated( $this->get_plugin_file() );
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Retrieves current installed version of the addon
|
200 |
+
*
|
201 |
+
* @return bool
|
202 |
+
*
|
203 |
+
* @since 2.2.1
|
204 |
+
*/
|
205 |
+
public function get_addon_version() {
|
206 |
+
return $this->settings->get_addon_version( $this->get_plugin_file() );
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Checks if it does have custom placeholder content
|
211 |
+
*
|
212 |
+
* @return mixed
|
213 |
+
*
|
214 |
+
* @since 1.8.0
|
215 |
+
*/
|
216 |
+
public function has_placeholder() {
|
217 |
+
return $this->settings->has_placeholder( $this->get_option_name() );
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* returns all placeholder contents
|
222 |
+
*
|
223 |
+
* @return mixed
|
224 |
+
*
|
225 |
+
* @since 1.8.0
|
226 |
+
*/
|
227 |
+
public function get_placeholders() {
|
228 |
+
return $this->settings->get_placeholders( $this->get_option_name() );
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Return true if the placeholder is enabled
|
233 |
+
*
|
234 |
+
* @return mixed
|
235 |
+
*
|
236 |
+
* @since 1.8.0
|
237 |
+
*/
|
238 |
+
public function is_placeholder_enabled() {
|
239 |
+
return $this->settings->is_placeholder_enabled( $this->get_option_name() );
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Adds extra information under the label
|
244 |
+
*
|
245 |
+
* @return string
|
246 |
+
*
|
247 |
+
* @since 1.8.0
|
248 |
+
*/
|
249 |
+
public function get_extra_information() {
|
250 |
+
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Returns the url of WordPress SVN repository or another link where we can verify the plugin file.
|
255 |
+
*
|
256 |
+
* @return string
|
257 |
+
*
|
258 |
+
* @since 1.8.0
|
259 |
+
*/
|
260 |
+
public function get_svn_url() {
|
261 |
+
return false; //Commercial plugin - not available
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Placeholder helper overlay in the settings page.
|
266 |
+
*
|
267 |
+
* @return string
|
268 |
+
*
|
269 |
+
* @since 1.8.0
|
270 |
+
*/
|
271 |
+
public function get_placeholder_helper() {
|
272 |
+
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
|
273 |
+
}
|
274 |
+
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Returns parent class or false
|
278 |
+
*
|
279 |
+
* @return string|bool
|
280 |
+
*
|
281 |
+
* @since 2.1.3
|
282 |
+
*/
|
283 |
+
public function get_parent_class() {
|
284 |
+
return get_parent_class( $this );
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Action after enabling the addon on the settings page
|
289 |
+
*
|
290 |
+
* @since 2.2.0
|
291 |
+
*/
|
292 |
+
public function post_hook_after_enabling() {
|
293 |
+
//do nothing
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Cookiebot plugin is deactivated
|
298 |
+
*
|
299 |
+
* @since 2.2.0
|
300 |
+
*/
|
301 |
+
public function plugin_deactivated() {
|
302 |
+
//do nothing
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* @return mixed
|
307 |
+
*
|
308 |
+
* @since 2.4.5
|
309 |
+
*/
|
310 |
+
public function extra_available_addon_option() {
|
311 |
+
//do nothing
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* Returns boolean to enable/disable plugin by default
|
316 |
+
*
|
317 |
+
* @return bool
|
318 |
+
*
|
319 |
+
* @since 3.6.3
|
320 |
+
*/
|
321 |
+
public function enable_by_default() {
|
322 |
+
return false;
|
323 |
+
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Sets default settings for this addon
|
327 |
+
*
|
328 |
+
* @return array
|
329 |
+
*
|
330 |
+
* @since 3.6.3
|
331 |
+
*/
|
332 |
+
public function get_default_enable_setting() {
|
333 |
+
return array(
|
334 |
+
'enabled' => 1,
|
335 |
+
'cookie_type' => $this->get_default_cookie_types(),
|
336 |
+
'placeholder' => $this->get_default_placeholder(),
|
337 |
+
);
|
338 |
+
}
|
339 |
+
}
|
addons/cookiebot-addons-init.php
CHANGED
@@ -23,7 +23,7 @@ define( 'COOKIEBOT_ADDONS_BASE_NAME', dirname( plugin_basename( __FILE__ ) ) );
|
|
23 |
/**
|
24 |
* Same version as the CookiebotWP
|
25 |
*/
|
26 |
-
define( 'COOKIEBOT_ADDONS_VERSION', '3.
|
27 |
|
28 |
/**
|
29 |
* Register autoloader to load files/classes dynamically
|
23 |
/**
|
24 |
* Same version as the CookiebotWP
|
25 |
*/
|
26 |
+
define( 'COOKIEBOT_ADDONS_VERSION', '3.9.0' );
|
27 |
|
28 |
/**
|
29 |
* Register autoloader to load files/classes dynamically
|
addons/tests/integration/addons/test-google-site-kit.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cookiebot_addons\tests\integration\addons;
|
4 |
+
|
5 |
+
class Test_Google_Site_Kit extends Addons_Base {
|
6 |
+
|
7 |
+
public function setUp() {
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* This will validate if the hook script with handle "google_gtagjs" still exists
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
public function test_google_site_kit() {
|
16 |
+
$content = $this->curl_get_content( 'http://plugins.svn.wordpress.org/google-site-kit/trunk/includes/Modules/Analytics.php' );
|
17 |
+
|
18 |
+
$this->assertNotFalse( strpos( $content, "wp_script_add_data( 'google_gtagjs', 'script_execution', 'async' );") );
|
19 |
+
|
20 |
+
}
|
21 |
+
}
|
cookiebot.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control
|
|
4 |
Plugin URI: https://cookiebot.com/
|
5 |
Description: Cookiebot is a cloud-driven solution that automatically controls cookies and trackers, enabling full GDPR/ePrivacy and CCPA compliance for websites.
|
6 |
Author: Cybot A/S
|
7 |
-
Version: 3.
|
8 |
Author URI: http://cookiebot.com
|
9 |
Text Domain: cookiebot
|
10 |
Domain Path: /langs
|
@@ -21,7 +21,7 @@ final class Cookiebot_WP {
|
|
21 |
* @var string
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
-
public $version = '3.
|
25 |
|
26 |
/**
|
27 |
* @var Cookiebot_WP The single instance of the class
|
@@ -103,7 +103,7 @@ final class Cookiebot_WP {
|
|
103 |
/**
|
104 |
* Cookiebot_WP Init Cookiebot.
|
105 |
*
|
106 |
-
* @version 3.
|
107 |
* @since 1.6.2
|
108 |
* @access public
|
109 |
*/
|
@@ -186,7 +186,9 @@ final class Cookiebot_WP {
|
|
186 |
load_plugin_textdomain('cookiebot', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
|
187 |
|
188 |
//add JS
|
189 |
-
add_action('wp_head', array($this,'add_js'), -
|
|
|
|
|
190 |
add_shortcode('cookie_declaration', array($this,'show_declaration'));
|
191 |
|
192 |
//Add filter if WP rocket is enabled
|
@@ -318,6 +320,7 @@ final class Cookiebot_WP {
|
|
318 |
|
319 |
add_submenu_page('cookiebot',__('Cookiebot Settings','cookiebot'),__('Settings','cookiebot'), 'manage_options', 'cookiebot',array($this,'settings_page'), 10 );
|
320 |
add_submenu_page('cookiebot',__('Cookiebot Support','cookiebot'),__('Support','cookiebot'), 'manage_options', 'cookiebot_support',array($this,'support_page'), 20 );
|
|
|
321 |
add_submenu_page('cookiebot',__('IAB','cookiebot'),__('IAB','cookiebot'), 'manage_options', 'cookiebot_iab',array($this,'iab_page'), 30 );
|
322 |
|
323 |
if(defined('COOKIEBOT_ADDONS_UNSUPPORTED_PHPVERSION')) {
|
@@ -368,7 +371,7 @@ final class Cookiebot_WP {
|
|
368 |
/**
|
369 |
* Cookiebot_WP Register Cookiebot settings
|
370 |
*
|
371 |
-
* @version
|
372 |
* @since 1.0.0
|
373 |
*/
|
374 |
function register_cookiebot_settings() {
|
@@ -376,6 +379,7 @@ final class Cookiebot_WP {
|
|
376 |
register_setting('cookiebot', 'cookiebot-language');
|
377 |
register_setting('cookiebot', 'cookiebot-nooutput');
|
378 |
register_setting('cookiebot', 'cookiebot-nooutput-admin');
|
|
|
379 |
register_setting('cookiebot', 'cookiebot-autoupdate');
|
380 |
register_setting('cookiebot', 'cookiebot-script-tag-uc-attribute');
|
381 |
register_setting('cookiebot', 'cookiebot-script-tag-cd-attribute');
|
@@ -384,6 +388,10 @@ final class Cookiebot_WP {
|
|
384 |
register_setting('cookiebot-iab', 'cookiebot-iab');
|
385 |
register_setting('cookiebot-legislations', 'cookiebot-ccpa');
|
386 |
register_setting('cookiebot-legislations', 'cookiebot-ccpa-domain-group-id');
|
|
|
|
|
|
|
|
|
387 |
}
|
388 |
|
389 |
/**
|
@@ -483,7 +491,7 @@ final class Cookiebot_WP {
|
|
483 |
/**
|
484 |
* Cookiebot_WP Output settings page
|
485 |
*
|
486 |
-
* @version
|
487 |
* @since 1.0.0
|
488 |
*/
|
489 |
function settings_page() {
|
@@ -791,6 +799,27 @@ final class Cookiebot_WP {
|
|
791 |
</p>
|
792 |
</td>
|
793 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
794 |
</table>
|
795 |
</div>
|
796 |
<?php if($this->is_wp_consent_api_active()) { ?>
|
@@ -1159,6 +1188,48 @@ final class Cookiebot_WP {
|
|
1159 |
<?php
|
1160 |
}
|
1161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1162 |
/**
|
1163 |
* Cookiebot_WP Cookiebot IAB page
|
1164 |
*
|
@@ -1229,7 +1300,7 @@ final class Cookiebot_WP {
|
|
1229 |
/**
|
1230 |
* Cookiebot_WP Debug Page
|
1231 |
*
|
1232 |
-
* @version 3.
|
1233 |
* @since 3.6.0
|
1234 |
*/
|
1235 |
|
@@ -1263,9 +1334,18 @@ final class Cookiebot_WP {
|
|
1263 |
$debugStr.= "Auto update: ".(get_option('cookiebot-autoupdate') == '1' ? 'Enabled' : 'Not enabled')."\n";
|
1264 |
$debugStr.= "Hide Cookie Popup: ".(get_option('cookiebot-nooutput') == '1' ? 'Yes' : 'No')."\n";
|
1265 |
$debugStr.= "Disable Cookiebot in WP Admin: ".(get_option('cookiebot-nooutput-admin') == '1' ? 'Yes' : 'No')."\n";
|
|
|
1266 |
$debugStr.= "Banner tag: ".$this->add_js(false)."\n";
|
1267 |
$debugStr.= "Declaration tag: ".$this->show_declaration()."\n";
|
1268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1269 |
if($this->is_wp_consent_api_active()) {
|
1270 |
$debugStr.= "\n--- WP Consent Level API Mapping ---\n";
|
1271 |
$debugStr .= 'F = Functional, N = Necessary, P = Preferences, M = Marketing, S = Statistics, SA = Statistics Anonymous'."\n";
|
@@ -1325,7 +1405,7 @@ final class Cookiebot_WP {
|
|
1325 |
/**
|
1326 |
* Cookiebot_WP Add Cookiebot JS to <head>
|
1327 |
*
|
1328 |
-
* @version 3.
|
1329 |
* @since 1.0.0
|
1330 |
*/
|
1331 |
function add_js($printTag=true) {
|
@@ -1334,11 +1414,12 @@ final class Cookiebot_WP {
|
|
1334 |
if(is_multisite() && get_site_option('cookiebot-nooutput',false)) {
|
1335 |
return; //Is multisite - and disabled output is checked as network setting
|
1336 |
}
|
|
|
1337 |
if(get_option('cookiebot-nooutput',false)) {
|
1338 |
return; //Do not show JS - output disabled
|
1339 |
}
|
1340 |
|
1341 |
-
if($this->get_cookie_blocking_mode() == 'auto' && $this->can_current_user_edit_theme() && $printTag !== false ) {
|
1342 |
return;
|
1343 |
}
|
1344 |
|
@@ -1358,11 +1439,21 @@ final class Cookiebot_WP {
|
|
1358 |
$tagAttr = 'data-blockingmode="auto"';
|
1359 |
}
|
1360 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1361 |
$iab = ( get_option('cookiebot-iab') != false ) ? 'data-framework="IAB"' : '';
|
1362 |
|
1363 |
$ccpa = ( get_option('cookiebot-ccpa') != false ) ? 'data-georegions="{\'region\':\'US-06\',\'cbid\':\''.get_option('cookiebot-ccpa-domain-group-id').'\'}"' : '';
|
1364 |
|
1365 |
-
$tag = '<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" '.$iab.' '.$ccpa.' data-cbid="'.$cbid.'"'.$lang.' type="text/javascript" '.$tagAttr.'></script>';
|
1366 |
if($printTag===false) {
|
1367 |
return $tag;
|
1368 |
}
|
@@ -1370,6 +1461,78 @@ final class Cookiebot_WP {
|
|
1370 |
}
|
1371 |
}
|
1372 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1373 |
/**
|
1374 |
* Returns true if an user is logged in and has an edit_themes capability
|
1375 |
*
|
4 |
Plugin URI: https://cookiebot.com/
|
5 |
Description: Cookiebot is a cloud-driven solution that automatically controls cookies and trackers, enabling full GDPR/ePrivacy and CCPA compliance for websites.
|
6 |
Author: Cybot A/S
|
7 |
+
Version: 3.9.0
|
8 |
Author URI: http://cookiebot.com
|
9 |
Text Domain: cookiebot
|
10 |
Domain Path: /langs
|
21 |
* @var string
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
+
public $version = '3.9.0';
|
25 |
|
26 |
/**
|
27 |
* @var Cookiebot_WP The single instance of the class
|
103 |
/**
|
104 |
* Cookiebot_WP Init Cookiebot.
|
105 |
*
|
106 |
+
* @version 3.8.1
|
107 |
* @since 1.6.2
|
108 |
* @access public
|
109 |
*/
|
186 |
load_plugin_textdomain('cookiebot', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
|
187 |
|
188 |
//add JS
|
189 |
+
add_action('wp_head', array($this,'add_js'), -9997);
|
190 |
+
add_action('wp_head', array($this,'add_GTM'), -9998);
|
191 |
+
add_action('wp_head', array($this,'add_GCM'), -9999);
|
192 |
add_shortcode('cookie_declaration', array($this,'show_declaration'));
|
193 |
|
194 |
//Add filter if WP rocket is enabled
|
320 |
|
321 |
add_submenu_page('cookiebot',__('Cookiebot Settings','cookiebot'),__('Settings','cookiebot'), 'manage_options', 'cookiebot',array($this,'settings_page'), 10 );
|
322 |
add_submenu_page('cookiebot',__('Cookiebot Support','cookiebot'),__('Support','cookiebot'), 'manage_options', 'cookiebot_support',array($this,'support_page'), 20 );
|
323 |
+
add_submenu_page('cookiebot',__('Google Tag Manager','cookiebot'),__('Google Tag Manager','cookiebot'), 'manage_options', 'cookiebot_GTM',array($this,'GTM_page') );
|
324 |
add_submenu_page('cookiebot',__('IAB','cookiebot'),__('IAB','cookiebot'), 'manage_options', 'cookiebot_iab',array($this,'iab_page'), 30 );
|
325 |
|
326 |
if(defined('COOKIEBOT_ADDONS_UNSUPPORTED_PHPVERSION')) {
|
371 |
/**
|
372 |
* Cookiebot_WP Register Cookiebot settings
|
373 |
*
|
374 |
+
* @version 3.9.0
|
375 |
* @since 1.0.0
|
376 |
*/
|
377 |
function register_cookiebot_settings() {
|
379 |
register_setting('cookiebot', 'cookiebot-language');
|
380 |
register_setting('cookiebot', 'cookiebot-nooutput');
|
381 |
register_setting('cookiebot', 'cookiebot-nooutput-admin');
|
382 |
+
register_setting('cookiebot', 'cookiebot-output-logged-in');
|
383 |
register_setting('cookiebot', 'cookiebot-autoupdate');
|
384 |
register_setting('cookiebot', 'cookiebot-script-tag-uc-attribute');
|
385 |
register_setting('cookiebot', 'cookiebot-script-tag-cd-attribute');
|
388 |
register_setting('cookiebot-iab', 'cookiebot-iab');
|
389 |
register_setting('cookiebot-legislations', 'cookiebot-ccpa');
|
390 |
register_setting('cookiebot-legislations', 'cookiebot-ccpa-domain-group-id');
|
391 |
+
register_setting('cookiebot-gtm', 'cookiebot-gtm');
|
392 |
+
register_setting('cookiebot-gtm', 'cookiebot-gtm-id');
|
393 |
+
register_setting('cookiebot-gtm', 'cookiebot-data-layer');
|
394 |
+
register_setting('cookiebot-gtm', 'cookiebot-gcm');
|
395 |
}
|
396 |
|
397 |
/**
|
491 |
/**
|
492 |
* Cookiebot_WP Output settings page
|
493 |
*
|
494 |
+
* @version 3.9.0
|
495 |
* @since 1.0.0
|
496 |
*/
|
497 |
function settings_page() {
|
799 |
</p>
|
800 |
</td>
|
801 |
</tr>
|
802 |
+
<tr valign="top">
|
803 |
+
<th scope="row"><?php _e('Enable Cookiebot on front end while logged in','cookiebot'); ?></th>
|
804 |
+
<td>
|
805 |
+
<?php
|
806 |
+
$disabled = false;
|
807 |
+
if($is_ms && get_site_option('cookiebot-output-logged-in',false)) {
|
808 |
+
echo '<input type="checkbox" checked disabled />';
|
809 |
+
$disabled = true;
|
810 |
+
}
|
811 |
+
else {
|
812 |
+
?>
|
813 |
+
<input type="checkbox" name="cookiebot-output-logged-in" value="1" <?php checked(1,get_option('cookiebot-output-logged-in',false), true); ?> />
|
814 |
+
<?php
|
815 |
+
}
|
816 |
+
?>
|
817 |
+
<p class="description">
|
818 |
+
<?php if($disabled) { echo '<b>'._('Network setting applied. Please contact website administrator to change this setting.').'</b><br />'; } ?>
|
819 |
+
<b><?php _e('This checkbox will enable Cookiebot on front end while you\'re logged in','cookiebot') ?></b>
|
820 |
+
</p>
|
821 |
+
</td>
|
822 |
+
</tr>
|
823 |
</table>
|
824 |
</div>
|
825 |
<?php if($this->is_wp_consent_api_active()) { ?>
|
1188 |
<?php
|
1189 |
}
|
1190 |
|
1191 |
+
/**
|
1192 |
+
* Cookiebot_WP Google Tag Manager page
|
1193 |
+
*
|
1194 |
+
* @version 3.8.1
|
1195 |
+
* @since 3.8.1
|
1196 |
+
*/
|
1197 |
+
|
1198 |
+
function GTM_page(){
|
1199 |
+
?>
|
1200 |
+
<div class="wrap">
|
1201 |
+
<h1><?php _e('Google Tag Manager', 'cookiebot')?></h1>
|
1202 |
+
|
1203 |
+
<form method="post" action="options.php" style="display: grid; grid-template-columns: 35% 65%; grid-row-gap: 20px; width: 700px; align-items: center;">
|
1204 |
+
<?php settings_fields( 'cookiebot-gtm' ); ?>
|
1205 |
+
<?php do_settings_sections( 'cookiebot-gtm' ); ?>
|
1206 |
+
|
1207 |
+
<p><?php _e('Enable GTM', 'cookiebot')?></p>
|
1208 |
+
<div class="GTM_check">
|
1209 |
+
<input type="checkbox" name="cookiebot-gtm" id="cookiebot-gtm" value="1" <?php checked(1,get_option('cookiebot-gtm'), true); ?> style="float: left; margin: 2px 4px 0 0">
|
1210 |
+
<p style="margin: 0; font-style: italic;"><?php _e('For more details about Cookiebot and Google Tag Manager click', 'cookiebot') ?><a target="_blank" href="https://www.cookiebot.com/en/google-tag-manager-and-gdpr-compliance-with-cookiebot/" style="margin: 0; font-style: italic;"> <?php _e('here', 'cookiebot')?></a></p>
|
1211 |
+
</div>
|
1212 |
+
|
1213 |
+
<p><?php _e('GTM ID', 'cookiebot')?></p>
|
1214 |
+
<input type="text" name="cookiebot-gtm-id" id="cookiebot-gtm-id" value="<?php echo get_option('cookiebot-gtm-id'); ?>" style="height: 30px;">
|
1215 |
+
|
1216 |
+
<p><?php _e('DataLayer name', 'cookiebot')?></p>
|
1217 |
+
<div>
|
1218 |
+
<input type="text" name="cookiebot-data-layer" id="data_layer" placeholder="dataLayer" value="<?php echo get_option('cookiebot-data-layer'); ?>" style="height: 30px;">
|
1219 |
+
<p style="margin: 0;"><?php _e('Optional, only change if necessary', 'cookiebot')?></p>
|
1220 |
+
</div>
|
1221 |
+
|
1222 |
+
<p><?php _e('Google Consent Mode', 'cookiebot')?></p>
|
1223 |
+
<div class="GTM_check">
|
1224 |
+
<input type="checkbox" name="cookiebot-gcm" id="gcm" value="1" <?php checked(1,get_option('cookiebot-gcm'), true); ?> style="float: left; margin: 2px 4px 0 0">
|
1225 |
+
<p style="margin: 0; font-style: italic;"><?php _e('For more details about Cookiebot and Google Consent Mode click', 'cookiebot') ?><a target="_blank" href="https://support.cookiebot.com/hc/en-us/articles/360016047000-Cookiebot-and-Google-Consent-Mode" style="margin: 0; font-style: italic;"> <?php _e('here', 'cookiebot')?></a></p>
|
1226 |
+
</div>
|
1227 |
+
<input type="submit" value="Save" name="gtm_save" style="background-color: rgb(0, 124, 186); color: white; padding: 5px 10px; border: none; border-radius: 5px; justify-self: start;">
|
1228 |
+
</form>
|
1229 |
+
</div>
|
1230 |
+
<?php
|
1231 |
+
}
|
1232 |
+
|
1233 |
/**
|
1234 |
* Cookiebot_WP Cookiebot IAB page
|
1235 |
*
|
1300 |
/**
|
1301 |
* Cookiebot_WP Debug Page
|
1302 |
*
|
1303 |
+
* @version 3.9.
|
1304 |
* @since 3.6.0
|
1305 |
*/
|
1306 |
|
1334 |
$debugStr.= "Auto update: ".(get_option('cookiebot-autoupdate') == '1' ? 'Enabled' : 'Not enabled')."\n";
|
1335 |
$debugStr.= "Hide Cookie Popup: ".(get_option('cookiebot-nooutput') == '1' ? 'Yes' : 'No')."\n";
|
1336 |
$debugStr.= "Disable Cookiebot in WP Admin: ".(get_option('cookiebot-nooutput-admin') == '1' ? 'Yes' : 'No')."\n";
|
1337 |
+
$debugStr.= "Enable Cookiebot on front end while logged in: ".(get_option('cookiebot-output-logged-in') == '1' ? 'Yes' : 'No')."\n";
|
1338 |
$debugStr.= "Banner tag: ".$this->add_js(false)."\n";
|
1339 |
$debugStr.= "Declaration tag: ".$this->show_declaration()."\n";
|
1340 |
|
1341 |
+
if(get_option('cookiebot-gtm') != false ){
|
1342 |
+
$debugStr.= "GTM tag: ".$this->add_GTM(false)."\n";
|
1343 |
+
}
|
1344 |
+
|
1345 |
+
if(get_option('cookiebot-gcm') != false ){
|
1346 |
+
$debugStr.= "GCM tag: ".$this->add_GCM(false)."\n";
|
1347 |
+
}
|
1348 |
+
|
1349 |
if($this->is_wp_consent_api_active()) {
|
1350 |
$debugStr.= "\n--- WP Consent Level API Mapping ---\n";
|
1351 |
$debugStr .= 'F = Functional, N = Necessary, P = Preferences, M = Marketing, S = Statistics, SA = Statistics Anonymous'."\n";
|
1405 |
/**
|
1406 |
* Cookiebot_WP Add Cookiebot JS to <head>
|
1407 |
*
|
1408 |
+
* @version 3.9.0
|
1409 |
* @since 1.0.0
|
1410 |
*/
|
1411 |
function add_js($printTag=true) {
|
1414 |
if(is_multisite() && get_site_option('cookiebot-nooutput',false)) {
|
1415 |
return; //Is multisite - and disabled output is checked as network setting
|
1416 |
}
|
1417 |
+
|
1418 |
if(get_option('cookiebot-nooutput',false)) {
|
1419 |
return; //Do not show JS - output disabled
|
1420 |
}
|
1421 |
|
1422 |
+
if($this->get_cookie_blocking_mode() == 'auto' && $this->can_current_user_edit_theme() && $printTag !== false && get_site_option('cookiebot-output-logged-in') == false) {
|
1423 |
return;
|
1424 |
}
|
1425 |
|
1439 |
$tagAttr = 'data-blockingmode="auto"';
|
1440 |
}
|
1441 |
|
1442 |
+
if (get_option('cookiebot-gtm') != false) {
|
1443 |
+
if (empty(get_option('cookiebot-data-layer'))) {
|
1444 |
+
$data_layer = 'data-layer-name="dataLayer"';
|
1445 |
+
} else {
|
1446 |
+
$data_layer = 'data-layer-name="' . get_option('cookiebot-data-layer') . '"';
|
1447 |
+
}
|
1448 |
+
} else {
|
1449 |
+
$data_layer = '';
|
1450 |
+
}
|
1451 |
+
|
1452 |
$iab = ( get_option('cookiebot-iab') != false ) ? 'data-framework="IAB"' : '';
|
1453 |
|
1454 |
$ccpa = ( get_option('cookiebot-ccpa') != false ) ? 'data-georegions="{\'region\':\'US-06\',\'cbid\':\''.get_option('cookiebot-ccpa-domain-group-id').'\'}"' : '';
|
1455 |
|
1456 |
+
$tag = '<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" '.$iab.' '.$ccpa.' '.$data_layer.' data-cbid="'.$cbid.'"'.$lang.' type="text/javascript" '.$tagAttr.'></script>';
|
1457 |
if($printTag===false) {
|
1458 |
return $tag;
|
1459 |
}
|
1461 |
}
|
1462 |
}
|
1463 |
|
1464 |
+
/**
|
1465 |
+
* Cookiebot_WP Add Google Tag Manager JS to <head>
|
1466 |
+
*
|
1467 |
+
* @version 3.8.1
|
1468 |
+
* @since 3.8.1
|
1469 |
+
*/
|
1470 |
+
|
1471 |
+
function add_GTM($printTag=true) {
|
1472 |
+
|
1473 |
+
if(get_option('cookiebot-gtm') != false ){
|
1474 |
+
|
1475 |
+
if(empty(get_option('cookiebot-data-layer'))){
|
1476 |
+
$data_layer = 'dataLayer';
|
1477 |
+
}else{
|
1478 |
+
$data_layer = get_option('cookiebot-data-layer');
|
1479 |
+
}
|
1480 |
+
|
1481 |
+
$GTM = "<script>";
|
1482 |
+
if( get_option('cookiebot-iab') ) {
|
1483 |
+
$GTM .= 'window ["gtag_enable_tcf_support"] = true;';
|
1484 |
+
}
|
1485 |
+
|
1486 |
+
$GTM .= "(function (w, d, s, l, i) {
|
1487 |
+
w[l] = w[l] || []; w[l].push({'gtm.start':new Date().getTime(), event: 'gtm.js'});
|
1488 |
+
var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
1489 |
+
j.async = true; j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
1490 |
+
f.parentNode.insertBefore(j, f);})
|
1491 |
+
(window, document, 'script', '" . $data_layer . "', '" . get_option('cookiebot-gtm-id') . "');";
|
1492 |
+
|
1493 |
+
|
1494 |
+
$GTM .= "</script>";
|
1495 |
+
|
1496 |
+
if($printTag===false) {
|
1497 |
+
return $GTM;
|
1498 |
+
}
|
1499 |
+
|
1500 |
+
echo $GTM;
|
1501 |
+
}
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
/**
|
1505 |
+
* Cookiebot_WP Add Google Consent Mode JS to <head>
|
1506 |
+
*
|
1507 |
+
* @version 3.8.1
|
1508 |
+
* @since 3.8.1
|
1509 |
+
*/
|
1510 |
+
|
1511 |
+
function add_GCM($printTag=true) {
|
1512 |
+
|
1513 |
+
if(get_option('cookiebot-gcm') != false ){
|
1514 |
+
|
1515 |
+
if(empty(get_option('cookiebot-data-layer'))){
|
1516 |
+
$data_layer = 'dataLayer';
|
1517 |
+
}else{
|
1518 |
+
$data_layer = get_option('cookiebot-data-layer');
|
1519 |
+
}
|
1520 |
+
|
1521 |
+
$GCM = '<script data-cookieconsent="ignore">
|
1522 |
+
(function(w,d,l){w[l]=w[l]||[];function gtag(){w[l].push(arguments)};
|
1523 |
+
gtag("consent","default",{ad_storage:d,analytics_storage:d,wait_for_update:500,});
|
1524 |
+
gtag("set", "ads_data_redaction", true);})(window,"denied","' . $data_layer . '");';
|
1525 |
+
|
1526 |
+
$GCM .= '</script>';
|
1527 |
+
|
1528 |
+
if($printTag===false) {
|
1529 |
+
return $GCM;
|
1530 |
+
}
|
1531 |
+
|
1532 |
+
echo $GCM;
|
1533 |
+
}
|
1534 |
+
}
|
1535 |
+
|
1536 |
/**
|
1537 |
* Returns true if an user is logged in and has an edit_themes capability
|
1538 |
*
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
* Contributors: cookiebot,phpgeekdk,aytac
|
3 |
* Tags: cookie, compliance, eu, gdpr, europe, cookie consent, consent, ccpa
|
4 |
* Requires at least: 4.4
|
5 |
-
* Tested up to: 5.
|
6 |
-
* Stable tag: 3.
|
7 |
* Requires PHP: 5.6
|
8 |
* License: GPLv2 or later
|
9 |
|
@@ -177,8 +177,15 @@ if(function_exists('cookiebot_active') && cookiebot_active()) {
|
|
177 |
|
178 |
The developer of the plugin can see more details on [our Github repository](https://github.com/CybotAS/CookiebotAddons)
|
179 |
|
180 |
-
### Can I use Cookiebot with
|
181 |
-
Cookiebot works with GTM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
[Please see our article on how to deploy Cookiebot with GTM](https://support.cookiebot.com/hc/en-us/articles/360003793854-Google-Tag-Manager-deployment).
|
184 |
|
@@ -190,6 +197,12 @@ You are able to define the mapping between Cookiebot and the WP Consent API in t
|
|
190 |
|
191 |
## Changelog ##
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
### 3.8.0 - 2020-09-07 ###
|
194 |
* New addon for Official Facebook Pixel plugin
|
195 |
* Fixes and improvements
|
2 |
* Contributors: cookiebot,phpgeekdk,aytac
|
3 |
* Tags: cookie, compliance, eu, gdpr, europe, cookie consent, consent, ccpa
|
4 |
* Requires at least: 4.4
|
5 |
+
* Tested up to: 5.6
|
6 |
+
* Stable tag: 3.9.0
|
7 |
* Requires PHP: 5.6
|
8 |
* License: GPLv2 or later
|
9 |
|
177 |
|
178 |
The developer of the plugin can see more details on [our Github repository](https://github.com/CybotAS/CookiebotAddons)
|
179 |
|
180 |
+
### Can I use Cookiebot with Google Tag Manager? ###
|
181 |
+
Cookiebot works with GTM. There are two different options setting up GTM with Cookiebot:
|
182 |
+
|
183 |
+
1. Use the Google Tag Manager option in the plugin settings to enable GTM together with Cookiebot. Here you also have the option to enable Google Consent Mode for GTM.
|
184 |
+
2. Add the GTM script manually or by using another plugin to your site.
|
185 |
+
|
186 |
+
Should you choose one of these methods, Cookiebot must not be implemented using GTM as this would result in Cookiebot being loaded twice.
|
187 |
+
|
188 |
+
If you prefer the latter method, you should select ´Hide Cookie Popup´ in the Cookiebot WordPress plugin settings.
|
189 |
|
190 |
[Please see our article on how to deploy Cookiebot with GTM](https://support.cookiebot.com/hc/en-us/articles/360003793854-Google-Tag-Manager-deployment).
|
191 |
|
197 |
|
198 |
## Changelog ##
|
199 |
|
200 |
+
### 3.9.0 - 2020-10-20 ###
|
201 |
+
* Added support for Google Tag Manager and Google Consent Mode
|
202 |
+
* Added gtag TCF support
|
203 |
+
* Added WooCommerce Google Analytics Pro addon
|
204 |
+
* Support for enabling Cookiebot in administration
|
205 |
+
|
206 |
### 3.8.0 - 2020-09-07 ###
|
207 |
* New addon for Official Facebook Pixel plugin
|
208 |
* Fixes and improvements
|