woocommerce / woocommerce-google-analytics-integration

WordPress plugin: Provides the integration between WooCommerce and Google Analytics.
http://wordpress.org/plugins/woocommerce-google-analytics-integration/
172 stars 69 forks source link

Update the public docs for WP Consent API integration #431

Closed tomalec closed 4 months ago

tomalec commented 4 months ago

User story

As a merchant visiting woocommerce I'd like to know how do I solve Cookie consent, read about cookie banners and WP Consent API integration.


As we are about to release changes to the plugin, we should reflect them in the public docs. I didn't find a way to make a draft of the upcoming revision of a product docs on WCCOM, so I 'd post it here for the review :) and to have it ready to be copied and pasted on the release day.

How to reproduce the problem

Visit https://woocommerce.com/document/google-analytics-integration/ and try to get the idea how does the extension solve cookies consent.

Describe the solution you'd like

I'll post the proposed docs as a comment.

Describe alternatives you've considered

Technical

The feature was implemented here https://github.com/woocommerce/woocommerce-google-analytics-integration/pull/429 Dev note in the reader was added here https://github.com/woocommerce/woocommerce-google-analytics-integration/pull/426/files

Figma link

Acceptance criteria

Unknowns

Out of bounds/rabbit holes

tomalec commented 4 months ago

[!WARNING] Google introduced Consent Mode in March 2024 to comply with privacy laws in the EEA/UK region. This means website visitors from these regions must now explicitly grant consent for cookies before any analytics tracking occurs.

Without consent, Google Analytics (GA4) and Google Ads won't capture user data in these locations. The extension does not provide any UI, like a cookie banner, to let your visitors grant consent for tracking. However, it's integrated with WP Consent API, so you can pick another extension that provides a user interface that meets your needs.

Due to this new requirement, you may notice a discrepancy between your store and Google Analytics/Ads data, as users must grant consent for analytics data to be captured on Google’s platforms.

[...]

Cookie banners, Consent mode, and analytics tracking

Consent mode facilitates the communication of visitors’ cookie consent preferences to Google tags. To comply with privacy laws, users in the EEA, UK, and Switzerland must grant cookie consent before analytics tracking is activated. To implement cookie consent, we recommend using one of Google’s recommended CMPs that offers a WordPress plugin compatible with the WP Consent API. Each of those extensions may require additional setup or registration. For analytics data to be sent to Google Analytics, your consent mode integration must update the consent states after visitors grant consent. You can follow Google’s guide to test if the consent state is correctly updated. If you find the consent state is not updated by your cookie plugin, please contact the plugin’s developers for assistance in ensuring compatibility with Google Analytics for WooCommerce or with WP Consent API.

[...]

Frequently Asked Questions

GA4W overwrites the consent mode defaults set by the other extension

If the additional CMP extension you chose to provide UI for cookie consent sets its own default state of consent modes, different than the one we set, and you would like to make sure we'll not overwrite that, you can use the woocommerce_ga_gtag_consent_modes filter to change or disable our setup.

How can I stop firing the page_view event when the page loads?

This is a matter of the default tag config. You can change the send_page_view property using the woocommerce_ga_gtag_config filter.

martynmjones commented 4 months ago

Hey @tomalec, thanks for working on the documentation update.

The changes look good to me and the inclusion of a link to Google’s recommended CMPs is a nice way to direct merchants toward a plugin that they'll be able to work with.

tomalec commented 4 months ago

Updated docs published https://woocommerce.com/document/google-analytics-integration/ image

Closing as done.