How to Configure Magento 2 Cookies?

To configure cookies in Magento 2 is important to enhance user experience, ensure compliance with data protection regulations, and optimize website performance. Here’s a step-by-step guide on how to configure cookies in Magento 2 effectively.

What are Magento 2 Cookies?

Magento 2 cookies are small text files stored on a user's device during visits to a Magento website. They help manage sessions and remember details like log-ins and shopping carts for a smoother user experience. 

Cookies also store data that allows personalization, showing users relevant products and promotions. Additionally, they collect analytics data to help website owners understand user behavior and improve the site. 

How to Configure Magento Cookies

  1. Go to Stores > Settings > Configuration > General > Web > DefaultCookieSettings.
  2. Specify the Cookie Lifetime to determine how long cookies are stored. Enter 0 to have them expire when the browser closes.
  3. Enter the Cookie Path. Use a slash (/) to display cookies across all pages.
  4. Add the subdomain in the Cookie Domain field. Use ".yourdomain.com" to enable cookies on all subdomains.
  5. Set Use HTTP Only to Yes to restrict access to cookies from other programming languages.
  6. Select Yes for the Cookie Restriction Mode to enable cookie consent messages on the storefront.
  7. Click the Save Config button.

Create New Magento Cookies

The default Magento supports only limited cookies like Google Analytics. For more, customize Magento or use the Amasty’s Magento 2 Cookie Consent Extension to create unlimited cookies.

Edit Magento Cookie Policy

  1. Go to Content > Elements > Pages.
  2. Find the Privacy Policy page and select Edit from the Action menu.
  3. Ensure the page is enabled.
  4. Make necessary updates in the Content section.
  5. Select the Store View in the Page in Websites section.
  6. Click the Save button and verify the changes on the storefront.
Loading

Didn’t you find the answer to your question? We are always happy to help you out.

Loading
Loading