Closed zutigrm closed 4 hours ago
AC ✔️
@zutigrm IB ✅ , moving to EB.
Assigning this to myself to get this moved through and unblock other issues 🙂
Going through the QAB, I have a couple of things to highlight:
ITEM 1:
Pasted the snippet
await googlesitekit.data.select('modules/analytics-4').hasNewConversionReportingEvents()
First call outputs undefined, afterwards we are expecting it to show empty array [] However, instead of showing empty array, it's returning as 'False' ❌
ITEM 2:
Pasted the snippet
await googlesitekit.data.select('modules/analytics-4').hasLostConversionReportingEvents()
We are expecting it to behave the same as It should behave same as .hasNewConversionReportingEvents() above. Indeed, it behaves the same but given that it returns false instead of empty array, this needs to be double-checked. ⚠
ITEM 3:
Pasted the snippet:
await googlesitekit.data.dispatch('modules/analytics-4').receiveConversionReportingInlineData({newEvents: ['contact'], lostEvents: ['purchase']})
Then afterwards, without reloading, I tested the 3 snippets:
hasLostConversionReportingEvents()- we are expecting it to return only lostEvents value, in this case: ['purchase'] but it's returning as 'true' ❌
Other than that .getConversionReportingEventsChange() worked well:
Pasted the snippet
await googlesitekit.data.select('modules/analytics-4').getConversionReportingEventsChange()
Initially, it outputs undefined ✅
On the second attempt, it will resolve the data and outputs {newEvents: Array(0), lostEvents: Array(0)}
When feature flag is disabled, returns undefined for both newEvents and lostEvents
@kelvinballoo Thanks for you observations. Sorry about that, I update QAB now, we changed in the last CR round, what you see is correct output, hasNewConversionReportingEvents
and hasLostConversionReportingEvents
return true
, or false
, or undefined
, they will not return arrays any more
Thanks @zutigrm , going through the new QAB, everything is checking out. Moving ticket to Approval.
getConversionReportingEventsChange() worked well:
Pasted the snippet
await googlesitekit.data.select('modules/analytics-4').getConversionReportingEventsChange()
Initially, it outputs undefined ✅
On the second attempt, it will resolve the data and outputs {newEvents: Array(0), lostEvents: Array(0)} ✅
When feature flag is disabled, returns undefined for both newEvents and lostEvents
hasNewConversionReportingEvents() worked well:
Pasted the snippet
await googlesitekit.data.select('modules/analytics-4').hasNewConversionReportingEvents()
First call outputs undefined, afterwards it returns 'False' ✅ When feature flag is off, it always returned undefined value, this is expected. ✅
hasLostConversionReportingEvents() worked well:
Pasted the snippet
await googlesitekit.data.select('modules/analytics-4').hasLostConversionReportingEvents()
We are expecting it to behave the same as .hasNewConversionReportingEvents() above. Indeed, it behaves the same. First call is undefined, followed by 'False' ✅ When feature flag is off, it always returned undefined value. ✅
.receiveConversionReportingInlineData worked well:
Pasted the snippet:
await googlesitekit.data.dispatch('modules/analytics-4').receiveConversionReportingInlineData({newEvents: ['contact'], lostEvents: ['purchase']})
Then afterwards, without reloading, I tested the 3 snippets:
Feature Description
Conversion reporting datastore partial should be updated to include new resolver which would retrieve detected and lost events from inline module data (implemented in #9342), and pass them to an action which should receive passed data and store them to the state.
See Implementation - Datastore Partial section of the design doc
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
getConversionReportingEventsChange
is added to theconversion-reporting
datastore partialreceiveConversionReportingInlineData
actionreceiveConversionReportingInlineData
is implemented, which yields passed object to the reducerdetectedEventsChange
propertyhasNewConversionReportingEvents
andhasLostConversionReportingEvents
are addeddetectedEventsChange
state property by usinggetConversionReportingEventsChange
selectorImplementation Brief
assets/js/modules/analytics-4/datastore/conversion-reporting.js
detectedEventsChange
,undefined
by defaultgetConversionReportingEventsChange
resolvernewEvents
andlostEvents
from Analytics inline module data likeglobal._googlesitekitModulesData?.[ 'analytics-4' ]?.newEvents
, etc.receiveConversionReportingInlineData
actionassets/js/googlesitekit/datastore/site/info.js
, or any other datastore partial resolving inline data.receiveConversionReportingInlineData
actionnewEvents
andlostEvents
from the passed argument, and yield them as an object to the reducer. Then in the reducer, updatedetectedEventsChange
object in the state to holdnewEvents
andlostEvents
as propertiesgetConversionReportingEventsChange
selectorstate.detectedEventsChange
hasNewConversionReportingEvents
andhasLostConversionReportingEvents
selectorsgetConversionReportingEventsChange
selector to retrieve the inline data (or resolve it if not yet available), and then extract their respective properties from the returned value. You can add a helper function to extract the correct property, like for example, how it is used ininfo
datastore https://github.com/google/site-kit-wp/blob/d0f81d38c89d89c1b0d39e861a56ca67d40c238f/assets/js/googlesitekit/datastore/site/info.js#L38-L43 and then invoke it here in each selector passing eithernewEvents
orlostEvents
for the argumentTest Coverage
assets/js/modules/analytics-4/datastore/conversion-reporting.test.js
to include test coverage for new resolver, action and selectorsQA Brief
conversionReporting
feature flag enabledawait googlesitekit.data.select('modules/analytics-4').getConversionReportingEventsChange()
undefined
{newEvents: Array(0), lostEvents: Array(0)}
undefined
for bothnewEvents
andlostEvents
await googlesitekit.data.select('modules/analytics-4').hasNewConversionReportingEvents()
undefined
, afterwards should showfalse
undefined
valueawait googlesitekit.data.select('modules/analytics-4').hasLostConversionReportingEvents()
await googlesitekit.data.select('modules/analytics-4').hasNewConversionReportingEvents()
aboveawait googlesitekit.data.dispatch('modules/analytics-4').receiveConversionReportingInlineData({newEvents: ['contact'], lostEvents: ['purchase']})
await googlesitekit.data.select('modules/analytics-4').getConversionReportingEventsChange()
should return whole object passed above:{lostEvents: ['purchase'], newEvents: ['contact']}
await googlesitekit.data.select('modules/analytics-4').hasNewConversionReportingEvents()
should returntrue
await googlesitekit.data.select('modules/analytics-4').hasLostConversionReportingEvents()
should returntrue
Changelog entry