Add the “New” badges to the Selection Panel
Feature Description
Add the "New" badge to new audiences in the Selection Panel.
See selection panel, audience creation > "New" badges", and "New" badges in the design doc.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When an audience is initially created, it should have a “New” badge shown next to the audience title in the Selection Panel.
- The badge should be shown to a user for 28 days from the first time the badge is viewed.
- This applies both to audiences created by Site Kit, and those added directly in Analytics.
- The badge should be displayed as per the Figma design.
Implementation Brief
Note: This should make use of the "expirable items" API introduced via #8168.
- [ ]
Test Coverage
QA Brief
Changelog entry
Looks like this is also blocked by a tile like #8136 being implemented, because adding a relatively concrete IB here isn't possible until those components are implemented so we know where they'll go. I looked through all of the issues to see if anything was moved along enough to add a good IB here but not yet, so I've added #8136 as another blocker to making the IB 🤔
Hey @benbowler, while reviewing the IB here I've realised I left an important detail out of the AC.
The "New" badges should only appear for audiences which have been created subsequent to the initial setup for the current user.
The implication is we should expire the corresponding "New" badge items for the list of audiences in configuredAudiences once they have been successfully saved in the enableAudienceGroup() action
It further implies we should do the same thing once configuredAudiences has been saved as part of the setup for a secondary user. This is being specced in https://github.com/google/site-kit-wp/issues/8130, as a result I've added that issue as a dependency for this one.
Apologies for the lack of clarity in the AC. I've amended it accordingly - please take a look.
Further to the above, here are a couple of additional points for this IB:
- The following point can be removed, as we do want to display a "New" badge for these audiences if a user has created them via the CTA in the Selection Panel. Also, please note as a general point, and as per my comment on #8160, we don't want to be identifying these audiences via a string comparison of their
displayNameas the display name is mutable.
- [ ] Also, prevent the badge from being rendered if the the title is either of the pre-defined audiences "All visitors" or "Returning visitors" using simple string comparison.
- A trivial one, but I'd consider a slight simplification of the expirable item ID. Rather than
audience-selector-new-audience-expirable-new-badge-${slug}which contains "new" twice, the repetition of which feels somewhat redundant, how aboutaudience-selection-panel-expirable-new-badge-${slug}?
Thanks @benbowler. The IB LGTM :white_check_mark:
Please note, I made a small tweak to remove the reference to enableAudienceGroup() for the secondary users aspect, as I don't think we will end up using this action for secondary users, rather we'll extract part of it to a new action and use that.
Note that I've further updated the IB in response to the observations made here, https://github.com/google/site-kit-wp/issues/9096#issuecomment-2289159282, as the generic Selection Panel should indeed not know anything about audiences.
QA Update ⚠️
Hi @nfmohit , is there a fast way to test the AC point The badge should be shown to a user for 28 days from the first time the badge is viewed. ?
I did not see the steps in the QAB for that specifically.
- Is that controlled through a cookie or something for me to verify the expiry date?
- Or I should be waiting for 28 days to verify it?
Other than that, the rest was verified good ✅
-
The initial selection of audiences does not have "New" badges applied.
-
When an audience is initially created in analytics, it has a “New” badge shown next to the audience title in the Selection Panel after reloading the SK dashboard.
https://github.com/user-attachments/assets/1a0a2962-6571-40b0-83e4-ca27f98889df
-
This also applies to audiences created by Site Kit (New and Returning visitors) that are created and added directly to Analytics
https://github.com/user-attachments/assets/950cc6ca-d542-49d7-b27a-82ab001c9b95
@kelvinballoo Added a new section in the QAB, please let me know if that works for you, thanks!
QA Update ⚠️
Thanks for the script @nfmohit .
ITEM 1: I tested this and after running the script, the 'New' badge for the audience selection for 'New visitors' and 'Returning visitors' are gone. However, there was still a 'New' badge for my created audience. I would assume this should also disappear?
Screen recording available below:
https://github.com/user-attachments/assets/b2060d37-21f8-4de9-941e-3c48f312129b
ITEM 2: Are we supposed to hide the 'New' badge at the top of the tiles also or that would be part of a different ticket? Details added below.
QA Update ✅
Noted on item 2 that we are only checking on the badge inside the selection panel. I've set up a thread in Slack to check if it's being handled or should in fact be.
Item 1 was tested good with the new script for the 28 day scenario and it's working fine:
https://github.com/user-attachments/assets/5e8fe27b-d407-4a88-bc71-2248e7e786b8
Other than that, the rest was verified good ✅ Moving ticket to approval
-
The initial selection of audiences does not have "New" badges applied.
-
When an audience is initially created in analytics, it has a “New” badge shown next to the audience title in the Selection Panel after reloading the SK dashboard.
https://github.com/user-attachments/assets/1a0a2962-6571-40b0-83e4-ca27f98889df
-
This also applies to audiences created by Site Kit (New and Returning visitors) that are created and added directly to Analytics
https://github.com/user-attachments/assets/950cc6ca-d542-49d7-b27a-82ab001c9b95