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 new audience settings store. #10154

Closed
3 tasks done
benbowler opened this issue Feb 3, 2025 · 3 comments
Closed
3 tasks done

Add the new audience settings store. #10154

benbowler opened this issue Feb 3, 2025 · 3 comments
Labels
Feature: Audiences Module: Analytics Google Analytics module related issues P2 Low priority Team M Issues for Squad 2 Type: Bug Something isn't working

Comments

@benbowler
Copy link
Collaborator

benbowler commented Feb 3, 2025

Feature Description

Issue 2/3 to fix the bug #8888.

Add the new audience settings store, but don't integrate it into the Analytics store. Write tests just for the store slice.


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

Acceptance criteria

Implementation Brief

Create isolated, tested, audiences settings store.

Note: this ticket should not integrate this settings store into the analytics module, this work will be done in #8888.

  • Update assets/js/googlesitekit/datastore/user/audience-settings.js:

    • Update the name of these selectors and actions where they are defined:
      • getAudienceSettings to getUserAudienceSettings
      • saveAudienceSettings to saveUserAudienceSettings
      • resetAudienceSettings to resetUserAudienceSettings
      • isSavingAudienceSettings to isSavingUserAudienceSettings
  • Update the name of these selectors and actions everywhere they are used in the current codebase.

  • Create a new store file assets/js/modules/analytics-4/datastore/audience-settings.js:

    • Implement a new fetch store using createFetchStore:
    • Implement a new fetch store using createFetchStore:
      • The controlCallback should use API.set to send POST requests to POST:save-audience-settings.
        • Implement new setAvailableAudiences, setAudienceSegmentationSetupCompletedBy and saveAudienceSettings actions.

Test Coverage

  • Create thorough tests for this new settings store.

QA Brief

Changelog entry

  • Add a datastore slice with actions and selectors for retrieving and updating the new set of audience settings.
@techanvil
Copy link
Collaborator

techanvil commented Feb 5, 2025

Hey @benbowler, the IB is looking good. A couple of points:

  • Update assets/js/modules/analytics-4/datastore/audiences.js:
    • Update references of the following user scoped selectors and actions to make them distinct from the new site level audience selectors/actions:
      • getAudienceSettings to getUserAudienceSettings
      • saveAudienceSettings to saveUserAudienceSettings
      • resetAudienceSettings to resetUserAudienceSettings
      • isSavingAudienceSettings to isSavingUserAudienceSettings

I'd suggest we take it further than this, and rename these where they are defined in assets/js/googlesitekit/datastore/user/audience-settings.js, and in their usage throughout the codebase. This will help keep to reduce the chances of confusion with the new module-level audience settings we're defining.

  • Implement a new fetch store using createFetchStore:
    • The controlCallback should use API.get to send GET requests to GET:audience-settings.
    • Implement a resolver and the following selectors to get fetching from this endpoint:
      • getAvailableAudiences
      • getAudienceSegmentationSetupCompletedBy
  • Implement a new fetch store using createFetchStore:
    • The controlCallback should use API.set to send POST requests to POST:save-audience-settings.
      • Implement a resolver and a new setAudienceSegmentationSetupCompletedBy action.

The IB seems to suggest adding these to assets/js/modules/analytics-4/datastore/audiences.js, but as this slice is already integrated this will conflict with the existing getAvailableAudiences() / getAudienceSegmentationSetupCompletedBy() selectors.

I'd suggest creating a new file for these datastore additions, assets/js/modules/analytics-4/datastore/audience-settings.js.

Also please consider if any additional actions would be needed e.g. I think we'll want saveAudienceSettings().

@techanvil techanvil removed their assignment Feb 5, 2025
@benbowler benbowler assigned techanvil and unassigned benbowler Feb 10, 2025
@techanvil
Copy link
Collaborator

IB ✅

@techanvil techanvil removed their assignment Feb 11, 2025
@ankitrox ankitrox self-assigned this Feb 24, 2025
@ankitrox ankitrox removed their assignment Feb 27, 2025
@techanvil techanvil assigned techanvil and ankitrox and unassigned techanvil Feb 27, 2025
@ankitrox ankitrox removed their assignment Feb 28, 2025
@hussain-t hussain-t assigned hussain-t and unassigned hussain-t Mar 3, 2025
@techanvil techanvil assigned techanvil and unassigned techanvil Mar 3, 2025
@kelvinballoo kelvinballoo self-assigned this Mar 4, 2025
@kelvinballoo
Copy link
Collaborator

QA Update ✅

Performed smoke test on Audience Segmentation and it's looking good.
No issues seen.

Screen.Recording.2025-03-04.at.15.23.07.mov
10154.-.AS.2.ok.mov

@kelvinballoo kelvinballoo removed their assignment Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Audiences Module: Analytics Google Analytics module related issues P2 Low priority Team M Issues for Squad 2 Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants