Plugin Directory

Changeset 3314511


Ignore:
Timestamp:
06/19/2025 10:59:29 AM (9 months ago)
Author:
seersco
Message:

WP Consent API integration

Location:
seers-cookie-consent-banner-privacy-policy
Files:
256 added
6 edited

Legend:

Unmodified
Added
Removed
  • seers-cookie-consent-banner-privacy-policy/tags/Development Versions/readme.txt

    r3297763 r3314511  
    55Requires at least: 3.8 or higher
    66Tested up to: 6.8.1
    7 Stable tag: 9.2.1
     7Stable tag: 9.3.0
    88Requires PHP: 5.3.3
    99Author URL: https://seers.ai
     
    220220== Changelog ==
    221221
     222VERSION 9.3.0
     223• Integration with WP Consent API
     224
    222225VERSION 9.2.1
    223226• Tested on WordPress version 6.8.1
  • seers-cookie-consent-banner-privacy-policy/tags/Development Versions/seers-cookie-consent-banner-privacy-policy.php

    r3297763 r3314511  
    1111* Plugin URI: https://seerssupport.zendesk.com/hc/en-us/articles/11090546128412-Installing-Seers-Plugin-on-WordPress/
    1212* Description: Seers cookie consent management platform is trusted by thousands of businesses. Become GDPR, CCPA, ePrivacy and LGPD compliant in three clicks.
    13 * Version: 9.2.1
     13* Version: 9.3.0
    1414* Author: Seers
    1515* Author URI: https://seers.ai
     
    27272727
    27282728}
     2729function seers_consent_optin_script() {
     2730    ?>
     2731    <script>
     2732    window.wp_consent_type = 'optin';
     2733
     2734    document.dispatchEvent(new CustomEvent('wp_consent_type_defined'));
     2735
     2736    window.wp = window.wp || {};
     2737    window.wp.consent = window.wp.consent || (() => {
     2738      let consentState = {
     2739        functional: true,
     2740        analytics: false,
     2741        marketing: false,
     2742        personalization: false
     2743      };
     2744
     2745      let listeners = [];
     2746
     2747      return {
     2748        setConsent: (category, value) => {
     2749          consentState[category] = value;
     2750          listeners.forEach(cb => cb({ ...consentState }));
     2751        },
     2752        getConsent: (category) => {
     2753          return consentState[category];
     2754        },
     2755        hasConsent: (category) => {
     2756          return !!consentState[category];
     2757        },
     2758        onConsentChange: (cb) => {
     2759          listeners.push(cb);
     2760        },
     2761        getConsentState: () => {
     2762          return { ...consentState };
     2763        }
     2764      };
     2765    })();
     2766
     2767    </script>
     2768    <?php
     2769}
     2770add_action('wp_head', 'seers_consent_optin_script', 1);
     2771
     2772
     2773add_filter('wp_consent_api_registered_' . plugin_basename(__FILE__), '__return_true');
     2774
     2775
  • seers-cookie-consent-banner-privacy-policy/tags/Development Versions/templates/frontend-popup.php

    r3147210 r3314511  
    39883988
    39893989            }
    3990            
    3991            
     3990            setUserConsent({
     3991            pref: consentobj.Pref,
     3992            stat: consentobj.stat,
     3993            market: consentobj.market
     3994            });           
    39923995            //hide current banner
    39933996            cmpnsentmodal.classList.remove("seers-cmp-cookie-banner-active");
     
    41254128syncSwitches('seers-cmp-cookie-policy-marketing-switch', 'seers-cmp-cookie-policy-marketing-switch1', 'seers-cmp-cookie-policy-marketing-switch2');
    41264129
     4130function setUserConsent({ pref, stat, market }) {
     4131  if (!window.wp?.consent) {
     4132    console.warn("wp.consent API not available.");
     4133    return;
     4134  }
     4135
     4136  wp.consent.setConsent('functional', true);
     4137  wp.consent.setConsent('analytics', stat);
     4138  wp.consent.setConsent('marketing', market);
     4139  wp.consent.setConsent('personalization', pref);
     4140
     4141}
     4142
     4143
    41274144</script>
    41284145</body>
  • seers-cookie-consent-banner-privacy-policy/trunk/readme.txt

    r3297763 r3314511  
    55Requires at least: 3.8 or higher
    66Tested up to: 6.8.1
    7 Stable tag: 9.2.1
     7Stable tag: 9.3.0
    88Requires PHP: 5.3.3
    99Author URL: https://seers.ai
     
    220220== Changelog ==
    221221
     222VERSION 9.3.0
     223• Integration with WP Consent API
     224
    222225VERSION 9.2.1
    223226• Tested on WordPress version 6.8.1
  • seers-cookie-consent-banner-privacy-policy/trunk/seers-cookie-consent-banner-privacy-policy.php

    r3297763 r3314511  
    1111* Plugin URI: https://seerssupport.zendesk.com/hc/en-us/articles/11090546128412-Installing-Seers-Plugin-on-WordPress/
    1212* Description: Seers cookie consent management platform is trusted by thousands of businesses. Become GDPR, CCPA, ePrivacy and LGPD compliant in three clicks.
    13 * Version: 9.2.1
     13* Version: 9.3.0
    1414* Author: Seers
    1515* Author URI: https://seers.ai
     
    27272727
    27282728}
     2729function seers_consent_optin_script() {
     2730    ?>
     2731    <script>
     2732    window.wp_consent_type = 'optin';
     2733
     2734    document.dispatchEvent(new CustomEvent('wp_consent_type_defined'));
     2735
     2736    window.wp = window.wp || {};
     2737    window.wp.consent = window.wp.consent || (() => {
     2738      let consentState = {
     2739        functional: true,
     2740        analytics: false,
     2741        marketing: false,
     2742        personalization: false
     2743      };
     2744
     2745      let listeners = [];
     2746
     2747      return {
     2748        setConsent: (category, value) => {
     2749          consentState[category] = value;
     2750          listeners.forEach(cb => cb({ ...consentState }));
     2751        },
     2752        getConsent: (category) => {
     2753          return consentState[category];
     2754        },
     2755        hasConsent: (category) => {
     2756          return !!consentState[category];
     2757        },
     2758        onConsentChange: (cb) => {
     2759          listeners.push(cb);
     2760        },
     2761        getConsentState: () => {
     2762          return { ...consentState };
     2763        }
     2764      };
     2765    })();
     2766
     2767    </script>
     2768    <?php
     2769}
     2770add_action('wp_head', 'seers_consent_optin_script', 1);
     2771
     2772
     2773add_filter('wp_consent_api_registered_' . plugin_basename(__FILE__), '__return_true');
     2774
     2775
  • seers-cookie-consent-banner-privacy-policy/trunk/templates/frontend-popup.php

    r3147210 r3314511  
    39883988
    39893989            }
    3990            
    3991            
     3990            setUserConsent({
     3991            pref: consentobj.Pref,
     3992            stat: consentobj.stat,
     3993            market: consentobj.market
     3994            });           
    39923995            //hide current banner
    39933996            cmpnsentmodal.classList.remove("seers-cmp-cookie-banner-active");
     
    41254128syncSwitches('seers-cmp-cookie-policy-marketing-switch', 'seers-cmp-cookie-policy-marketing-switch1', 'seers-cmp-cookie-policy-marketing-switch2');
    41264129
     4130function setUserConsent({ pref, stat, market }) {
     4131  if (!window.wp?.consent) {
     4132    console.warn("wp.consent API not available.");
     4133    return;
     4134  }
     4135
     4136  wp.consent.setConsent('functional', true);
     4137  wp.consent.setConsent('analytics', stat);
     4138  wp.consent.setConsent('marketing', market);
     4139  wp.consent.setConsent('personalization', pref);
     4140
     4141}
     4142
     4143
    41274144</script>
    41284145</body>
Note: See TracChangeset for help on using the changeset viewer.