Single page stats: show informative message when there's not enough queries to display
Feature Description
In the single page stats view, sometimes queries won't be displayed because there is either not enough information aggregated or the total number of queries is below the privacy threshold.
Right now, we show just the title of the section and no explanation:

Let's add a message explaining to users why they're not seeing anything in this case, similar to what we show in the main dashboard: "Search Console gathering data"
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When there is not enough information to display query examples for a specific page, show "Search Console gathering data message" instead of an empty table.
Implementation Brief
Move data check from SearchConsoleDashboardWidgetKeywordTable@render() to the isZeroData argument (5th parameter) to withData.
diff --git a/assets/js/modules/search-console/dashboard/dashboard-widget-keyword-table.js b/assets/js/modules/search-console/dashboard/dashboard-widget-keyword-table.js
index 23648bd..e186929 100644
--- a/assets/js/modules/search-console/dashboard/dashboard-widget-keyword-table.js
+++ b/assets/js/modules/search-console/dashboard/dashboard-widget-keyword-table.js
@@ -32,10 +32,6 @@ class SearchConsoleDashboardWidgetKeywordTable extends Component {
render() {
const { data } = this.props;
- if ( ! data || ! data.length ) {
- return null;
- }
-
const headers = [
{
title: __( 'Keyword', 'google-site-kit' ),
@@ -96,5 +92,6 @@ export default withData(
},
],
<PreviewTable padding />,
- { createGrid: true }
+ { createGrid: true },
+ ( returnedData ) => ! returnedData.length,
);
! returnedData is not necessary as this check is already done as part of withData before isZeroData is called.
withData will then automatically render the proper noData component in the place of the SearchConsoleDashboardWidgetKeywordTable.
Changelog entry
- Display information about lack of data instead of displaying empty top search queries box.
Implementation brief looks good!
@felixarntz would it be better perhaps to move this logic to the isDataZero callback for withData here?
https://github.com/google/site-kit-wp/blob/b1c57aee1f32921533b8f081f63fcfccae8cc432/assets/js/modules/search-console/dashboard/dashboard-widget-keyword-table.js#L83-L98
Also, just wanted to confirm that we want to render the no data component within the wrapping widget layout in between the header/footer?

@aaemnnosttv Yes to your first question, that suggestion totally makes sense! Can you update the implementation brief accordingly with this detail?
On the second one, can you chime in @marrrmarrr?
I can, update the IB of course, but that depends on @marrrmarrr I think as this logic would need to move if the header/footer elements should not be displayed.
@aaemnnosttv Talked through this with @marrrmarrr, let's keep the IB as is and just display the blue CTA inside the white box (between header and footer). ✅
@felixarntz I moved this back to review as I think this is the correct change to make according to what you confirmed with Mariya. The header & footer will still be displayed as these are added in the wrapping DashboardDetailsWidgetKeywordsTable.
Tested
Confirmed search console was connected to my local, having no queries to display.

Checked dashboard:

Confirmed search console tab

Confirmed front page drop down

Passed QA ✅