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

AdSense stats/reporting fixes on the main dashboard

Open OisinOConnor opened this issue 7 years ago • 7 comments

Feature Description

Main dashboard screen:

Top Earning Pages panel (First image below)

Revenue -> change "Revenue" to “Earnings” for consistency. Should be in currency format. Currently in plain number format.

Earning panel (Second image below)

RPM -> change "RPM" to “Page RPM” for consistency. There is no trend (red/green arrows & change) showing up for RPM. Should be in same currency format as RPM. Total Earnings -> Trend number format does not match the currency format of the main number. Ad Impressions -> Trend number is missing.

Image2 Image1


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

Acceptance criteria

  • In the AdSense summary widget on the Site Kit dashboard:
    • The "RPM" label should be changed to "Page RPM".
  • In the AdSense "Top Earning Pages" widget on the Site Kit dashboard:
    • The "Revenue" column should have its label changed to "Earnings".
    • Each value in that column should be formatted with the currency.
  • In the AdSense "Performance by page over the last 28 days" widget on the AdSense module page:
    • The "Earnings" and "Page RPM" columns should be formatted as a currency instead of plain numerics (similar to above in the "Top Earning Pages" widget on the Site Kit dashboard).
  • These changes should be made to both the legacy version of the widgets as well as to the refactored versions.

Implementation Brief

  • Using assets/js/modules/adsense/components/dashboard/DashboardSummaryWidget.js, update the title of the first DataBlock from RPM to Page RPM.
  • Using assets/js/modules/adsense/components/dashboard/DashboardTopEarningPagesWidget.js and assets/js/modules/adsense/components/module/ModuleTopEarningPagesWidget/Table.js, update the title and tooltip of the second column of tableColumns from Revenue to Earnings.
  • Using assets/js/modules/analytics/components/dashboard/LegacyAnalyticsAdSenseDashboardWidgetTopPagesTable.js,
    • Query the AdSense data store to get the currency by using the getReport selector and passing EARNINGS as metrics. The currency value can be found in the headers array from the response.
    • Update the numFmt function of the Earnings and Page RPM column values to use the currency style and passing the currency value from the previous bullet point.
  • The changes from the previous bullet point should be applied to DashboardTopEarningPagesWidget and ModuleTopEarningPagesWidget to values which are currencies.

Test Coverage

  • N/A

Visual Regression Changes

  • Text changes for the above components should be noted.

QA Brief

You will need to enable widgets.dashboard and widgets.moduleScreens, and have an AdSense account linked.

Note that the legacy versions of the dashboard widgets only appear if you disable widgets.dashboard. However, both the legacy and new widgets will appear on the AdSense module screen if you enable widgets.moduleScreens.

Also note: The work for this ticket now includes the ACs from https://github.com/google/site-kit-wp/issues/576 I've tried to make this a bit simpler to follow by using a checklist below.

Dashboard

AdSense summary widget

  • The "RPM" label should be changed to "Page RPM".
    • [ ] Legacy version
    • [ ] Refactored version

AdSense "Top Earning Pages" widget:

  • the "Revenue" column should have its label changed to "Earnings".
    • [ ] Legacy version
    • [ ] Refactored version
  • the values in this column should be formatted with the currency
    • [ ] Legacy version
    • [ ] Refactored version

AdSense module page

'Performance by page over the last 28 days' widget

  • should now have the values in the 'Earnings' and 'Page RPM' columns formatted with a currency.
    • [ ] Legacy version (bottom of the page)
    • [ ] Refactored version (top of the page)

Changelog entry

  • Clarify some AdSense labels and format the monetary values in top earning pages tables with the relevant currency.

OisinOConnor avatar Oct 14 '19 14:10 OisinOConnor

I've defined the ACs for this issue focused on the wording and formatting changes only and opened a separate #3091 for adding the two additional change values (with the latter being only done for the refactored widget, since it's not worth investing the time in the legacy version that will soon be phased out).

felixarntz avatar Apr 05 '21 20:04 felixarntz

@felixarntz I added the IB which caters only for the text changes. For "Each value in that column should be formatted with the currency (related: #576, which does this on the AdSense module page).", @aaemnnosttv and I had a call to see whether it was possible or not, with the data being returned. Turns out that the response for the analytics request does not include the currency. image

This is in comparison to responses to AdSense requests where we do have the currency: image

One possible way of getting the currency is by querying the user profile and retrieve the currency from there: https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/profiles

Let me know what you think.

asvinb avatar Apr 09 '21 13:04 asvinb

@asvinb Good point; relying on the Analytics profile used sounds good to me. Since we already know that profileID currently used in SIte Kit, maybe we should add a GET:profile REST data point and getProfile( profileID ) selector to get that.

Alternatively, I'm also not opposed to using a simple AdSense report query to get that information, since that is something we can already get easily without adding a new endpoint. Since the widget is technically an AdSense widget anyway, it wouldn't be a problem relying on both the Analytics and AdSense APIs together.

felixarntz avatar Apr 09 '21 20:04 felixarntz

Sounds good @felixarntz . I think we can go the simple route, by running an AdSense report query. I've updated the IB to reflect that.

asvinb avatar Apr 13 '21 07:04 asvinb

IB ✅

aaemnnosttv avatar Apr 13 '21 08:04 aaemnnosttv

Update: I added the work from #576 to the QA brief after discussion with @felixarntz, because after having followed the IB here (which mentions ModuleTopEarningPagesWidget instead of DashboardTopEarningPagesWidget.js ) I realised I'd done some of the work from that issue. My PR now deals with both issues. For more context see the discussion on #576

johnPhillips avatar Apr 22 '21 11:04 johnPhillips

QA Update: Pass ✅

Verified:

Dashboard:

  • The "RPM" label is changed to "Page RPM" in both the legacy and refactored version.
  • The "Revenue" column has its label changed to "Earnings" in both the legacy and refactored version.
  • The values in this column is formatted with the currency, i.e. Euro in both the legacy and refactored version.

image

AdSense module page:

  • Now has the values in the 'Earnings' and 'Page RPM' columns formatted with a currency in both the legacy and refactored version.

image

wpdarren avatar May 04 '21 16:05 wpdarren