Plugin Directory

Changeset 3388985 for complianz-gdpr


Ignore:
Timestamp:
11/03/2025 03:39:44 PM (4 months ago)
Author:
gdom3
Message:

Prepare for release

Location:
complianz-gdpr/trunk
Files:
5 added
7 edited

Legend:

Unmodified
Added
Removed
  • complianz-gdpr/trunk/config/warnings.php

    r3313047 r3388985  
    485485            'include_in_progress' => false,
    486486            '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'
    487494        )
    488495    ) );
  • complianz-gdpr/trunk/cookiebanner/class-banner-loader.php

    r3387229 r3388985  
    475475            $category        = 'statistics';
    476476            $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;
    478479
    479480            //without tag manager, set as functional if no cookie warning required for stats
     
    490491                $category = 'functional';
    491492            }
     493
     494            if ( $clarity && cmplz_get_option( 'clarity_consent_mode' ) === 'yes' ) {
     495                $category = 'functional';
     496            }
    492497
    493498            /*
     
    663668                $script = str_replace( '{container_id}', esc_attr( cmplz_get_option( 'matomo_container_id' ) ), $script );
    664669                $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 );
    667672
    668673        }
     
    718723                $script = str_replace( '{site_ID}', esc_attr( cmplz_get_option( 'clicky_site_id' ) ), $script );
    719724            } 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);
    722730            } elseif ( $statistics === 'yandex' ) {
    723731                $script         = cmplz_get_template( 'statistics/yandex.js' );
     
    14391447            $matomo                                    = $statistics === 'matomo';
    14401448            $google_analytics                          = $statistics === 'google-analytics';
    1441             $clicky                                    = $statistics === 'clicky';
     1449            $clicky                                    = $statistics === 'clicky';
    14421450            $accepted_google_data_processing_agreement = false;
    14431451            $ip_anonymous                              = false;
  • complianz-gdpr/trunk/functions.php

    r3387229 r3388985  
    420420            case 'matomo-tag-manager':
    421421                return "Matomo Tag Manager";
    422                 case 'clarity':
    423                     return "Clarity";
     422            case 'clarity':
     423                return "Clarity";
    424424            default:
    425425                return __("Not found","complianz-gdpr");
  • complianz-gdpr/trunk/integrations/plugins/clarity.php

    r3387229 r3388985  
    11<?php
    22defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
    3 
    43/**
    54 * Kept simple, no intervention with wizard to allow other analytics tooling
    65 */
    76
    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;
     7function 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
    1861}
     62add_action( 'wp_head', 'cmplz_clarity_consent_mode', 5);
  • complianz-gdpr/trunk/languages/complianz-gdpr.pot

    r3387229 r3388985  
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-10-14T20:06:12+00:00\n"
     12"POT-Creation-Date: 2025-11-03T14:48:30+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
     
    29252925msgstr ""
    29262926
     2927#: config/warnings.php:492
     2928msgid "Clarity Consent Mode V2 is now available. Please enable it in the wizard."
     2929msgstr ""
     2930
    29272931#: cookie/class-cookie.php:364
    29282932#: cookie/class-cookie.php:425
     
    29802984msgstr ""
    29812985
    2982 #: cookiebanner/class-banner-loader.php:844
     2986#: cookiebanner/class-banner-loader.php:852
    29832987#: functions.php:2001
    29842988msgid "Purpose pending investigation"
    29852989msgstr ""
    29862990
    2987 #: cookiebanner/class-banner-loader.php:1148
     2991#: cookiebanner/class-banner-loader.php:1156
    29882992msgid "%s at %s"
    29892993msgstr ""
    29902994
    2991 #: cookiebanner/class-banner-loader.php:1168
     2995#: cookiebanner/class-banner-loader.php:1176
    29922996msgid "(not synced yet)"
    29932997msgstr ""
     
    41984202msgstr ""
    41994203
     4204#: settings/config/fields-notices.php:197
     4205msgid "Clarity Consent Mode V2"
     4206msgstr ""
     4207
     4208#: settings/config/fields-notices.php:198
     4209msgid "Enforced from October 31st 2025; see how it works."
     4210msgstr ""
     4211
    42004212#: settings/config/fields/general-settings/settings.php:13
    42014213msgid "You can use GEO IP to enable the warning only for countries with a cookie law, or which you target"
     
    49264938msgstr ""
    49274939
    4928 #: settings/config/fields/wizard/consent.php:583
     4940#: settings/config/fields/wizard/consent.php:584
     4941msgid "Do you want to use Clarity Consent Mode V2?"
     4942msgstr ""
     4943
     4944#: settings/config/fields/wizard/consent.php:600
    49294945msgid "Enter your Clarity project ID"
    49304946msgstr ""
    49314947
    4932 #: settings/config/fields/wizard/consent.php:600
     4948#: settings/config/fields/wizard/consent.php:617
    49334949msgid "Do you want to enable the Yandex ecommerce datalayer?"
    49344950msgstr ""
  • complianz-gdpr/trunk/settings/config/fields-notices.php

    r3387229 r3388985  
    190190        ];
    191191    }
     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    }
    192202    return apply_filters('cmplz_field_notices', $notices);
    193203}
  • complianz-gdpr/trunk/settings/config/fields/wizard/consent.php

    r3387229 r3388985  
    575575            ],
    576576            [
     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            [
    577594                'id'                      => 'clarity_id',
    578595                'menu_id'                 => 'statistics-configuration',
Note: See TracChangeset for help on using the changeset viewer.