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

Update popularity listing on main dashboard

Open bjackson27 opened this issue 7 years ago • 5 comments

Query by clicks, add a column with clicks data (keep impressions too) and order them by clicks.

@ThierryA @felixarntz I think we need to discuss this one a bit more but spinning up the ticket to make sure it doesn't get forgotten.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The Popularity widget table on the Site Kit dashboard shows a Clicks column, on the left side of the Impressions column.
  • Keywords in the Popularity widget table are sorted by clicks, descending.

Implementation brief

  • Remove Search Console datapoint search-keywords-sort-by-impressions.
  • In the case for the remaining datapoints, remove everything but https://github.com/google/site-kit-wp/blob/develop/includes/Modules/Search_Console.php#L496 (no longer manually sort by impressions). This is okay to do because the other datapoints than search-keywords were accidentally changed to also be sorted by impressions and can easily be changed back to be sorted by clicks (default) without user-facing effects.
    • sc-site-analytics is only called for dashboard areas where sorting is irrelevant for how the data is displayed (data block with only totals, line chart).
    • page-analytics is only called in one place, where it's used for a data block with only totals. Actually that datapoint appears to be doing exactly the same as sc-site-analytics, so I'd suggest removing it entirely.
    • index-status is not used at all, but let's not remove it for now - we can revisit that.
  • Use search-keywords-sort instead of search-keywords-sort-by-impressions in https://github.com/google/site-kit-wp/blob/develop/assets/js/modules/search-console/dashboard/dashboard-widget-popular-keyword-table.js#L111.
  • Add a "Clicks" column below https://github.com/google/site-kit-wp/blob/develop/assets/js/modules/search-console/dashboard/dashboard-widget-popular-keyword-table.js#L66, using the existing definition from https://github.com/google/site-kit-wp/blob/develop/assets/js/modules/search-console/dashboard/dashboard-widget-keyword-table.js#L42 (which is used on Search Console module page).
  • For reference, https://developers.google.com/webmaster-tools/search-console-api-original/v3/searchanalytics/query (results are always sorted by Clicks, which cannot be adjusted).

Changelog entry

  • Show Clicks in the plugin dashboard's Popularity listings and sort the table by them.

bjackson27 avatar Jun 26 '19 18:06 bjackson27

Implementation brief review: since Search Console API results sorted by click count descending, there isn't need to query more rows and hack the ordering which we are currently doing. We can get rid of the current hack, render a clicks column and simply query the top 10 results.

ThierryA avatar Aug 12 '19 12:08 ThierryA

@adamsilverstein Do you happen to have any background on why page-analytics exists? It appears to do exactly the same as sc-site-analytics. Same about index-status, it doesn't appear to be used at all? Was it at some point, what was this datapoint meant for?

felixarntz avatar Aug 12 '19 13:08 felixarntz

As you mentioned, page-analytics and sc-site-analytics are currently duplicates, I agree we can safely remove one now.

I did a little git spelunking and found that originally these were two separate similar but distinct data points - one for site wide data and one for page URL specific data:

image

adamsilverstein avatar Aug 12 '19 14:08 adamsilverstein

QA ✅

felixarntz avatar Aug 28 '19 09:08 felixarntz

This overall LGTM. Will only note that when all clicks are 0 it looks slightly weird, but is technically correct. We can consider an alternative display down the road if users get confused.

Screenshot 2019-08-28 at 13 59 02

marrrmarrr avatar Aug 28 '19 12:08 marrrmarrr