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

Implement the “Top content” metric handling OAuth flow #8154

Closed
6 tasks done
techanvil opened this issue Jan 25, 2024 · 6 comments
Closed
6 tasks done

Implement the “Top content” metric handling OAuth flow #8154

techanvil opened this issue Jan 25, 2024 · 6 comments
Labels
Module: Analytics Google Analytics module related issues P1 Medium priority Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature

Comments

@techanvil
Copy link
Collaborator

techanvil commented Jan 25, 2024

Feature Description

Implement the redirection to OAuth to grant the edit scope for creating the custom dimension from the "Top content" metric section. This includes both the happy and unhappy path.

See audience tiles > "Top content" states and OAuth errors in the design doc.


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

Acceptance criteria

Implementation Brief

In assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/AudienceTile/AudienceTilePagesMetric.js:

Test Coverage

QA Brief

To simulate the OAuth error:

  1. Prepare the Environment:

    • Setup the Analytics module and enable the Audience Segmentation.
    • Delete the wp_googlesitekit_additional_auth_scopes entry from the wp_usermeta table if it exists. This entry contains the https://www.googleapis.com/auth/analytics.edit scope.
    • Delete the googlesitekit_post_type custom dimension from the Analytics console if it exists.
    • Run the following command in the browser console to sync the custom dimensions:
      googlesitekit.data.dispatch( 'modules/analytics-4' ).fetchSyncAvailableCustomDimensions()
    • Refresh the page if necessary.
  2. Trigger the OAuth Error:

    • Click on the Update button in the Audience Segmentation widget tile.
    • In the OAuth flow, cancel the flow when prompted to grant permissions.
    • Ensure the OAuth error variant of the Error Modal is displayed.
    • Click the Retry button to trigger the OAuth flow again.
    • Complete the OAuth flow and grant permissions.
    • Ensure the custom dimension creation continues successfully after granting permissions.

Changelog entry

  • Redirect to OAuth as needed to grant the scope for creating the required custom dimension from the "Top content" metric section.
@techanvil techanvil added Module: Analytics Google Analytics module related issues P1 Medium priority Type: Enhancement Improvement of an existing feature labels Jan 25, 2024
@ivonac4 ivonac4 added the Team M Issues for Squad 2 label Apr 9, 2024
@techanvil techanvil assigned techanvil and unassigned techanvil May 2, 2024
@hussain-t hussain-t self-assigned this May 16, 2024
@ivonac4 ivonac4 added the Next Up Issues to prioritize for definition label Jul 23, 2024
@hussain-t hussain-t removed their assignment Aug 20, 2024
@techanvil techanvil self-assigned this Aug 21, 2024
@techanvil
Copy link
Collaborator Author

IB ✅

@ivonac4 ivonac4 removed the Next Up Issues to prioritize for definition label Aug 22, 2024
@techanvil techanvil removed their assignment Aug 22, 2024
@hussain-t hussain-t self-assigned this Aug 22, 2024
@hussain-t hussain-t removed their assignment Aug 28, 2024
@techanvil techanvil assigned techanvil and hussain-t and unassigned techanvil Aug 29, 2024
@hussain-t hussain-t assigned techanvil and unassigned hussain-t Sep 5, 2024
techanvil added a commit that referenced this issue Sep 6, 2024
…uth-flow

Enhancement/#8154 - Implement the “Top content” metric handling OAuth flow
@techanvil techanvil removed their assignment Sep 6, 2024
@kelvinballoo
Copy link
Collaborator

QA Update ⚠️

Hi @hussain-t , in general the flow is working as described.

Analytics.update.loads.only.when.we.scroll.to.the.section.mov

But I have some UX concerns. ⚠️

ITEM 1:
After I click cancel, the OAuth error variant of the Error Modal does not display straightaway. It will not load until I scroll down to the tiles section.
Refer to as from 1 minute mark in the video.

I think we possibly need to anchor the scroll to that tile section so that the error modal appears straightaway.

wait.mov

ITEM 2:
This is linked to number 1. When I cancelled the flow, I go to the page where I see a 'Success' message. Again, you can refer to the 1 minute mark in the video above.
This is due to the success message initially but it just feels weird but maybe this will not be a concern if we auto scroll to the tiles section, if we decide to fix it that way for item 1.

@hussain-t
Copy link
Collaborator

Hi @kelvinballoo, those are valid UX concerns. However, they are out of the scope of the issue. Can you create a new issue to address them? Thanks!

@kelvinballoo
Copy link
Collaborator

QA Update ⚠️

Thanks @hussain-t . New ticket raised here : #9350

One thing to clarify from the AC:
The default OAuth error notice that Site Kit usually displays when the OAuth flow returns an error should not be shown.
Do you have a link to a reference of that default OAuth error notice? ⚠️
We are pretty much good, I just need a reference point to properly validate this.


Other than that, the following were verified good ✅

Given that the user does not have the Analytics edit scope:

  • Clicking on Update triggers the standard OAuth flow used in the plugin. On successful completion, the user is redirected back to the dashboard

    Update.works.mov
  • If an error is returned from the OAuth flow:

    • The OAuth error variant of the Error Modal is displayed. It follows the Figma design with the following copy:

      Title: Analytics update failed
      Description: Setup was interrupted because you did not grant the necessary permissions. Get help.

    • The Get help link opens the Analytics support page in a new tab, scrolled to the insufficient permissions section. The Cancel button should close the modal.

      Get.help.+.cancel.mov
      • The Retry button takes the user back to the OAuth flow to retry the flow.

        Analytics.update.loads.only.when.we.scroll.to.the.section.mov

@hussain-t
Copy link
Collaborator

Hi @kelvinballoo, the ErrorNotifications banner component will be displayed by default. You can refer to the ErrorNotifications storybook.

@hussain-t hussain-t removed their assignment Sep 13, 2024
@kelvinballoo
Copy link
Collaborator

QA Update ✅

Thanks for confirming @hussain-t . I can confirm, based on the AC, that the ErrorNotifications banner does not appear if there is an error.

The following were verified good and it's good to be moved to Approval.

Given that the user does not have the Analytics edit scope:

  • Clicking on Update triggers the standard OAuth flow used in the plugin. On successful completion, the user is redirected back to the dashboard ✅

    Update.works.mov
  • If an error is returned from the OAuth flow:

    • The OAuth error variant of the Error Modal is displayed. It follows the Figma design with the following copy: ✅

      Title: Analytics update failed
      Description: Setup was interrupted because you did not grant the necessary permissions. Get help.

    • The Get help link opens the Analytics support page in a new tab, scrolled to the insufficient permissions section. The Cancel button should close the modal. ✅

      Get.help.+.cancel.mov
      • The Retry button takes the user back to the OAuth flow to retry the flow. The default OAuth error notice that Site Kit usually displays when the OAuth flow returns an error does not appear. ✅

        Analytics.update.loads.only.when.we.scroll.to.the.section.mov

@kelvinballoo kelvinballoo removed their assignment Sep 13, 2024
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 P1 Medium priority Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

5 participants