-
Notifications
You must be signed in to change notification settings - Fork 330
Closed
Labels
P0High priorityHigh priorityTeam SIssues for Squad 1Issues for Squad 1Type: EnhancementImprovement of an existing featureImprovement of an existing feature
Description
Feature Description
This component will be rendered within the Site Kit admin settings area when the Analytics module is not connected to encourage admins to connect this module in order to add additional datapoints to report emails. This is a warning notice rather than a requirement for the feature activation because Search Console data can still be included if the Analytics module is connected.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- A new notice is created within the admin settings area when the Analytics module is disconnected - this is distinct to when Analytics was never set up in the first place - updates to module data tracking may be required to detect this state.
- The notice can be dismissed
- The
Connect AnalyticsCTA takes the user to the Analytics setup form
- New flag is introduced in the DB to distinguish if Analytics module has been already activated
Implementation Brief
- Introduce a lightweight tracker setting
Core\Email_Reporting\Analytics_Activation_Statethat sets thegooglesitekit_analytics_ever_connectedoption- You can omit
get_defaultmethod, as it will returnfalseby default, inheriting it from baseSettingclass
- You can omit
- Update
includes/Core/Email_Reporting/REST_Email_Reporting_Controller.php- Instantiate
Analytics_Activation_Statesetting in constructor and set it to the class property - In
get_rest_routesadd new routeGET:analytics-activation-statewhich returns the value of theAnalytics_Activation_Statesetting
- Instantiate
- In
Google\Site_Kit\Core\Email_Reporting\Email_Reporting::register()- Invoke
on_changemethod onAnalytics_Activation_Statesetting instance and whenpropertyID,accountID,webDataStreamIDandmeasurementIDkeys of$new_valuearray are not empty - update the settinggooglesitekit_analytics_ever_connectedtotrueif not already set.
- Invoke
- Update
assets/js/googlesitekit/datastore/site/email-reporting.js- Add a fetch store to retrieve the value from
GET:analytics-activation-state - Add selector/resolver
hasEverActivatedAnalyticsto resolve/read the value from the fetch store
- Add a fetch store to retrieve the value from
- Add
assets/js/components/email-reporting/AnalyticsDisconnectedSettingsNotice.js- Render
Noticewhen:- Analytics module is not connected (use
isModuleConnectedselector fromCORE_MODULESdatastore) hasEverActivatedAnalyticsselector returnstrue- Notice was not dismissed (eq
select( CORE_USER ).isItemDismissed( 'analytics-email-reporting-notice' ) === false)
- Analytics module is not connected (use
- Match the copy and design with the one in Figma and CTA's behaviour describe in the AC
- Use
useActivateModuleCallbackforConnectCTA to trigger the module activation and navigation to the setup screen
- Use
- Render
- Include the new notice to the
assets/js/components/settings/SettingsEmailReporting.jsafterManage email reports subscriptionlink
Test Coverage
- Add test coverage for the new settings notice and
hasEverActivatedAnalyticsresolver/selector within existing datastore tests
QA Brief
- On a site where analytics is not connected, turn the
proactiveUserEngagementfeature flag on, then turn on the Email Reporting feature in the Admin Settings. - Verify that there is no notice.
- Now connect Analytics and verify that there is still no notice in the Admin Settings within the Email Reporting card.
- Now disconnect Analytics and verify that the notice appears. Verify that it is dismissed as per the AC.
- To make it appear again, remove the dismissed-items row in user_meta in the DB and refresh the Admin Settings panel. Verify that the Connect analytics CTA works as per the AC.
Changelog entry
- Detect if Analytics has previously been connected when displaying certain notices in the Email Reporting notices.
Metadata
Metadata
Assignees
Labels
P0High priorityHigh priorityTeam SIssues for Squad 1Issues for Squad 1Type: EnhancementImprovement of an existing featureImprovement of an existing feature