PluginProbe
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 3.10.1
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v3.10.1
4.7.4 4.7.5 4.7.3 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 All 95 releases
cookiebot / addons / controller / addons / wpforms / cookie-after-consent.js

cookie-after-consent.js in Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode 3.10.1, at addons/controller/addons/wpforms/cookie-after-consent.js

52 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ( function ( $ ) {
2
3 var cookiebot_wpforms = {
4
5 init: function () {
6 $( document ).ready( cookiebot_wpforms.update_after_consent );
7 },
8
9 /**
10 * Async wpfuuid after the visitor clicked on cookie accept
11 */
12 update_after_consent: function () {
13 window.addEventListener( 'CookiebotOnAccept', function ( e ) {
14
15 if ( Cookiebot
16 && Cookiebot.consent
17 && Cookiebot.consent.preferences
18 && window.wpforms
19 && !window.wpforms.getCookie( '_wpfuuid' ) ) {
20 window.wpforms.setUserIndentifier();
21 }
22 }, false );
23 }
24 };
25
26 /**
27 * Make global hasRequiredConsent function to check cookie consent status
28 *
29 * @return {boolean}
30 */
31 window.hasRequiredConsent = function hasRequiredConsent() {
32 if ( Cookiebot && Cookiebot.consent ) {
33 let cookie_types = cookiebot_wpforms_settings.cookie_types;
34 let required = cookie_types.length;
35
36 const consent_given = cookie_types.filter(function(cookie_type){
37 return Cookiebot.consent[cookie_type];
38 });
39
40 if( required == consent_given.length ) {
41 return true;
42 }
43 }
44
45 return false;
46 };
47
48 cookiebot_wpforms.init();
49
50
51 } )( jQuery );
52