Skip to content
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

Scaffold analytics-4 internal module in PHP #2974

Closed
felixarntz opened this issue Mar 17, 2021 · 3 comments
Closed

Scaffold analytics-4 internal module in PHP #2974

felixarntz opened this issue Mar 17, 2021 · 3 comments
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

Comments

@felixarntz
Copy link
Member

felixarntz commented Mar 17, 2021

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:

  • Should be marked as internal.
  • Should have the slug analytics-4 and name Analytics 4 (Alpha).
  • Other module information fields should match what the existing analytics module uses.
  • Should declare the same base scopes as required like the main Analytics module (the new APIs rely on the same scopes).
  • Should declare a single service 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).
  • Should be accompanied by a 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 the internalWebPropertyID 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; if useSnippet is also enabled for the main Analytics / UA module, double tagging will be used)
  • Should also include the concept of module ownership via the respective PHP traits, with ownerID being controlled by accountID, propertyID, webDataStreamID, and measurementID settings
  • Should also expose Site Health information for each of the five settings
  • Should expose the following REST datapoints (under the analytics-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

Test Coverage

  • Add test coverage for Analytics_4 class, similar to test coverage for the Analytics class
  • Add test coverage for Analytics_4\Settings class, similar to test coverage for the Analytics\Settings class

Visual Regression Changes

  • N/A

QA Brief

  • Ensure the new Analytics class is implemented per the ACs.
  • Make sure tests pass.

Changelog entry

  • Scaffold analytics-4 module PHP class.
@aaemnnosttv
Copy link
Collaborator

@felixarntz I updated webDatastreamID -> webDataStreamID per my previous comment in the doc.

IB ✅

@aaemnnosttv aaemnnosttv removed their assignment Mar 25, 2021
@felixarntz felixarntz self-assigned this Mar 25, 2021
@felixarntz
Copy link
Member Author

@aaemnnosttv Thanks for updating this throughout the other issues - was about to do that :)

@felixarntz felixarntz added Type: Enhancement Improvement of an existing feature and removed Type: Feature New feature labels Mar 25, 2021
@felixarntz felixarntz assigned aaemnnosttv and unassigned felixarntz Mar 25, 2021
@felixarntz felixarntz assigned aaemnnosttv and unassigned felixarntz Mar 26, 2021
@eclarke1 eclarke1 removed the Next Up label Mar 29, 2021
@aaemnnosttv aaemnnosttv removed their assignment Mar 30, 2021
@tofumatt tofumatt self-assigned this Apr 5, 2021
@tofumatt
Copy link
Collaborator

tofumatt commented Apr 5, 2021

QA ✅

@tofumatt tofumatt removed their assignment Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

5 participants