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

Create GA4 WPDashboardUniqueVisitorsChart #6855

Closed
aaemnnosttv opened this issue Apr 11, 2023 · 4 comments
Closed

Create GA4 WPDashboardUniqueVisitorsChart #6855

aaemnnosttv opened this issue Apr 11, 2023 · 4 comments
Labels
P0 High priority Type: Enhancement Improvement of an existing feature

Comments

@aaemnnosttv
Copy link
Collaborator

aaemnnosttv commented Apr 11, 2023

Feature Description


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

Acceptance criteria

  • A new component WPDashboardUniqueVisitorsChartGA4 should be created based on the existing WPDashboardUniqueVisitorsChart
  • The component should source its report data from the analytics-4 store
  • The component should be rendered on the WP dashboard based on the result of isGA4DashboardView
  • Storybook stories should be added to cover the following cases (with and without a current entity URL set: example):
    • Loading
    • Gathering data ("Data unavailable")
    • Zero data (data available but metric is 0)
    • Error
    • Ready (data available and non-zero)

Implementation Brief

  • Create assets/js/components/wp-dashboard/WPDashboardUniqueVisitorsChartWidgetGA4.js which exports the WPDashboardUniqueVisitorsChartWidgetGA4 functional component.
    • The component should be similar to the one in assets/js/components/wp-dashboard/WPDashboardUniqueVisitorsChartWidget.js with the following updates:
      • Replace occurrences of the Analytics data store (MODULES_ANALYTICS) by the GA4 Analytics data store (MODULES_ANALYTICS_4).
      • Replace the metrics and dimensions by their GA4 counterparts as per this doc here, including the metric names.
  • Stories should be within assets/js/components/wp-dashboard/WPDashboardUniqueVisitorsChartWidgetGA4.stories.js and make use of the Analytics 4 response mock data added from Introduce factory for Analytics 4 response mock data #6174, similar to other WPDashboard*GA4.stories.js files.
    • Refer to the AC for the different stories to be added.
  • In assets/js/components/wp-dashboard/WPDashboardWidgets.js:
    • Check if the ga4Reporting feature flag is enabled via the useFeature hook.
    • Check the isGA4DashboardView() selector from the modules/analytics store.
    • If the above is true, render:
      • WPDashboardUniqueVisitorsChartWidgetGA4 instead of WPDashboardUniqueVisitorsChartWidget.

Test Coverage

  • No tests need to be added/updated.

QA Brief

  • Setup a new site and connect the plugin.
  • Activate and connect the Analytics module that has GA4 data.
  • Enable ga4Reporting feature tour and GA4 dashboard in Analytics settings.
  • Go to the WordPress dashboard and verify that you see the unique visitors chart widget.

Changelog entry

  • Add GA4 version of the Unique Visitors chart on the WP dashboard.
@aaemnnosttv aaemnnosttv added P0 High priority Type: Enhancement Improvement of an existing feature labels Apr 11, 2023
@nfmohit nfmohit assigned nfmohit and unassigned nfmohit Apr 12, 2023
@eugene-manuilov eugene-manuilov self-assigned this Apr 12, 2023
@eugene-manuilov
Copy link
Collaborator

IB ✔️

@aaemnnosttv
Copy link
Collaborator Author

@eugene-manuilov Heads up that I've tweaked the AC per the most recent logic in WPDashboardWidgets which uses isGA4DashboardView for the condition which checks the feature flag internally. Basically it should show the GA4 version if the feature is enabled AND the dashboardView is set to GA4.

@nfmohit
Copy link
Collaborator

nfmohit commented Apr 12, 2023

@eugene-manuilov Depending on Evan's comment above, I have made a slight change to the IB for clarification (while having the previous iteration as striked out). Thanks!

@eugene-manuilov eugene-manuilov removed their assignment Apr 13, 2023
@aaemnnosttv aaemnnosttv self-assigned this Apr 13, 2023
@aaemnnosttv aaemnnosttv changed the title Create GA4 WPDashboardUniqueVisitorsChartWidget Create GA4 WPDashboardUniqueVisitorsChart Apr 13, 2023
@aaemnnosttv aaemnnosttv removed their assignment Apr 13, 2023
@wpdarren
Copy link
Collaborator

QA Update: ✅

Verified:

  • The WordPress dashboard shows e the unique visitors chart widget for GA4. WPDashboardUniqueVisitorsChartGA4
    • It doesn't mention this in the QAB, but I have tested this for a site in gathering, zero data
    • Also tested on a site with real data. Can see when I refresh the develop branch that the chart changes from WPDashboardUniqueVisitorsChart to WPDashboardUniqueVisitorsChartGA4
Screenshots

image
image
image

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

4 participants