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

Update view-only Search Funnel widget when Analytics is recoverable #5470

Closed
aaemnnosttv opened this issue Jun 29, 2022 · 6 comments
Closed
Labels
Module: Analytics Google Analytics module related issues P0 High priority Type: Enhancement Improvement of an existing feature

Comments

@aaemnnosttv
Copy link
Collaborator

aaemnnosttv commented Jun 29, 2022

Feature Description

The Search Funnel widget is unique in that it is primarily a Search Console widget but also includes information from Analytics if it is connected. For view-only users, they will additionally see it only if Analytics is also shared with them.

In #5376, we added a new placeholder for widgets in a recoverable state, but since the Search Funnel widget only declares search-console as a module dependency, it still tries to render the Analytics components as usual, even when Analytics is in a recoverable state which results in a state like this:

image

Here the Analytics data is requested in the SF widget and fails because it is attempted to with the current user's credential's instead of the module owner's due to it being in a recoverable state. Of course view-only users have no credentials so it fails.


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

Acceptance criteria

  • The Search Funnel widget should be updated in the context of the view-only dashboard, if Analytics is recoverable, the Analytics stats should be replaced by the RecoverableModules CTA, the same as if it were a standalone Analytics widget
    • In this scenario, the Analytics data should not be requested, just as if it were not connected

Implementation Brief

Within assets/js/modules/search-console/components/dashboard/SearchFunnelWidget/index.js:

  • Avoid Analytics data being unnecessarily requested:
    • Create a boolean, say showRecoverableAnalytics, which is true when viewOnly is true and Analytics is recoverable.
      • Use the getRecoverableModules() selector to retrieve the recoverable modules state.
    • For each MODULES_ANALYTICS selector which is conditionally called within the file, add showRecoverableAnalytics to the condition so the selector is only called when showRecoverableAnalytics is false.

Within assets/js/modules/search-console/components/dashboard/SearchFunnelWidget/Overview.js:

  • Create the same boolean, showRecoverableAnalytics, or pass it in as a prop from the SearchFunnelWidget component.
  • Avoid Analytics data being unnecessarily requested:
    • For the conditionally called MODULES_ANALYTICS -> isGatheringData() selector, add showRecoverableAnalytics to the condition so the selector is only called when showRecoverableAnalytics is false.
  • Show the RecoverableModules CTA:
    • Ensure the showAnalytics boolean is true only when showRecoverableAnalytics is false.
    • Ensure that none of the existing Analytics Cell containers are rendered when showRecoverableAnalytics is false. In practice this should only mean updating the condition for rendering WidgetReportError as the others won't render anyway in the scenario where showRecoverableAnalytics will resolve to false.
    • Add a conditionally rendered Cell containing a RecoverableModules component, rendered when canViewSharedAnalytics and analyticsModuleActiveAndConnected are true and showRecoverableAnalytics is true.

Storybook

Test Coverage

  • No new tests needed. Fix any failing tests.

QA Brief

  • Ensure that the dashboardSharing feature flag is enabled in the tester plugin.
  • Go to the Site Kit Dashboard.
  • Share the Search Funnel module with other roles.
  • As the first admin, do not activate the Analytics module.
  • Log in as the second admin and authenticate with your Google account.
  • Activate the Analytics module.
  • Share it with the other roles.
  • Disconnect the second admin from Site Kit, thus making the Analytics module recoverable.
  • Log in as a different unauthenticated user as a View Only user.
  • Ensure that the Search Funnel widget displays a CTA that says: Data Unavailable: Analytics data was previously shared by an admin who no longer has access. Please contact another admin to restore it.

Changelog entry

  • Show "Recoverable Modules" component for Analytics section of the Search Funnel widget, when on the view-only Dashboard and the Analytics module is in a recoverable state.
@aaemnnosttv aaemnnosttv added P0 High priority Type: Enhancement Improvement of an existing feature Module: Analytics Google Analytics module related issues labels Jun 29, 2022
@hussain-t hussain-t assigned hussain-t and unassigned hussain-t Jun 29, 2022
@techanvil techanvil assigned techanvil and unassigned techanvil Jun 30, 2022
@techanvil
Copy link
Collaborator

I noticed a somewhat related issue when investigating the IB for this and have raised a GitHub issue for it: #5505

@aaemnnosttv aaemnnosttv self-assigned this Jul 5, 2022
@aaemnnosttv
Copy link
Collaborator Author

IB ✅

@aaemnnosttv aaemnnosttv removed their assignment Jul 5, 2022
@nfmohit nfmohit self-assigned this Jul 6, 2022
@techanvil techanvil self-assigned this Jul 6, 2022
@nfmohit nfmohit removed their assignment Jul 6, 2022
@techanvil techanvil removed their assignment Jul 6, 2022
@wpdarren wpdarren self-assigned this Jul 6, 2022
@wpdarren
Copy link
Collaborator

wpdarren commented Jul 6, 2022

QA Update: ⚠️

@nfmohit an observation. The RecoverableModules CTA appears in all widgets with analytics data on the dashboard. Is that expected? It makes sense but with the QAB saying on search funnel widget I wanted to double check. The screencast below shows the CTA placement on the shared dashboard. The same applies on the shared entity dashboard.

search-funnel.mp4

@techanvil
Copy link
Collaborator

Thanks for raising this @wpdarren, I can confirm that is indeed the expected behaviour, with the RecoverableModules CTA being rendered for all widgets which are associated with the analytics module.

@wpdarren
Copy link
Collaborator

wpdarren commented Jul 6, 2022

QA Update: ✅

Verified:

  • The Search Funnel widget displays a CTA that says: Data Unavailable: Analytics data was previously shared by an admin who no longer has access. Please contact another admin to restore it.
  • This CTA also appears on the other widgets with Analytics data.
search-funnel.mp4

@felixarntz
Copy link
Member

The design looks a bit weird now with GM2+ because the now gray box can appear right on the gray background. This is not a release blocker since dashboard sharing isn't out anyway, but we need to look into a better experience for surfacing these "Data unavailable" messages. See screenshot below

Screen Shot 2022-07-14 at 10 37 18 AM

cc @marrrmarrr @aaemnnosttv

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 Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

6 participants