-
Notifications
You must be signed in to change notification settings - Fork 286
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 selector to look up GA4 account, property, and web data stream based on list of measurement IDs #6372
Comments
IB ✅ |
QA Update:
|
@wpdarren, it is not expected to be behind the feature flag, so that is okay that you see it. |
QA Update: ✅Verified:
|
Approval ❌@techanvil @eugene-manuilov @sashadoes The selector appears to not work as expected and more importantly is causing a JS error. Below is a screenshot where I call it with a measurement ID of one of my web data streams, however not one with the current site URL set. That doesn't seem to be the only problem though, the same thing happens even when I call it with a measurement ID where it has the current site URL set. It first returns Noting here that the QA Brief is insufficient, as otherwise QA would have already been able to find that bug. We shouldn't just look whether a selector exists, we should also test that it works. |
Whoops, this one clearly slipped through the net. Thanks for spotting this. @felixarntz, and good point about the QAB. @eugene-manuilov having taken a cursory look it appears that site-kit-wp/assets/js/modules/analytics-4/datastore/webdatastreams.js Lines 476 to 480 in ccbc58f
|
Approval ✅Thanks for the quick fix @eugene-manuilov @techanvil! |
This selector is needed to identify the data to recommend reconfiguring the GA4 module with following an external change to the Google tag mapping (see #6083).
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
getAnalyticsConfigByMeasurementIDs( measurementIDs )
should be implemented.getWebDataStreamsBatch
selector passing all the GA4 property IDs that the current user has access to (viagetAccountSummaries
selector).null
if no results were found, e.g. when the user does not have access to any of the web data streams referenced by the measurement IDs):accountID
propertyID
webDataStreamID
measurementID
defaultUri
.null
should be returned.Note: This selector will be expensive to call due to several resulting API calls, so it should probably receive some doc comments highlighting that.
Implementation Brief
assets/js/modules/analytics-4/datastore/webdatastreams.js
getAnalyticsConfigByMeasurementIDs( measurementIDs )
selector by usingcreateRegistrySelector
getAccountID
to get currentaccountID
in usegetAccountSummaries
result to calculate and store the current account and otherpropertyIDs
in eg.currentAccountPropertiesIDs
andotherAccountPropertiesIDs
respectivelygetWebDataStreamsBatch
to extract data streams forcurrentAccountPropertiesIDs
and look for a match:measurementID
was passed to the selector: as soon as any web data stream has been found that matches passedmeasurementID
return {accountID
,propertyID
,webDataStreamID
,measurementID
} data objectmeasurementIDs
was passed to the selector: as soon as any web data stream has been found that matches one of the passedmeasurementIDs
, check the web data stream'sdefaultUri
by usingisSiteURLMatch
and in case 'true' (it matches) then return {accountID
,propertyID
,webDataStreamID
,measurementID
} data objectotherAccountPropertiesIDs
measurementID
measurementIDs
, returnnull
!NOTE: Since it is a heavy load, splitting between
currentAccountPropertiesIDs
andotherAccountPropertiesIDs
is an optimization. Any other optimizations are welcome. Make sure the code is well documented :)Test Coverage
Cover
getAnalyticsConfigByMeasurementIDs
with unit testsQA Brief
getAnalyticsConfigByMeasurementIDs
when you typegooglesitekit.data.select( 'modules/analytics-4' )
.undefined
when data is being resolved and does not returnnull
for the case when we expect the correct result and it should returnnull
if there is no valid results for provided measurement ID.Changelog entry
getAnalyticsConfigByMeasurementIDs
selector to look up GA4 account, property, and web data stream based on a set of measurement IDs.The text was updated successfully, but these errors were encountered: