-
Notifications
You must be signed in to change notification settings - Fork 329
Closed
Labels
P0High priorityHigh priorityTeam MIssues for Squad 2Issues for Squad 2Type: EnhancementImprovement of an existing featureImprovement of an existing feature
Description
Feature Description
Add the "activate Analytics” notification.
See the Figma design, and the activate Analytics notification section in the Design Doc.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When the user completes the setup flow without connecting Analytics and lands on the dashboard, a notification appears at the top of the dashboard.
- The notification matches the Figma design, with the following copy:
- Title: Understand how visitors interact with your content
- Description: Get a deeper understanding of your customers. Google Analytics gives you the free tools you need to analyze data for your business in one place.
- The notification includes the following buttons:
- Set up Analytics
- When clicked, the user is redirected to the Analytics module setup screen.
- Maybe later
- This will dismiss the notification.
- Set up Analytics
- When dismissed, the notification reappears after a delay of two weeks, up to two times.
- On the final showing, the dismissal button's label is Don’t show again, and clicking it permanently dismisses the notification.
- Each time the banner is dismissed a tooltip appears, pointing to the Settings admin menu item, with the following copy (see Figma):
- Content: You can always set up Analytics from Settings later
- Button label: Got it
- The notification is not shown if Search Console is in the gathering data state.
- The notification is not shown for view-only users.
- The notification is only shown when the
setupFlowRefreshfeature flag is enabled.
See the implementation guide in the Design Doc for guidelines on how to implement this issue.
Implementation Brief
- Export the graphic for the notification from Figma and save it as
assets/svg/graphics/activate-analytics-notification-graphic.svg. - Create the
ActivateAnalyticsNotificationcomponent inassets/js/components/notifications/ActivateAnalyticsNotification.tsx.- Follow the pattern of other notifications in the
assets/js/components/notificationsdirectory, using theBannerNotificationlayout. - Use
LearnMoreLink.tsxas a reference for typing the component's props. Note that we don't need to definepropTypesfor TS components. - Call
useActivateModuleCallback()to get theactivateAnalytics()callback. - Use this logic from the
ActivateAnalyticsCTAcomponent to determine theinProgressstate (consider extracting it to a reusable hook). - Pass the
activateAnalytics()callback to theonClickproperty of thectaButtonprop. - Pass the
inProgressstate to thedisabledandinProgressproperties of thectaButtonprop. - Use this configuration from the
ConsentModeSetupCTABannercomponent for the dismissal properties of thectaButtonprop. - Call
useShowTooltip()with the appropriate arguments to get theshowTooltip()callback. - Use this configuration from the
ConsentModeSetupCTABannercomponent for thedismissButtonprop.
- Follow the pattern of other notifications in the
- In
assets/js/googlesitekit/data-requirements/index.js:- Add utility functions
requireCanActivateModule()andrequireModuleGatheringData(), following the pattern of similar functions in the file.
- Add utility functions
- In
assets/js/googlesitekit/notifications/register-defaults.js:- Register the
ActivateAnalyticsNotificationcomponent with the following configuration:priority:PRIORITY.SETUP_CTA_HIGHareaSlug:NOTIFICATION_AREAS.HEADERviewContexts:[ VIEW_CONTEXT_MAIN_DASHBOARD ]isDismissible:truedismissRetries:2featureFlag:'setupFlowRefresh'checkRequirements: UseasyncRequireAll(),asyncRequire(), and the following utility functions to implement the conditions for showing the notification as per the AC.requireModuleConnected()requireModuleGatheringData()requireCanActivateModule()
- Register the
- If any additional styling is needed, add it to
assets/sass/components/dashboard/_googlesitekit-activate-analytics-notification.scss.
Test Coverage
- Add a story and VRT for the
ActivateAnalyticsNotificationcomponent. - Add tests for the
ActivateAnalyticsNotificationcomponent. - Add tests for the
requireCanActivateModule()andrequireModuleGatheringData()utility functions.
QA Brief
- Set up Site Kit with the
setupFlowRefreshfeature flag enabled. Don't connect Analytics. - When landing on the Site Kit dashboard, dismiss the "Congrats on completing the setup for Site Kit!" notification (this won't be shown once Ensure the Site Kit setup notification is not shown when the Welcome modal is present. #11819 has been implemented).
- Verify that the "activate Analytics" notification appears as per the AC.
- To test the reappearance of the notification it's necessary to update values in the database. Having clicked Maybe later to dismiss the notification:
- Look up the row in the
{prefix}_usermetatable wheremeta_keyis{prefix}_googlesitekitpersistent_dismissed_prompts. - Verify that the
expirestimestamp for theactivate-analytics-ctaentry is set to two weeks from the current unix timestamp, andcountis1. - Edit the row and set the
expirestimestamp to the current unix timestamp to simulate the time having passed. - Refresh the page, and the notification should reappear.
- Click on Maybe later and check the same row in the
usermetatable. - Verify that the
expirestimestamp is set to two weeks from the current unix timestamp, and nowcountis2. - Edit the row and set the
expirestimestamp to the current unix timestamp again. - Refresh the page, and the notification should reappear, this time with the Don't show again dismissal button.
- Click the button and check the same row in the
usermetatable. - Verify that the
expirestimestamp is set to0(this indicates a permanent dismissal), andcountis3.
- Look up the row in the
Changelog entry
- Add the Analytics activation notification that prompts users to activate Analytics after completing Site Kit setup.
Metadata
Metadata
Assignees
Labels
P0High priorityHigh priorityTeam MIssues for Squad 2Issues for Squad 2Type: EnhancementImprovement of an existing featureImprovement of an existing feature