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 decoupled infrastructure for gtag tag #8269
Comments
Thanks @techanvil – thinking ahead just a little bit, one thing that comes to mind re #8274 is that we want to do this for GTM as well which doesn't use an enqueued WP script the way GA does. All that to say that we might want to decouple the gtag infra for the consent ("before") from the rest of the tag so that this part can be output independently. I suppose this part could be implemented by the consent mode infra almost treating it as its own tag that would always be printed very early relative to other scripts. WDYT? If we want to address this in this issue then it should probably have a point in the AC, otherwise I'm okay with this proceeding if we want to handle it in a later issue. |
Thanks @aaemnnosttv, good spot. I think we can implement that in #8264, but I've updated the POC to accommodate this in a slightly cheap and cheerful manner. Actually this makes me wonder if we even need to decouple the GTag as part of this epic - at least, as things stand we don't have it specced out to enqueue any additional GTag consent commands, only to call |
I'm moving this back to AC as we need to determine whether or not it's actually needed for the Consent Mode MVP. |
@aaemnnosttv I see this is still set as blocking #8273, which is a Consent Mode issue. Does this mean that we'll need to complete this Ads Module issue ASAP in order to deliver Consent Mode at the end of Sprint 122 as planned? |
@bethanylang thanks for spotting this. With this issue removed from the CoMo epic, #8273 can also be removed. I have removed that issue from CoMo and assigned both of these to @10upsimon for evaluation and reuse in the Ads Module epic. |
Note to AC reviewer, this has largely been kept as is from the Consent Mode epic, having reviewed the POC at 82d9f94 this should be a "lift and shift" effort. |
ACs here look good 👍🏻 Since there's an IB as well (which also looks good) I'll move this right to EB IB ✅ |
Feature Description
GTag rendering should be lifted out of Analytics into a core location where it can be used by multiple modules, initially the Ads module in addition to Analytics.
Note: This work has largely been completed as part of the POC for the Consent Mode epic, please see 82d9f94
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Analytics_4\Web_Tag
class into a reusable class in theCore
namespace.gtag()
commands should be able to be queued for insertion either before or after thegtag.js
script is requested.Implementation Brief
GTag
class implementation in the branchtrh/decouple-gtag
.GTag
class inPlugin
, but don't make use of it in theAnalytics_4\Web_Tag
class as yet, it will be integrated there in Update Analytics to use new gtag infrastructure #8273.Test Coverage
QA Brief (ENG:QA)
$gtag->add_tag( 'GT-12345', array( 'foo' => 'bar' ) );
and validate that the gtag script is successfully output on the page, and that the src correctly reflects the chosen tag ID.gtag( 'config' )
call is present for the tag in question.$gtag->add_command( 'foo', array('bar') );
and validate that the gtag command call is successfully output within the gtag snippet.$position
function arg and ensure that the position of the command changes accordingly.add_tag()
method, such asGT-54321
.gtag('config')
calls, one for each tag ID.gtag('config')
function calls.Changelog entry
The text was updated successfully, but these errors were encountered: