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
Update Analytics_4\Web_Tag
class to function independently
#7924
Comments
ACs 👍🏻 |
Thanks, @10upsimon. IB mostly looks good to me. Could you please add test coverage information and set the estimate for this task? |
@eugene-manuilov I have checked the existing Assigning back to you @eugene-manuilov |
Thanks, @10upsimon. IB ✔️ |
@10upsimon As per QAB - "Using the branch/version containing the changes in said ticket, note the same script tag contents as in the prior step." As related PR is already merge in develop. Just wanted to confirm that I need to compare latest and dev branch in this case. Correct ? |
That is correct @mohitwp |
QA Update ✅
|
❌ ApprovalAfter some testing and review, we've found a few regressions introduced by this issue, particularly for the case where UA settings are still present. See #8078. Additionally, the ads conversion ID is no longer output if the UA tag is not being output. We'll address this in a follow-up PR which will also remove any UA property tagging since this is no longer possible to manage or connect. |
QA Update
|
Hi @mohitwp, that is expected when your GA4 property already has custom dimensions. Sorry, I probably should've clarified that in the QAB. Thanks for checking! |
QA Update ✅
1. Verify that the GA4 tag contains custom dimensions in singular pages if relevant key metrics are selected 2. Verify that the GA4 tag contains ads conversion ID if set from the GA settings. 3. Use a site that had Analytics module set up with UA property. Verify that no UA tags (or duplicate GA tags) are output. UA connected on older version- UA connected on main environment - Snippet not showing any reference of UA cc @wpdarren |
Feature Description
The
Analytics_4\Web_Tag
class extends theAnalytics\Web_Tag
class. TheAnalytics_4\Web_Tag
class should be able to function and output tags independently without extending itsAnalytics
counterpart.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Analytics_4\Web_Tag
class should no longer extend theAnalytics\Web_Tag
class.Analytics_4\Web_Tag
class should be able to function independently and output GA4 tags on its own.Implementation Brief
Web_Tag
class atincludes/Modules/Analytics_4/Web_Tag.php
Module_Web_Tag
and implementTag_Interface
, i,eclass Web_Tag extends Module_Web_Tag implements Tag_Interface
use
statement for the applicableModule_Web_Tag
class, i.euse Google\Site_Kit\Core\Modules\Tags\Module_Web_Tag;
use
statement for the applicableTag_With_DNS_Prefetch_Trait
class, i.euse Google\Site_Kit\Core\Tags\Tag_With_DNS_Prefetch_Trait;
$home_domain;
property as a private property of the class, i.eprivate $home_domain;
.$anonymize_ip
property as a private property of the class, i.eprivate $anonymize_ip;
.$ads_conversion_id
property as a private property of the class, i.eprivate $ads_conversion_id;
.set_home_domain()
method from the previously extendedAnalytics/Web_Tag
class and add it as a newly defined method in this now standalone class.set_anonymize_ip()
method from the previously extendedAnalytics/Web_Tag
class and add it as a newly defined method in this now standalone class.set_ads_conversion_id()
method from the previously extendedAnalytics/Web_Tag
class and add it as a newly defined method in this now standalone class.register()
method:wp_resource_hints
as this will no longer be called from a parent class.render()
method (required by the interface) as this is no longer rendered in a parent class. The method should be a noop method and do nothing.enqueue_gtag_script()
method:did_action
check entirely and replace the contents of the method with the contents from the method in the previously extended Analytics/Web_Tag class (non GA4 one).add_inline_config()
method from theAnalytics/Web_Tag
class to this class as we no longer want to call a parent implemented of it.get_tag_config()
method:parent::get_tag_config()
get_tag_config()
inAnalytics/Web_Tag
, i.e copy the contents from the once extended classes method into this method.<!-- Google Analytics snippet added by Site Kit -->
and ending at<!-- End Google Analytics snippet added by Site Kit -->
.Test Coverage
QA Brief
<!-- Google Analytics snippet added by Site Kit -->
and<!-- End Google Analytics snippet added by Site Kit -->
.Additional QAB
Changelog entry
Analytics_4\Web_Tag
class to function independently from the original AnalyticsWeb_Tag
class.The text was updated successfully, but these errors were encountered: