Scaffold analytics-4 internal module in PHP #2974
Labels
Module: Analytics
Google Analytics module related issues
P0
High priority
QA: Eng
Requires specialized QA by an engineer
Type: Enhancement
Improvement of an existing feature
Milestone
Since GA4 Analytics properties and UA properties are entirely different and separate, the infrastructure and basic API for GA4 should be implemented in a separate (fully internal) module. See more information on the overall approach.
This issue is for scaffolding the
analytics-4
module PHP class that will serve as foundation for the new internal module.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
There should be a new
Google\Site_Kit\Modules\Analytics_4
module class:internal
.analytics-4
and nameAnalytics 4 (Alpha)
.analytics
module uses.analyticsadmin
, which is the Admin API integration class from the PHP client library (the respective namespace needs to be added to the PHP Scoper configuration so that it is included in the build).Google\Site_Kit\Modules\Analytics_4\Settings
class which encompasses the following settings:accountID
(Analytics account ID, which effectively matches the UA account ID, since accounts are not technically different; yet, the module should already be self-contained and therefore store this)propertyID
(Analytics GA4 property ID; contrary to UA, this is not the value to include in the tag, this is more comparable to theinternalWebPropertyID
setting of the main Analytics / UA module)webDataStreamID
(Analytics GA4 web datastream ID; part of the GA4 property; this is automatically set or created based on the GA4 property specified by the user)measurementID
(Analytics GA4 measurement ID; this is the value to include in the tag, which is technically defined by the web datastream)useSnippet
(whether to place the Analytics GA4 snippet; ifuseSnippet
is also enabled for the main Analytics / UA module, double tagging will be used)ownerID
being controlled byaccountID
,propertyID
,webDataStreamID
, andmeasurementID
settingsanalytics-4
module namespace):GET:accounts
(queries accounts via accounts.list)GET:properties
(queries GA4 properties for an account via properties.list)GET:webdatastreams
(queries GA4 web data streams for a GA4 property via properties.webDataStreams.list)POST:create-property
(creates a GA4 property for a given account via properties.create; should use the site address host as property name)POST:create-webdatastream
(creates a GA4 web data stream for a given GA4 property via properties.webDataStreams.create; should use the site address host as data stream name, and also set the default URI based on the site address)Implementation Brief
Analytics_4
class PHP file starting from the already implemented class in this experimental branch from last year, then remove the parts that are out of scope of this issue:GET:report
andGET:tag-permission
datapoints and related methodsanalyticsdata
API serviceAnalytics_4\Settings
class PHP file starting from the respective class from the same experimental branch, removing the settings which are not part of the ACsGoogleAnalyticsAdmin
service to the PHP Scoper configuration so that those classes are included in the buildModules
class to allow for numbers in module slug names for the REST routes (see https://github.com/google/site-kit-wp/compare/experimental/analytics-4-module#diff-ba139661aaccfb4281aa55301a0066504c2d7712a5d48fad8cd62be4c1d31463)Test Coverage
Analytics_4
class, similar to test coverage for theAnalytics
classAnalytics_4\Settings
class, similar to test coverage for theAnalytics\Settings
classVisual Regression Changes
QA Brief
Changelog entry
analytics-4
module PHP class.The text was updated successfully, but these errors were encountered: