-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Google Analytics for WooCommerce version 2.0.0 #2287
Add support for Google Analytics for WooCommerce version 2.0.0 #2287
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2287 +/- ##
===========================================
+ Coverage 62.2% 63.9% +1.6%
- Complexity 4190 4196 +6
===========================================
Files 748 455 -293
Lines 21547 17853 -3694
Branches 532 0 -532
===========================================
- Hits 13406 11400 -2006
+ Misses 7690 6453 -1237
+ Partials 451 0 -451
Flags with carried forward coverage won't be shown. Click here to find out more.
|
); | ||
} | ||
); | ||
if ( version_compare( \WC_GOOGLE_ANALYTICS_INTEGRATION_VERSION, '2.0.0', '>=' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚧
I don't get into this line when I run it with the new GA, as the one above returns false
.
GLA still expect the old GA settings to be there https://github.com/woocommerce/google-listings-and-ads/blob/3a423a2d5cfca64486c74cf41905d01db1cc4c52/src/Proxies/GoogleGtagJs.php#L24:L33
The latest GA does not set ga_gtag_enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…analytics-version-2-enabled Consider `ga_gtag_enabled=yes` for WCGAI >= 2
Co-authored-by: Tomek Wytrębowicz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the code, tested locally LGTM, thanks! :)
Changes proposed in this Pull Request:
Google Analytics for WooCommerce updates how the Global Site Tag is loaded so this PR updates the integration in GLA to support version
2.0.0
and above while maintaining backwards compatibility.The main difference is that instead of simply adding a script to the page with a call to
gtag
, we now usewp_add_inline_script
and the Google Analytics for WooCommerce script handle where applicable.Detailed test instructions:
page_view
view_item
purchase
conversion
Changelog entry