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

Introduce factory for Analytics 4 response mock data #6174

Closed
aaemnnosttv opened this issue Nov 18, 2022 · 7 comments
Closed

Introduce factory for Analytics 4 response mock data #6174

aaemnnosttv opened this issue Nov 18, 2022 · 7 comments
Labels
P0 High priority Type: Enhancement Improvement of an existing feature

Comments

@aaemnnosttv
Copy link
Collaborator

aaemnnosttv commented Nov 18, 2022

Feature Description

A data-mock set of utilities should be created for generating and receiving mock report data for use by the analytics-4 data store, similar to what has been done for analytics, search-console, and adsense.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • A analytics-4/util/data-mock.js module should be created, similar to the utilities by the same name for other modules
  • It should export the following functions:
    • getAnalytics4MockResponse( args ) – a pure function that generates a mock report in the same format that would be returned from the server backend for a report request with the given args
    • provideAnalytics4MockReport( registry, options ) – a pure function that generates and receives the resulting mock report data onto the analytics-4 store of the given registry

Implementation Brief

  • Create a new file, assets/js/modules/analytics-4/util/data-mock.js.
  • Copy everything from assets/js/modules/analytics/util/data-mock.js to assets/js/modules/analytics-4/util/data-mock.js.
  • Rename the function provideAnalyticsMockReport to provideAnalytics4MockReport.
  • Rename the function getAnalyticsMockResponse to getAnalytics4MockResponse.
  • Replace all instances of MODULES_ANALYTICS with MODULES_ANALYTICS_4.
  • Replace all instances of /analytics/i with /analytics-4/i.
  • Refer to the metric & dimension mappings in the Phase 2 docs and the migration guide, update the mock metrics/dimensions as appropriate and remove those which are no longer relevant (e.g., the AdSense ones as GA4 isn't yet linked with AdSense).

Test Coverage

  • Create a new file, assets/js/modules/analytics-4/util/data-mock.test.js.
  • Add test coverage for the getAnalytics4MockResponse function.

QA Brief

  • At this point, the changes in the PR does not affect the plugin since the functions are not called anywhere, so no regular QA needed here.
  • Because of this, QA can be skipped for this issue and it moved directly to the Approval queue.

Changelog entry

  • N/A.
@aaemnnosttv aaemnnosttv added P0 High priority Type: Enhancement Improvement of an existing feature labels Nov 18, 2022
@aaemnnosttv
Copy link
Collaborator Author

@FlicHollis As a note about the dependency here, it's more specific to one part of it (the provide* function). The majority of the work here is around generating the mock data and would not be blocked by the selector issue. Also worth noting that @eugene-manuilov has worked on most if not all of these in the past so it might be worth at least having him write or approve the IB here.

@FlicHollis
Copy link
Collaborator

Thanks so much for the additional context @aaemnnosttv

@techanvil
Copy link
Collaborator

Hey @hussain-t, the initial approach is looking good in the IB, but I think it would benefit from going into a little more detail on how to achieve the last point.

Ensure the mock response matches the format of the response from the Analytics 4 getReport selector.

For example, the advice might be to refer to the metric & dimension mappings in the Phase 2 one-pager and the migration guide, update the mock metrics/dimensions as appropriate, and to remove those which are no longer relevant (i.e. the AdSense ones as GA4 isn't yet linked with AdSense).

@hussain-t
Copy link
Collaborator

Thanks for pointing it out, @techanvil. I have updated the IB.

@techanvil
Copy link
Collaborator

Thanks @hussain-t!

IB ✅

@mxbclang
Copy link

@asvinb asvinb self-assigned this Jan 3, 2023
@asvinb asvinb mentioned this issue Jan 3, 2023
18 tasks
@asvinb asvinb assigned techanvil and unassigned asvinb Jan 25, 2023
@techanvil techanvil assigned asvinb and unassigned techanvil Jan 25, 2023
@asvinb asvinb assigned techanvil and unassigned asvinb Jan 25, 2023
@techanvil techanvil assigned asvinb and techanvil and unassigned techanvil and asvinb Jan 25, 2023
@techanvil techanvil assigned techanvil and unassigned techanvil Jan 26, 2023
@techanvil techanvil self-assigned this Feb 2, 2023
@techanvil techanvil removed their assignment Feb 2, 2023
@tofumatt tofumatt self-assigned this Feb 2, 2023
@tofumatt tofumatt removed the QA: Eng Requires specialized QA by an engineer label Feb 2, 2023
@tofumatt tofumatt assigned techanvil and unassigned tofumatt Feb 2, 2023
@techanvil techanvil assigned tofumatt and unassigned techanvil Feb 3, 2023
@tofumatt tofumatt removed their assignment Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 High priority Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

9 participants