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
Create Web_Tag
class for Ads
module
#8313
Comments
ACs 👍🏻 |
IB ✔️ |
Update: This is technically blocked by #8273 as using the GTag infrastructure for the Ads module creates duplicates alongside Analytics that still doesn't use the GTag infrastructure. The PR for this issue is otherwise ready. |
The PR aiming to address the ACs for this issue is ready for CR. However, I have one concern. While this issue implements an independent ability for the Ads module to output the Ads conversion tracking ID, it doesn't prevent the Analytics module from still outputting this tag if still set. I understand that we have #8248 that is supposed to migrate the Ads conversion tracking ID from the Analytics to the Ads module thus effectively removing it from the Analytics module, however, keep in mind that this migration is conditional. This migration will only happen if the user goes to Site Kit Settings and opens the Analytics settings edit/view screens. See this AC from #8248:
Let's take the following scenario into consideration:
The above steps will make Site Kit output two tags for the Ads conversion tracking ID, one from the Analytics module, and the other from the Ads module. Here's a screenshot of an experiment I did to replicate the above scenario: I think the above scenario can potentially cause duplicate/erroneous tracking, and should be addressed. I haven't been able to locate an issue that addresses this. |
Add Ads module `Web_Tag` class
@nfmohit could you please create a new ticket from your comment? We will address it there. |
QA Update: ❌@nfmohit I started to work through testing this ticket and noticed that when I entered a Conversion Tracking ID, e.g., AW-1234 and click on the Please note that Analytics was not set up. When Analytics was set up then I am able to set up the module. |
QA Update: ✅Verified:
Note: the issue above is not re-creatable after refreshing develop this morning, but I plan to do some more testing with a new site. This issue is outside the scope of this ticket anyway, so it will be addressed separately. |
@wpdarren the |
@aaemnnosttv Ahh, yes, that would make sense. I have an AdBlocker enabled, so I will do some additional testing around this later today and report back. |
This is just a note, @aaemnnosttv, that the issue was with the Adblock Chrome extension. When I disabled it, I could set up the Ads module without issues. I created this ticket for it here so we can fix it for launch. |
Feature Description
As part of the new Ads module, comes the need to render an Ads gtag (either as a main gtag or inline config) if the user is making use of the
Ads Conversion ID
field within the module.At present, Ads Conversion ID logic is container within the GA4
Web_Tag
module. See the code at https://github.com/google/site-kit-wp/blob/develop/includes/Modules/Analytics_4/Web_Tag.phpThe Ads module now requires it's own
Web_Tag
class in order to render the necessarygtag
, or add the necessary inline config to an already enqueuedgtag
.See the applicable area of the Design Doc here: https://docs.google.com/document/d/1APuSv95bf62uhzlaFlW6jPrzPKy1avpRYd9W1MSAAJo/edit?resourcekey=0-UuynlcUz9CoubgldR6Z5sg#heading=h.miy2mfwgn6h8
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Web_Tag
class should be created within theGoogle\Site_Kit\Modules\Ads;
namespaceWeb_Tag
class should utilise the Ads Conversion ID field to either:gtag
script referencing the applicable tag ID from the above field, orgtag
scriptGTag
infrastructure to achieve the aboveImplementation Brief
includes/Modules/Ads/Web_Tag.php
Module_Web_Tag
register
methodgooglesitekit_setup_gtag
action, and invoke callback method, saysetup_gtag
setup_gtag
method$gtag
$this->tag_id
is not empty, invokeadd_tag
method of$gtag
, and passtag_id
class property as only parameter. Example$gtag->add_tag( $this->tag_id )
script_loader_tag
filter, and if handle isGTag::HANDLE
include snippet commentGoogle Ads snippet added by Site Kit
before the tag. You can see an example heresite-kit-wp/includes/Modules/Analytics_4/Web_Tag.php
Lines 143 to 154 in c593141
Google\Site_Kit\Modules\Ads
classregister
methodtemplate_redirect
action and invoke callback method, sayregister_tag
register_tag
methodWeb_Tag
class, and pass it theadsConversionID
setting.is_tag_blocked
) includeTag_Environment_Type_Guard
inuse_guard
method. And if tagcan_register
, invokeregister
method on it.site-kit-wp/includes/Modules/Tag_Manager.php
Lines 554 to 572 in d8a3974
Test Coverage
QA Brief
adsModule
feature flag, and connect the Ads module with a conversion tracking ID, e.g.AW-1234
.Changelog entry
The text was updated successfully, but these errors were encountered: