-
Notifications
You must be signed in to change notification settings - Fork 284
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
Implement GA4 logic in server-side callback for creating a new Analytics account #3252
Comments
Looks good, just one question:
I'm guessing we want to do this because the API is new/unstable? But maybe we should mention why in the IB or make it explicit there to include a comment why we're silencing errors rather than surfacing them, or we could get weird bugs in the future. Or, at least, developers might be confused when they see the code and wonder why we're doing that. What do you think @eugene-manuilov? |
@tofumatt ok, updated it. Could you please check it one more time? |
Thanks! IB ✅ |
Un-assigning myself as I'm not sure my PHP is currently up to the task! |
@eugene-manuilov please add a QAB 👍 |
QAB is added. |
QA: ✅ |
In the server-side callback where a new Analytics account has been created, if the
ga4setup
flag is active, a corresponding GA4 property should be created as well.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Analytics::handle_provisioning_callback
a new action should be triggered right before redirecting the usergooglesitekit_analytics_handle_provisioning_callback
.Analytics_4
class a callback should be added to that action which creates a corresponding new GA4 property and GA4 web data stream and stores their data in the respectiveAnalytics_4\Settings
settings.Implementation Brief
googlesitekit_analytics_handle_provisioning_callback
action right before the final redirect in theAnalytics::handle_provisioning_callback()
method.create_property( $accountID )
:site-kit-wp/includes/Modules/Analytics_4.php
Lines 229 to 233 in 8da6a91
create_webdatastream( $propertyID )
:site-kit-wp/includes/Modules/Analytics_4.php
Lines 244 to 248 in 8da6a91
handle_provisioning_callback( $accountID )
to theAnalytics_4
class.propertyID
andwebDataStreamID
in the Analytics4 settings.Analytics_4::register
method that calls the newhandle_provisioning_callback
method for thegooglesitekit_analytics_handle_provisioning_callback
action.Test Coverage
Visual Regression Changes
QA Brief
Analytics_4
class that it has thehandle_provisioning_callback
method which is connected to thegooglesitekit_analytics_handle_provisioning_callback
action in theregister
method.Analytics_4::handle_provisioning_callback
method creates a new property and web data stream for the provided account ID.Analytics::handle_provisioning_callback()
method and make sure that it triggers thegooglesitekit_analytics_handle_provisioning_callback
action at the very end and before the success redirect.Changelog entry
The text was updated successfully, but these errors were encountered: