
GDPR (General Data Protection Regulation) is a data protection regulation enacted by the European Union to strengthen and unify personal data protection within the EU, give individuals more control over their data, and regulate how organizations handle personal data. The predecessor of GDPR is the 1995 Data Protection Directive (Data Protection Directive 95/46/EC). With the development of digitalization, the use and sharing of personal data are becoming more and more frequent, and the old regulations can no longer meet the challenges of modern data protection. GDPR aims to address these issues and ensure that personal privacy rights are fully protected. GDPR applies not only to organizations within the EU, but also to non-EU organizations that process data of EU residents.
GDPR was adopted on April 27, 2016 and effective on May 25, 2018.
The core principles of GDPR are lawfulness, fairness and transparency : data processing must be lawful, fair and transparent. Purpose limitation means that data can only be used for specific, explicit and legitimate purposes, and follows data minimization, accuracy, integrity, confidentiality and accountability. GDPR penalties are also very severe, with a maximum fine of 4% of global annual turnover or 20 million euros (whichever is higher). We should comply with GDPR guidelines and add conditions for the website to implement the guidelines.
We should comply with GDPR guidelines and add conditions for websites to implement the guidelines. Here are a few ways to do it:
Solution 1: Use a plugin (recommended)
Using a plugin is the easiest and quickest way. Here are some commonly used GDPR and Cookies consent pop-up plugins:
- CookieYes
- Functionality: Provides GDPR-compliant Cookies consent pop-up window, supports multiple languages, custom styles and automatic blocking scripts.
- Link: CookieYes
- Features: Free version is available, supporting basic functions; paid version provides more advanced features.
- Complianz GDPR/CCPA Cookie Consent
- Features: Fully compliant with GDPR, CCPA and other privacy regulations, automatically scans website cookies and generates a privacy policy.
- Link: Complianz
- Features: The free version is powerful, supports multiple languages and automatic configuration.
- GDPR Cookie Consent
- Function: Provide a simple Cookies consent pop-up window to support GDPR and CCPA compliance.
- Link: GDPR Cookie Consent
- Features: Free, lightweight, suitable for small websites.
- Borlabs Cookie
- Functionality: Provides advanced Cookies management capabilities and supports GDPR and CCPA compliance.
- Link: Borlabs Cookies
- Features: Paid plugin, powerful, suitable for websites that require fine control.
Solution 2: Manual code implementation
If you are familiar with code, you can manually implement a simple Cookies consent pop-up window. The following is a basic implementation example:
1. Add HTML and CSS to your WordPress theme
Add the following code to your theme’s footer.php
file:
<div id="cookie-consent-banner" style="display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #333; color: #fff; padding: 10px; text-align: center;">
<p>We use cookies to enhance your experience. By continuing to visit this site, you agree to our use of cookies.</p>
<button id="accept-cookies" style="background: #4CAF50; color: #fff; border: none; padding: 5px 10px; cursor: pointer;">Accept</button>
<button id="decline-cookies" style="background: #f44336; color: #fff; border: none; padding: 5px 10px; cursor: pointer;">Decline</button>
</div>
2. Add JavaScript
Add the following JavaScript in your theme’s footer.php
files or via the WordPress custom script feature:
document.addEventListener("DOMContentLoaded", function() {
var cookieBanner = document.getElementById("cookie-consent-banner");
var acceptCookies = document.getElementById("accept-cookies");
var declineCookies = document.getElementById("decline-cookies");
// Check if user has already accepted cookies
if (!localStorage.getItem("cookiesAccepted")) {
cookieBanner.style.display = "block";
}
// Accept cookies
acceptCookies.addEventListener("click", function() {
localStorage.setItem("cookiesAccepted", true);
cookieBanner.style.display = "none";
});
// Decline cookies
declineCookies.addEventListener("click", function() {
localStorage.setItem("cookiesAccepted", false);
cookieBanner.style.display = "none";
// Optionally, disable non-essential cookies here
});
});
3. Process Cookies Based on User Choices
If the user refuses cookies, you need to make sure that non-essential cookies and tracking scripts (such as Google Analytics) are disabled. These scripts can be loaded or blocked dynamically via JavaScript.
Solution 3: Combining plugins and code
If you need more complex control, you can combine plugins and custom code. For example:
- Use plugins to generate pop-ups and manage cookies.
- Extend functionality through custom code, such as recording user selections or integrating third-party services.
Precautions
- Compliance : Ensure that pop-ups clearly inform users of the purpose of Cookies and provide options to accept or reject.
- Multi-language support : If your website targets multi-lingual users, make sure the pop-up is available in multiple languages.
- Record user selections : Use
localStorage
orCookies
record user selections to avoid repeated pop-ups. - Privacy Policy Link : Include a link to the privacy policy in the pop-up.
Summarize
- If you are not familiar with code, it is recommended to use a plugin (such as CookieYes or Complianz ).
- If you have development experience, you can implement the pop-up manually, but you need to make sure to handle user selections and disable non-essential cookies.
- Either way, make sure you comply with GDPR and other relevant regulations.