How to Configure Magento 2 Cookie Restriction Mode: Useful Tips

As an eCommerce platform, Magento 2 offers powerful and flexible solutions for online businesses. One essential feature that was implemented with the need for the privacy of user personal information is a Cookie Restriction Mode. It allows websites to set up and control the use of cookies in compliance with privacy regulations.

Since cookies are small files that are stored in a user’s device to track them on the internet, they have caused many privacy concerns. Cookies serve various purposes, such as remembering user preferences, tracking analytics, etc., and it is crucial to give users control over their cookie preferences. 

In this article, you will learn how to properly configure Magento 2 Cookie Restriction Mode to make your website compliant with the regulations.

How to Configure Magento 2 Cookie Restriction Mode

Step 1. Log in to Your Magento 2 Admin Panel

To start with, go to the Magento 2 admin panel and log in with your administrator credentials.

Step 2. Enable & Set Up Magento 2 Cookie Restriction Mode

Once logged in, navigate to “Stores” on the left-hand side of the admin panel and click “Configuration. Under the “General” section, select “Web” from the dropdown menu. Expand the “Default Cookie Settings” tab and set up the following:

  • Cookie Lifetime

Cookie lifetime refers to the duration for which cookies remain stored on a user’s device. The default value is “3600” seconds which is equal to about 1 hour. This means that users will be identified for one hour if they revisit your website. Set to “0” if you want cookies to expire as soon as a user closes their browser. Read more about how to choose the optimal Cookie Lifetime value.

  • Cookie Path

To make cookies available for some particular folders on your Magento 2 store, enter the Cookie Path here, for example, “/products/women/”. If you want them to be available anywhere on your site, then enter a forward slash “/”.

  • Cookie Domain

Specify your website domain (yourdomain.com) to make the cookies available for all your website. For a specific subdomain only, you need to enter the subdomain name (subdomain.yourdomain.com). If you want to make cookies available to all subdomains, enter the domain name preceded by a period (.yourdomain.com).

  • Use HTTP Only

To ensure users’ security, select “Yes” from the drop-down. This will prevent JavaScript or other scripting languages from gaining access to cookies.

  • Cookie Restriction Mode

Set this option to “Yes” to enable the feature and display the cookie notice on the frontend.

Guide to Magento 2 Cookie Restriction Mode

Step 3. Clearing Magento Cache and Verifying Configuration

After configuring cookie settings and the Magento 2 Cookie Restriction Mode, it is essential to clear the Magento cache to ensure the updated settings take effect. To clear the cache, go to “System” > “Cache Management” in the man Magento menu, and click “Flush Magento Cache”.

It’s also advisable to clear your browser cache and cookies to see the changes from a user’s perspective.

Here’s what the Cookie Notice looks on the frontend:

Guide to Magento 2 Cookie Restriction Mode

Step 4. Updating Privacy Policy

Don’t forget to update your privacy policy to include information about what user data your company collects and for what purposes, as required by the Cookie Law. Specifically, you need to provide the list of cookies and a detailed description of each.

To edit your Magento 2 Privacy Policy, go to “Stores” in the main Magento menu and click “Configuration”. Then, select your Privacy Policy page, and in the “Action” column, click “Edit”.

Conclusion

In today’s privacy-focused digital landscape, giving users control over their cookie preferences is vital for any online business. With Magento 2’s built-in Cookie Restriction Mode, configuring and managing cookies becomes a straightforward process. By following the steps outlined in this article, you can enable and properly configure Magento 2 Cookie Restriction Mode. Prioritizing user privacy not only ensures compliance with regulations but also fosters trust and enhances the overall user experience on your Magento 2 website.

Additionally, consider using Magento 2 Cookie Consent extension, which provides better options and flexibility for configuring a cookie notice. Unlike built-in Magento functionality, you get compliance with major data privacy laws, such as GDPR in European Union, CCPA in California, LGPD in Brazil, etc., as well as more ways for customization.

About The Author: Anastasiia Tomashivska

Deeply passionate about making a good copy. Now exploring new horizons of SEO and content marketing. Apart from the digital world, she is obsessed with travelling, films and caffeine. View more posts