magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.51k stars 9.31k forks source link

GA4 and GTM running in anonymous mode #38039

Open rafaelstz opened 1 year ago

rafaelstz commented 1 year ago

Description

I suggest running GA and GTM following Google's best practices, which follow the latest international privacy rules such as GDPR, LGPD, CCPA, etc.

The method allows GTM and GA4 to run privately until the user's cookies consent. It will make GA4 and GTM run in privacy mode and block only GTM's scripts that need consent. It will allow us to show options and let the customer decide which cookies they want to accept, such as necessary, analytics, preferences, and marketing.

This method has been used by third-party vendors such as OneTrust, Osano, Cookiebot, Cookie Yes, Didomi... It can be easily applied to Magento / Adobe Commerce to facilitate the usage of the native cookie consent feature.

This is what Google's best practices say about running GA and GTM.

Load Google tags in all cases, not only if the user consents. If consent is denied, Google receives cookieless pings. In Google Analytics 4 properties, cookieless pings enable behavioral and conversion modeling to fill the gaps in your data.

Expected behavior

Benefits

Additional information

Learn more about consent mode → https://support.google.com/analytics/... Check out the demo code for this series → https://github.com/googleanalytics/ga... Youtube Set up consent mode in Google Analytics → https://www.youtube.com/...

Release note

No response

m2-assistant[bot] commented 1 year ago

Hi @rafaelstz. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue: