Magento 2 Cookie Policy: Steps To Configure Cookie Restriction

Magento 2 Cookie Policy: Steps To Configure Cookie Restriction

Want to use Magento 2 cookie policy? Configuring it correctly ensures compliance with privacy regulations and builds customer trust. Understanding cookie types and their uses can help optimize your store's performance. It also delivers a seamless shopping experience. This tutorial explores Magento 2 cookies, cookie policy extensions, and configuration steps.

Key Takeaways

  • Discover the importance of configuring the Magento 2 cookie policy for compliance and customer trust.

  • Learn about the types of cookies used in Magento 2 and their key uses for personalization and tracking.

  • Explore step-by-step guides to enable cookie restriction mode and configure default cookie settings.

  • Find out how to edit your Magento cookie policy and update your privacy policy to cover cookie usage.

  • Get recommendations for the best Magento 2 cookie policy extensions for consent management.

What are cookies in Magento 2?

Cookies in Magento 2 are small text files created by websites and stored on users' devices. They contain data about online browsing sessions including page visits and interactions.

Magento 2 uses cookies to provide a personalized and seamless user experience. They enable features like maintaining shopping carts, storing login credentials, and displaying targeted content.


For Magento store owners, cookies offer valuable insights into customer behavior and preferences. They help track the customer journey and inform strategies to optimize the store. However, it's important to obtain user consent for cookies and provide clear options to manage cookie settings in compliance with privacy regulations.

Steps to Enable Cookie Restriction Mode

  1. Navigate to Stores > Settings > Configuration in the Magento Admin sidebar.

  2. Select Web under the General section in the left panel.

  3. Expand the Default Cookie Settings section.

Default Magento 2 Cookie Policy Setting

  1. Set the following options in the Default Cookie Settings:
  • Enter the Cookie Lifetime in seconds.

  • To make cookies available to other folders, enter the Cookie Path. Use a forward slash (/) to make cookies available anywhere on the site.

  • To make cookies available to a subdomain, enter the subdomain name in the Cookie Domain field (subdomain.yourdomain.com). To make cookies available to all subdomains, enter the domain name preceded by a period (.yourdomain.com).

  • Set Use HTTP Only to Yes to prevent scripting languages like JavaScript from accessing cookies.

  • Set Cookie Restriction Mode to Yes. If necessary, clear the checkbox and click OK to confirm scope switching.

  1. Click Save Config when complete.

  2. If prompted to update the cache, click the Cache Management link in the system message.

  3. Refresh each invalid cache.

  4. Update your privacy policy to describe the information your company collects and how it is used.

Steps to Configure Default Cookie Settings

  1. Navigate to Stores > Settings > Configuration > General > Web > Default Cookie Settings.

  2. Set the Cookie Lifetime.

Magento 2 Cookie Policy Lifetime Setting

  • Define how long cookies will be stored on the customer's computer.

  • Default value is 3600 seconds.

  • Enter 0 for cookies to expire when the customer closes the browser.

  1. Specify the Cookie Path.
  • Determine where the notification will be displayed.

  • Use a slash (/) to show it on all pages.

  1. Configure the Cookie Domain.

Cookie Domain in Magento 2 Cookie Policy

  • Add the subdomain in this field.

  • To enable cookies for all subdomains, enter the domain preceded by a full stop (e.g. ".domain.com").

  1. Choose Yes for the Use HTTP Only field.
  • Restrict other programming languages from accessing cookie files.
  1. Enable the Cookie Restriction Mode.
  • Select Yes to display cookie messages on the storefront.
  1. Click the Save Config button to apply the changes.

Steps to Edit Magento Cookie Policy

  1. Navigate to Content > Elements > Pages.

  2. Locate the Privacy Policy page.

  • Select Edit from the Action dropdown.

Privacy Magento 2 Cookie Policy

  1. Enable the page if necessary.

Enable Magento 2 Cookie Policy

  1. Move to the Content section.
  • Make the required changes to the cookie policy.
  1. Choose the appropriate Store View.
  • Specify where the page should be displayed in the Page in Websites section.

Store View Setting in Magento 2 Cookie Policy

  1. Click the Save button.
  • Review the updated privacy policy page on the storefront.

The updated privacy policy page will now be visible to customers in your Magento store.

Key Cookie Uses in Magento 2

1. Personalization

Magento 2 leverages cookies to deliver a personalized shopping experience. By tracking user preferences and browsing behavior, the platform can provide tailored product recommendations. Cookies enable Magento to suggest relevant products based on past views or purchases. They also allow for pre-filling forms with saved user information, streamlining the checkout process.

2. Session Management

Cookies play a key role in managing user sessions within Magento 2. They ensure that items added to the shopping cart persist throughout the session. Cookies also maintain the user's login status, allowing for a seamless browsing experience. By leveraging session cookies, Magento 2 can provide a smooth and uninterrupted shopping journey.

3. User Authentication

Magento 2 utilizes cookies for user authentication purposes. When a user logs in to their account, cookies store the necessary authentication tokens. It enables Magento to recognize the user across different pages and maintain their logged-in state. Cookies also facilitate features like "Remember Me," allowing users to stay logged in even after closing the browser.

4. Analytics and Tracking

Cookies serve as valuable tools for gathering analytics and tracking user behavior in Magento 2. They help store owners gain insights into customer journeys, popular products, and browsing patterns. By analyzing cookie data, Magento store owners can make data-driven decisions to optimize their store's performance. This information aids in improving the overall user experience and driving conversions.

5. Targeted Marketing

Magento 2 can utilize cookies for targeted marketing efforts. By tracking user behavior and preferences, cookies enable the display of personalized promotions, discounts, or ads. This targeted approach helps increase the relevance of marketing messages and enhances the likelihood of user engagement. Cookies also facilitate retargeting campaigns, allowing stores to reach out to users who have previously interacted with their website.

Best Magento 2 Cookie Policy Extensions

1. Amasty Cookie Consent (GDPR) for Magento 2

Amasty Magento 2 Cookie Policy

Price €155
Extension Link Amasty Cookie Consent (GDPR) for Magento 2
Features - Choose a cookie bar style and customize the design
- Collect and filter all cookie consents from registered and guest users
- Block third-party cookies
- Available in the German language
- Google Consent Mode V2 support
Benefits Amasty Cookie Consent (GDPR) for Magento 2 helps protect your business by ensuring precise consent collection and advanced privacy documentation management.
It supports compliance with various cookie policies worldwide, including GDPR (EU), GDPR UK, CCPA (California), LGPD (Brasil), PDPA (Singapore), CNIL (France), ePrivacy, and PDPL (Saudi Arabia).
The extension offers three types of Magento 2 cookie notices: sidebar with toggles, cookie pop-up, and classic bar.
It allows customization of the cookie bar and buttons to suit your website's design and goals.

2. MageComp Magento 2 Cookie Consent Extension

MageComp Magento 2 Cookie Policy

Price $49.00
Extension Link MageComp Magento 2 Cookie Consent Extension
Features - Compose custom message for cookie notice to display
- Add More info hyperlink along with cookie notice & link
- Add cookie policy link
- Set cookie button with custom text on it.
- Adjust position of cookie dialog box - top or bottom.
Benefits MageComp Magento 2 Cookie Consent Extension allows store owners to display a simple, clean, and easy-to-understand cookie notification bar on the storefront.
It enables customization of the cookie consent message, privacy page link, and button text.
The extension supports personalization of text color, background color, button color, and position of the cookie consent notification.
It also integrates with Google Analytics and Facebook Pixel by default, with the option to enable or disable them as per business needs.

3. BSS Commerce Magento 2 Cookie Consent

BSS Commerce Magento 2 Cookie Policy

Price $59.00
Extension Link BSS Commerce Magento 2 Cookie Consent
Features - Display a cookie notification popup/bar on the main store to ask visitors for cookie consent
- Let customers consent to website cookie usage
- Add links (to both CMS pages & external pages) into the message
- Freely customize the content, display & positions of the cookie consent bar
- Auto-hide messages after X seconds in case of no interaction
Benefits BSS Commerce Magento 2 Cookie Consent assists in complying with the EU's User Consent Policy and supports Google Consent Mode v2.
It allows gathering consented cookies for Google Analytics tools, Google Tag Manager, and business marketing like Google Ads.
The extension enables setting default logic for cookie collecting when users don't interact with the consent bar.
It is responsive on multiple devices. It offers a 30-day money-back guarantee, free 1-year support, and free installation & lifetime updates.

FAQs

1. What are cookies in Magento 2?

Cookies in Magento 2 are small text files. They are created by websites and stored on users' devices. Cookies contain data about online browsing sessions, including page visits and interactions. Magento 2 uses cookies to provide a personalized and seamless user experience. They enable features like maintaining shopping carts, storing login credentials, and displaying targeted content.


2. What are the key uses of cookies in Magento 2?

Magento 2 leverages cookies for personalization and session management. They are used for user authentication, analytics tracking, and targeted marketing. Cookies help deliver a personalized shopping experience. They maintain user sessions and store authentication tokens. Cookies gather insights into customer behavior. They enable targeted promotions and ads.


3. What are some of the best Magento 2 cookie policy extensions?

Best cookie policy extensions include Amasty, MageComp, and BSS Commerce Magento 2 Cookie Consent. These extensions help ensure compliance with cookie policies. They allow customization of cookie consent messages. The extensions provide options for users to manage their cookie preferences.


4. How can I enable cookie restriction mode in Magento 2?

To enable cookie restriction mode, navigate to Stores > Settings > Configuration. Select Web under the General section. Expand the Default Cookie Settings section. Set Cookie Restriction Mode to Yes. Save the configuration and update the cache if prompted. Update your privacy policy to describe the information your company collects and how it is used.


5. What are some best practices for updating the privacy policy to cover cookie usage?

When updating your privacy policy, clearly explain the types of cookies used. Obtain explicit user consent through a prominent cookie consent banner. Provide options for users to manage their cookie preferences. Regularly review and update your privacy policy. Use clear, concise language. Respect user preferences throughout your site.

CTA

Summary

Implementing a strong Magento 2 cookie policy maintains customer trust and complies with privacy regulations. Cookie policy extensions make it easy to manage user consent and customize settings. They also provide transparent information to customers. To achieve this:

  • Clearly explain the types of cookies used

  • Obtain explicit user consent through cookie banners

  • Provide options for users to manage their preferences

  • Regularly review and update your privacy policy

  • Enable cookie restriction mode in Magento 2

Consider managed Magento hosting to easily integrate cookie policies to Magento stores.

Shivendra Tiwari
Shivendra Tiwari
Technical Writer

Shivendra has over ten years of experience creating compelling content on Magento-related topics. With a focus on the Magento community, he shares valuable tips and up-to-date trends that provide actionable insights.


Get the fastest Magento Hosting! Get Started