Handle Cookie Restrictions

Both Adobe Commerce and Magento Open Source ask for consent before data is stored in browser cookies. For more information, refer to Cookie restriction mode.

When you deploy the magento/product-recommendations module to production, it begins collecting shopper interaction events on your storefront. This data can be stored in browser cookies or local storage to power recommendation algorithms.

IMPORTANT
Product Recommendations now respects cookie restriction mode by not collecting or storing any data in cookies or local storage when cookie restrictions are enabled. This includes behavioral data used for personalized recommendations.

The following Product Recommendations data is not collected when cookie restriction mode is enabled:

  • Behavioral data: Product views, add-to-cart actions, purchases, and other shopper interactions.
  • Session data: Shopper session information and recommendation unit interactions.
  • Personalization data: Data used for recommendation types like “Recently viewed” and “Most purchased”.

Impact on recommendation types

When cookie restriction mode is enabled and shoppers haven’t accepted cookies, certain recommendation types may not display or may show limited results:

  • Recently viewed products: Requires session data stored in cookies/local storage.
  • Recommended for you: Requires behavioral data for personalization.
  • Bought this, bought that: Requires purchase history data.
NOTE
Recommendation types that do not rely on behavioral data, such as “Most viewed” and “Visual similarity” will continue to work normally even with cookie restrictions enabled.

Product Recommendations may not automatically integrate with third-party cookie consent solutions. It is the merchant’s responsibility to ensure that data collection complies with applicable privacy laws and regulations.

If you use a custom cookie consent solution, you can implement the do-not-track cookie mechanism to control data collection.

Implementing do-not-track cookies

You can use the mg_dnt cookie to programmatically control data collection:

const DNT_COOKIE = "mg_dnt";

Disable data collection

Set the do-not-track cookie when users decline cookies:

$.mage.cookies.set(DNT_COOKIE, true);

Enable data collection

Clear the do-not-track cookie when users accept cookies:

$.mage.cookies.clear(DNT_COOKIE);

To test how Product Recommendations behave with cookie restrictions:

  1. Enable cookie restriction mode in your Adobe Commerce configuration.
  2. Visit your storefront without accepting cookies.
  3. Verify that recommendation units display appropriate fallback content.
  4. Accept cookies and verify that recommendations begin collecting data.

Privacy compliance

Product Recommendations data collection does not include personally identifiable information (PII). All user identifiers, such as cookie IDs and IP addresses, are anonymized. For more information, see the Adobe Privacy Policy.

TIP
For healthcare customers using the Data Services HIPAA extension, additional configuration may be required. See HIPAA Readiness for more information.
recommendation-more-help
54da8d7a-609c-4edf-9db2-a50941aff68e