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

Add the Settings Section toggle switch variant and hook up the setting to toggle the Audiences Widget Area on/off #8177

Closed
2 tasks done
techanvil opened this issue Jan 25, 2024 · 6 comments
Labels
Module: Analytics Google Analytics module related issues P1 Medium priority Type: Enhancement Improvement of an existing feature

Comments

@techanvil
Copy link
Collaborator

techanvil commented Jan 25, 2024

Feature Description

Add the Settings Section toggle switch variant and hook up the setting to toggle the Audiences Widget Area on/off.

See Settings section in the design doc.


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

Acceptance criteria

  • A toggle switch is implemented in the Settings Section under the Admin Settings tab, below the Key Metrics section.
  • The toggle switch controls the visibility of the Audiences Widget Area.
  • The setting is persistent through the POST audience-settings endpoint and reflects the current state of the Audiences Widget Area visibility.
  • The feature aligns with the guidelines in the design doc and the Figma design.

Implementation Brief

  • Add assets/js/modules/analytics-4/components/settings/AudienceSegmentation/SettingsVisitorGroups.js
    • Use assets/js/components/settings/SettingsPlugin.js as a starting point
    • Replace Checkbox component with Switch component
    • Apply styling and text as outlined in design doc and figma linked in AC
    • In the onChange callback, save the settings using the setAudienceSegmentationWidgetHidden action and check for the value using isAudienceSegmentationWidgetHidden action, implemented in 7176,
  • Update assets/js/components/settings/SettingsAdmin.js
    • After
      { showKeyMetricsSettings && (
      <Cell size={ 12 }>
      <SettingsCardKeyMetrics />
      </Cell>
      ) }
      Check if analytics-4 module is active, using isModuleActive selector on CORE_MODULES datastore, and if audienceSegmentation feature flag is enabled to render SettingsVisitorGroups component wrapped with <Cell size={ 12 }> component

Test Coverage

  • Add tests for SettingsVisitorGroups component, ensuring the switch's actions send the events mentioned in the description/ACs

QA Brief

  • Ensure the Analytics module is connected.
  • Ensure the Audience Segmentation feature flag is enabled via the tester plugin.
  • Navigate to the Settings page -> Admin Settings and verify the Visitor groups section with the toggle switch is displayed under the Key Metrics section.
  • Verify the toggle switch is functional and toggles the visibility of the Audiences Widget Area.
  • Verify the setting is persistent through the POST audience-settings endpoint.
  • Go to the browser's Network tab and check the POST request for audience-settings when toggling the switch.
  • Once merged, verify this story.

Changelog entry

  • Add a settings toggle for Audience Segmentation.
@techanvil techanvil added Module: Analytics Google Analytics module related issues P1 Medium priority Type: Enhancement Improvement of an existing feature labels Jan 25, 2024
@hussain-t hussain-t assigned hussain-t and unassigned hussain-t Jan 29, 2024
@eugene-manuilov eugene-manuilov self-assigned this Jan 30, 2024
@eugene-manuilov
Copy link
Collaborator

AC ✔️

@eugene-manuilov eugene-manuilov removed their assignment Jan 30, 2024
@zutigrm zutigrm assigned zutigrm and unassigned zutigrm Jan 30, 2024
@tofumatt tofumatt self-assigned this Jan 31, 2024
@tofumatt
Copy link
Collaborator

IB ✅

@tofumatt tofumatt removed their assignment Jan 31, 2024
@techanvil
Copy link
Collaborator Author

Hey @zutigrm, as mentioned on Slack I've added a code organization section to the design doc to help keep us aligned.

The upshot is that we should create this new SettingsVisitorGroups in the assets/js/modules/analytics-4/components/settings/AudienceSegmentation/ folder.

It's also worth noting that the audience settings will only be available if analytics-4 is active so we should make that a condition for displaying the settings section.

Please can you update the IB accordingly?

@zutigrm zutigrm assigned techanvil and unassigned zutigrm Feb 5, 2024
@techanvil
Copy link
Collaborator Author

Thanks for the update @zutigrm, IB LGTM! ✅

@techanvil techanvil removed their assignment Feb 5, 2024
@hussain-t hussain-t self-assigned this Mar 23, 2024
@hussain-t hussain-t removed their assignment Mar 25, 2024
@tofumatt tofumatt self-assigned this Mar 28, 2024
tofumatt added a commit that referenced this issue Mar 28, 2024
…itors-group

Enhance/#8177 - Add the settings section toggle switch for audience segmentation widget area visibility
@tofumatt tofumatt removed their assignment Mar 28, 2024
@wpdarren wpdarren self-assigned this Mar 29, 2024
@wpdarren
Copy link
Collaborator

QA Update: ✅

Verified:

  • On the Settings page, the Visitor groups section with the toggle switch is displayed under the Key Metrics section.
  • The toggle switch is functional and toggles the visibility of the Audiences Widget Area.
  • The setting is persistent through the POST audience-settings endpoint.
  • The POST request for audience-settings when toggling the switch.
  • This story loads and behaves correctly.
Screenshots

image
image

@wpdarren wpdarren removed their assignment Mar 29, 2024
@aaemnnosttv
Copy link
Collaborator

⚠️ I noticed a misspelling which should be fixed but can happen in a follow-up #8424 (review)

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

No branches or pull requests

7 participants