GDPR Compliant Cookie Consent Plugin For Joomla!4

This plugin for Joomla!4 was created to make jQuery ihavecookies.js easier to use.  

For more information about jQuery ihavecookies.js, please see the following link.

https://www.jqueryscript.net/other/GDPR-Cookie-Consent-Popup-Plugin.html

https://github.com/ketanmistry/ihavecookies

ihavecookies

Of course, this plugin includes this script.

Note: Some changes have been made to the original script.
Changes

  • The name of the button when selecting the cookie type can be changed.
  • The name of the cookie can be changed.
  • The uncheckBoxes parameter was not being reflected? I've changed it so that it is reflected.
  • Added samesite attribute to the cookie that are added.
  • Added useOverlay(1.1.0) and changed colors. If you use the overlay, the More Information (Privacy Policy) page will appear on the overlay. 
  • Added Reset Button parameter for reset cookie setting.(1.3.0)
  • Added Reset Button Title parameter.(1.3.0)

Download the plugin GDPRCCCP from the link below.

https://extensions.joomla.org/extension/site-management/gdprcccp/

What this plugin can do

  1. jQuery ihavecookies.js parameters can be set in the plugin parameters.
    For the parameters that the original script has, please check the link above.
  2. Added parameters
    • useOverlay(1.1.0)
      If you use the overlay, the More Information (Privacy Policy) page will appear on the overlay. If it is not used, the page will be displayed in a new window.
    • Cookie name
      The default is "cookieControl". It is possible to change the value. For example, if you change the cookie to be retrieved, the cookie will remain stored until the expiration date and the consent popup will not be displayed. However, you can initialize it by changing this value.
      (*The cookie before the change will not disappear until the expiration date.)
    • Cookie name(preferences)
      This is the same as the “Cookie name”. The default is "cookieControlPrefs".
    • Reload after consent(1.2.0)
      If Yes, the script file(s) will not be output before consent. Script files with cookie settings cannot be output. You need to reload the file after consent to it. For example, the Google Analistycs script file does not require cookie consent just to load.
    • Script path(CookieTypes options)   
      Enter the path to the script file. For example, for Google analytics, enter the following
      https://www.googletagmanager.com/gtag/js?id=yourid
      *For the agreed option, this will always be output.
      *The script specified here will not be output in case of rejection.
    • Attribute(CookieTypes options)
      Attribute of the script tag, choose from none, async, or defer.
    • Script   
      Enter the javascript that will be executed if it is agreed. The output will be of type module.(type=”module”)
      *For the agreed option, this will always be output.
      *The script specified here will not be output in case of rejection.
    • Script(not accepted)(CookieTypes options)
      This is a script to be executed when rejected. It is always executed when in denied state. The output will be of type module.(type=”module”)
      *For the denied option, this will always be output.
    • Reset Button(1.3.0)
      Show/Hide Reset Button
    • Reset Button Title(1.3.0)
      Button title
  3. Do not require consent for specific IP address ranges by IP lists.
    This plugin has a possibility to prevent the consent popup from being displayed depending on the list of IP addresses.

    For example, if you have a list of IP addresses for a certain country, there is a displays.php file in this plugin folder > IpList folder. (/plugins/system/gdpr/IpList/displays.php)
    You can add it into the array() of the displays.php file.

    *However, a large number of IP addresses may affect the performance.
    *The IP addresses for each country don't always seem to be the same. (needs to be updated).
  4. Change the look and feel
    Edit the css file. The location of the file is Root/media/plg_system_gdpr/css.
  5. Run only once. If you have a script that you want to run only once, when it is accepted or denied
    Enter onAccept. Please refer to the example below.
  1. //Get accepted preference
  2. var prefs = $.fn.ihavecookies.cookie();
  3. //prefs = [valueOfyourOption1, valueOfyourOption2, valueOfyourOption3] //if accepted all
  4. //prefs = [] //if denied all
  5. if(prefs.valueOfyourOption){   
  6.    //Accepted   
  7.    alert(‘Accepted yourOption’);
  8. } else {   
  9.    //Denied   
  10.    alert(‘Denied yourOption’);
  11. }

Have fun!