-
Notifications
You must be signed in to change notification settings - Fork 295
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 existing tag handling for Google Tag support #6374
Comments
@hussain-t Checking in on this one as it's a P0 and it looks like it's been assigned to you for some time. Thanks! |
@bethanylang will complete this as soon as possible. Thanks! |
IB ✅ |
Having discussed this with @felixarntz, the IB needs a rework and I've moved the issue back into the IB column to address this. |
@techanvil the IB LGTM, the one thing we might want to add is a resolver for the new |
Thanks @aaemnnosttv - sounds good to me. I've updated the IB, please take a look. |
Thanks for expanding on that @techanvil, one more thought – I wonder if it wouldn't be simpler to override the The overriding of the resolver could be conditional based on the feature flag as well. What do you think? |
Thanks @aaemnnosttv, that's a good idea! Have updated the IB again, cheers. |
Great, thanks @techanvil 👍 IB ✅ |
QA Update ✅Verified -
|
Minor adjustments will be needed to support existing tags in combination with the new Google Tag (also called GTE). Site Kit will not support every single edge-case there as that would be a maintenance nightmare for little benefit, particularly it will not cater for the combinations that also take into account Google Tag Manager (if that module is active).
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
getGoogleTagContainer
selector should be used, passing the existing tag to it (which effectively is the measurement ID).tagIds
, then Site Kit should continue to behave as today (if the user chooses the matching property, set the toggle to place the snippet off by default).tagIds
, we are limited by the lack of an API endpoint, which means we can't reasonably determine information on the actual Google Tag with that "G-" tag ID. In other words, in this scenario we should entirely ignore the existing tag and act as if there was none.For some background context on why the ACs do not include anything around "GT-" tags: We don't need to consider "GT-" tags (the new Google tag ID format) here at all, since any such tags will automatically come with the new Analytics feature to avoid duplicate tracking. Therefore there is no risk in double tagging in such a case, and as such we don't need to look for those tags in the page.
Implementation Brief
The solution here as discussed with @felixarntz and @aaemnnosttv is to override the GA4
getExistingTag()
resolver, and encapsulate the described checks for a valid Google Tag within it.Within
assets/js/modules/analytics-4/datastore/tags.js
:gteSupport
feature is enabled, override the*getExistingTag()
resolver that is inexistingTagStore.resolvers
with a new implementation. This should be copied from the existing implementation increateExistingTagStore()
, and modified as follows:existingTag
viafetchGetExistingTag()
, retrieve the Google Tag container for the existing tag via thegetGoogleTagContainer()
selector - wait for the selector to resolve viayield Data.commonActions.await( registry.__experimentalResolveSelect( ...
.tagIds
array, dispatch thereceiveGetExistingTag()
action with the existing tag.receiveGetExistingTag()
with the valuenull
.Test Coverage
getExistingTag()
selector and resolver.QA Brief
gteSupport
feature flag enabled.Changelog entry
The text was updated successfully, but these errors were encountered: