How to overcome Cookie restriction issues in Magento 2.1.x. (Google Tag Manager and Google Analytics cookie fix).
In Magento 2.1.x, enabling Cookie Restriction Mode can cause issues with Google Tag Manager (GTM) and Google Analytics (GA) tracking.
Due to a bug (GitHub issue #5596), Magento does not display GA or GTM tracking scripts, even if the user has accepted cookies.
Solutions
There are several ways to resolve this issue:
- Deactivate Cookie Restriction Mode
- This will bypass the issue, but it may not be suitable if your store requires cookie compliance.
- Upgrade Magento to the Latest Version (Recommended)
- Updating your Magento installation resolves this bug in later releases.
- Follow this guide: How to Upgrade Magento 2 to a Newer Version and Install Security Patches
- Install a Third-Party Module
- A community fix is available here: Cookie Restriction Fix
- After installing the module, make sure to:
- Flush the Magento cache.
- Delete existing cookies, especially:
_user_allowed_save_cookie- For safety, we recommend clearing all cookies to avoid conflicts.
✅ By applying one of the solutions above, you can restore Google Analytics and Google Tag Manager tracking functionality in Magento 2.1.x while managing cookie restrictions.
Updated on: 16/09/2025
Thank you!
