Changeset 3388985 for complianz-gdpr
- Timestamp:
- 11/03/2025 03:39:44 PM (4 months ago)
- Location:
- complianz-gdpr/trunk
- Files:
-
- 5 added
- 7 edited
-
assets/vendor/mpdf/mpdf/phpstan.neon (added)
-
assets/vendor/psr/http-message/docs (added)
-
assets/vendor/psr/http-message/docs/PSR7-Interfaces.md (added)
-
assets/vendor/psr/http-message/docs/PSR7-Usage.md (added)
-
config/warnings.php (modified) (1 diff)
-
cookiebanner/class-banner-loader.php (modified) (5 diffs)
-
functions.php (modified) (1 diff)
-
integrations/plugins/clarity.php (modified) (1 diff)
-
languages/complianz-gdpr.pot (modified) (5 diffs)
-
settings/config/fields-notices.php (modified) (1 diff)
-
settings/config/fields/wizard/consent.php (modified) (1 diff)
-
templates/statistics/clarity-consent-mode.js (added)
Legend:
- Unmodified
- Added
- Removed
-
complianz-gdpr/trunk/config/warnings.php
r3313047 r3388985 485 485 'include_in_progress' => false, 486 486 'url' => 'https://complianz.io/doing-it-wrong-notice', 487 ), 488 'clarity-consent-mode' => array( 489 'plus_one' => true, 490 'dismissable' => true, 491 'warning_condition' => 'get_value_compile_statistics==clarity', 492 'open' => __('Clarity Consent Mode V2 is now available. Please enable it in the wizard.', 'complianz-gdpr'), 493 'url' => '#wizard/statistics-configuration' 487 494 ) 488 495 ) ); -
complianz-gdpr/trunk/cookiebanner/class-banner-loader.php
r3387229 r3388985 475 475 $category = 'statistics'; 476 476 $uses_tagmanager = cmplz_get_option( 'compile_statistics' ) === 'google-tag-manager' ? true : false; 477 $matomo = cmplz_get_option( 'compile_statistics' ) === 'matomo' ? true : false; 477 $matomo = cmplz_get_option( 'compile_statistics' ) === 'matomo' ? true : false; 478 $clarity = cmplz_get_option( 'compile_statistics' ) === 'clarity' ? true : false; 478 479 479 480 //without tag manager, set as functional if no cookie warning required for stats … … 490 491 $category = 'functional'; 491 492 } 493 494 if ( $clarity && cmplz_get_option( 'clarity_consent_mode' ) === 'yes' ) { 495 $category = 'functional'; 496 } 492 497 493 498 /* … … 663 668 $script = str_replace( '{container_id}', esc_attr( cmplz_get_option( 'matomo_container_id' ) ), $script ); 664 669 $script = str_replace( '{matomo_url}', esc_url_raw( trailingslashit( cmplz_get_option( 'matomo_tag_url' ) ) ), $script ); 665 }666 echo apply_filters( 'cmplz_script_filter', $script );670 } 671 echo apply_filters( 'cmplz_script_filter', $script ); 667 672 668 673 } … … 718 723 $script = str_replace( '{site_ID}', esc_attr( cmplz_get_option( 'clicky_site_id' ) ), $script ); 719 724 } elseif ( $statistics === 'clarity' ) { 720 $script = cmplz_get_template( 'statistics/clarity.js' ); 721 $script = str_replace( '{site_ID}', esc_attr( cmplz_get_option( 'clarity_id' ) ), $script ); 725 $is_consent_for_anonymous_stats = cmplz_get_option( 'consent_for_anonymous_stats' ) === 'yes'; 726 $is_clarity_consent_mode = cmplz_get_option( 'clarity_consent_mode' ) === 'yes'; 727 $clarity_script = $is_clarity_consent_mode && $is_consent_for_anonymous_stats ? '-consent-mode' : ''; 728 $script = cmplz_get_template("statistics/clarity$clarity_script.js"); 729 $script = str_replace('{site_ID}', esc_attr(cmplz_get_option('clarity_id')), $script); 722 730 } elseif ( $statistics === 'yandex' ) { 723 731 $script = cmplz_get_template( 'statistics/yandex.js' ); … … 1439 1447 $matomo = $statistics === 'matomo'; 1440 1448 $google_analytics = $statistics === 'google-analytics'; 1441 $clicky = $statistics === 'clicky';1449 $clicky = $statistics === 'clicky'; 1442 1450 $accepted_google_data_processing_agreement = false; 1443 1451 $ip_anonymous = false; -
complianz-gdpr/trunk/functions.php
r3387229 r3388985 420 420 case 'matomo-tag-manager': 421 421 return "Matomo Tag Manager"; 422 case 'clarity':423 return "Clarity";422 case 'clarity': 423 return "Clarity"; 424 424 default: 425 425 return __("Not found","complianz-gdpr"); -
complianz-gdpr/trunk/integrations/plugins/clarity.php
r3387229 r3388985 1 1 <?php 2 2 defined( 'ABSPATH' ) or die( "you do not have access to this page!" ); 3 4 3 /** 5 4 * Kept simple, no intervention with wizard to allow other analytics tooling 6 5 */ 7 6 8 add_filter( 'cmplz_known_script_tags', 'cmplz_clarity_script' ); 9 function cmplz_clarity_script( $tags ) { 10 $tags[] = array( 11 'name' => 'clarity', 12 'category' => 'statistics', 13 'urls' => array( 14 'clarity.ms', 15 ), 16 ); 17 return $tags; 7 function cmplz_clarity_consent_mode() { 8 ?> 9 <script> 10 function cmplzCallClarity(method, params) { 11 if (typeof window.clarity === 'function') { 12 try { 13 window.clarity(method, params); 14 } catch (e) { 15 console.warn('Clarity API error:', e); 16 } 17 } 18 } 19 20 cmplzCallClarity('consentv2', { 21 ad_Storage: "denied", 22 analytics_Storage: "denied" 23 }); 24 25 function cmplzGetConsentFromEvent(e) { 26 var d = e && e.detail && e.detail.categories ? e.detail.categories : {}; 27 return { 28 analyticsAllowed: !!d.statistics, 29 adsAllowed: !!d.marketing 30 }; 31 } 32 33 function cmplzSendClarityConsent(analyticsAllowed, adsAllowed) { 34 var status = function (b) { return b ? "granted" : "denied"; }; 35 // Consent API v2: pass analytics/ad storage status. 36 cmplzCallClarity('consentv2', { 37 analytics_Storage: status(!!analyticsAllowed), 38 ad_Storage: status(!!adsAllowed) 39 }); 40 } 41 42 function cmplzEraseClarityCookies() { 43 cmplzCallClarity('consent', false); 44 } 45 46 document.addEventListener('cmplz_fire_categories', function (e) { 47 var consent = cmplzGetConsentFromEvent(e); 48 cmplzSendClarityConsent(consent.analyticsAllowed, consent.adsAllowed); 49 }); 50 51 document.addEventListener('cmplz_revoke', function (e) { 52 var consent = cmplzGetConsentFromEvent(e); 53 cmplzSendClarityConsent(consent.analyticsAllowed, consent.adsAllowed); 54 if (!consent.analyticsAllowed && !consent.adsAllowed) { 55 cmplzEraseClarityCookies(); 56 } 57 }); 58 59 </script> 60 <?php 18 61 } 62 add_action( 'wp_head', 'cmplz_clarity_consent_mode', 5); -
complianz-gdpr/trunk/languages/complianz-gdpr.pot
r3387229 r3388985 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025-1 0-14T20:06:12+00:00\n"12 "POT-Creation-Date: 2025-11-03T14:48:30+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.11.0\n" … … 2925 2925 msgstr "" 2926 2926 2927 #: config/warnings.php:492 2928 msgid "Clarity Consent Mode V2 is now available. Please enable it in the wizard." 2929 msgstr "" 2930 2927 2931 #: cookie/class-cookie.php:364 2928 2932 #: cookie/class-cookie.php:425 … … 2980 2984 msgstr "" 2981 2985 2982 #: cookiebanner/class-banner-loader.php:8 442986 #: cookiebanner/class-banner-loader.php:852 2983 2987 #: functions.php:2001 2984 2988 msgid "Purpose pending investigation" 2985 2989 msgstr "" 2986 2990 2987 #: cookiebanner/class-banner-loader.php:11 482991 #: cookiebanner/class-banner-loader.php:1156 2988 2992 msgid "%s at %s" 2989 2993 msgstr "" 2990 2994 2991 #: cookiebanner/class-banner-loader.php:11 682995 #: cookiebanner/class-banner-loader.php:1176 2992 2996 msgid "(not synced yet)" 2993 2997 msgstr "" … … 4198 4202 msgstr "" 4199 4203 4204 #: settings/config/fields-notices.php:197 4205 msgid "Clarity Consent Mode V2" 4206 msgstr "" 4207 4208 #: settings/config/fields-notices.php:198 4209 msgid "Enforced from October 31st 2025; see how it works." 4210 msgstr "" 4211 4200 4212 #: settings/config/fields/general-settings/settings.php:13 4201 4213 msgid "You can use GEO IP to enable the warning only for countries with a cookie law, or which you target" … … 4926 4938 msgstr "" 4927 4939 4928 #: settings/config/fields/wizard/consent.php:583 4940 #: settings/config/fields/wizard/consent.php:584 4941 msgid "Do you want to use Clarity Consent Mode V2?" 4942 msgstr "" 4943 4944 #: settings/config/fields/wizard/consent.php:600 4929 4945 msgid "Enter your Clarity project ID" 4930 4946 msgstr "" 4931 4947 4932 #: settings/config/fields/wizard/consent.php:6 004948 #: settings/config/fields/wizard/consent.php:617 4933 4949 msgid "Do you want to enable the Yandex ecommerce datalayer?" 4934 4950 msgstr "" -
complianz-gdpr/trunk/settings/config/fields-notices.php
r3387229 r3388985 190 190 ]; 191 191 } 192 193 if ( 'clarity' === cmplz_get_option( 'compile_statistics' ) ) { 194 $notices[] = [ 195 'field_id' => 'clarity_consent_mode', 196 'label' => 'warning', 197 'title' => __("Clarity Consent Mode V2", 'complianz-gdpr'), 198 'text' => __("Enforced from October 31st 2025; see how it works.", 'complianz-gdpr'), 199 'url' => 'https://complianz.io/microsoft-consent-mode/?utm_source=statistics-configuration&utm_medium=plugin&utm_campaign=articles&utm_id=66&utm_content=clarity_consent_mode' 200 ]; 201 } 192 202 return apply_filters('cmplz_field_notices', $notices); 193 203 } -
complianz-gdpr/trunk/settings/config/fields/wizard/consent.php
r3387229 r3388985 575 575 ], 576 576 [ 577 'id' => 'clarity_consent_mode', 578 'menu_id' => 'statistics-configuration', 579 'type' => 'radio', 580 'default' => 'yes', 581 'options' => COMPLIANZ::$config->yes_no, 582 'required' => true, 583 'revoke_consent_onchange' => true, 584 'label' => __( "Do you want to use Clarity Consent Mode V2?", 'complianz-gdpr' ), 585 'react_conditions' => [ 586 'relation' => 'AND', 587 [ 588 'compile_statistics' => 'clarity', 589 'consent_for_anonymous_stats' => 'yes' 590 ] 591 ], 592 ], 593 [ 577 594 'id' => 'clarity_id', 578 595 'menu_id' => 'statistics-configuration',
Note: See TracChangeset
for help on using the changeset viewer.