site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Single page stats: show informative message when there's not enough queries to display

Open marrrmarrr opened this issue 7 years ago • 7 comments

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: Screenshot 2019-07-18 at 19 21 27

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.

marrrmarrr avatar Jul 19 '19 12:07 marrrmarrr

Implementation brief looks good!

felixarntz avatar Aug 12 '19 11:08 felixarntz

@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 avatar Aug 15 '19 11:08 aaemnnosttv

@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?

felixarntz avatar Aug 16 '19 15:08 felixarntz

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 avatar Aug 16 '19 15:08 aaemnnosttv

@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 avatar Aug 27 '19 10:08 felixarntz

@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.

aaemnnosttv avatar Aug 27 '19 11:08 aaemnnosttv

Tested

Confirmed search console was connected to my local, having no queries to display.

image

Checked dashboard:

image

Confirmed search console tab

image

Confirmed front page drop down

image

Passed QA ✅

cole10up avatar Feb 27 '20 03:02 cole10up