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

Show change values in AdSense summary widget

Open felixarntz opened this issue 5 years ago • 12 comments

Originally reported as part of #656: In the AdSense summary widget, only the "Total Earnings" value currently shows up with a change percentage. The "RPM" (or "Page RPM" as of #656) and "Ad Impressions" values should also have a change value.


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

Acceptance criteria

  • The AdSense summary widget on the dashboard should be updated as follows (only for the refactored version, i.e. DashboardSummaryWidget):
    • The change value displayed for the monetary earnings value should be the change value compared to the previous period, rather than the value of "today's" earnings.
    • There should be a change value displayed for the "RPM" / "Page RPM" metric: It should be the absolute change from the previous period value and should be formatted with the currency (similar to how it is for the "Total Earnings" change value, i.e. do not use percentage like we mostly do otherwise).
    • There should be a change value displayed for the "Ad Impressions" metric: Similar to the above, it should be the absolute change from the previous period value and it should be formatted without any unit (i.e. just the absolute difference, not a percentage).

Implementation Brief

  • Using assets/js/modules/adsense/components/dashboard/DashboardSummaryWidget.js,
    • Get the compareStartDate and comparedEndDates to be used for querying the data for the previous period by passing compare: true to the getDateRangeDates selector.
    • Get a report for the previous period with the same metrics as periodArgs and set startDate and endDate to compareStartDate and compareEndDate respectively.
    • ~~Use the calculateChange function from assets/js/util/index.js, to calculate the changed values between the current period and previous period reports data and pass the value as the change prop of each DataBlock component.~~
    • The changeDataUnit prop should be the currency for the first 2 DataBlock components and metric for the last one.

Test Coverage

  • N/A

Visual Regression Changes

  • Visual changes to the DashboardSummaryWidget component.

QA Brief

  • Make sure you have the widgets.dashboard feature enabled, and have Analytics and AdSense set up.
  • Go to the Site Kit dashboard and scroll down to the DashboardSummaryWidget. This is the one under the Earnings heading that sits on the left hand side, with the spark lines.
  • All three values should now display a 'change' (i.e. with up/ down arrow) if the values have changed.
  • Page RPM and Earnings should show 'change' with currency units (e.g. Dollar sign).

Changelog entry

  • Update AdSense summary dashboard widget to show change values for each metric relative to the previous period.

felixarntz avatar Apr 05 '21 20:04 felixarntz

@felixarntz @aaemnnosttv I had a look at the current implementation for the "Total Earnings" changed values. Turns out that we are not showing the changed value compared to the previous period, but showing the value for the current day, which is something I think is misleading unless it was intentional. I've added the IB where instead of showing the value of the current day as changed value, we calculate the it based on the reports from the current and previous periods.

Let me know if am missing anything. Thanks!

asvinb avatar Apr 15 '21 13:04 asvinb

@asvinb I think that was intentional, but I agree that it isn't clear since it isn't labelled as such anywhere. Not sure if there is an easy fix for that which fits in the current design. Maybe just prefixing it with Today: {earnings}

The change arrow there is also a bit redundant since it would never be negative (I hope? 😆 )

Thoughts @felixarntz ?

aaemnnosttv avatar Apr 16 '21 08:04 aaemnnosttv

Good catch @asvinb! I think we should change this then to also refer to the previous period, like we have elsewhere in the dashboard. Daily values can be still found in the AdSense module page. I've added a point for this in the ACs.

felixarntz avatar Apr 16 '21 19:04 felixarntz

Thanks @felixarntz . @aaemnnosttv Can you review the IB? thanks!

asvinb avatar Apr 19 '21 16:04 asvinb

@aaemnnosttv One more follow-up response from me:

The change arrow there is also a bit redundant since it would never be negative

Makes sense. However I think we should keep this for consistency for now; let's revisit that separately at some point.

felixarntz avatar Apr 19 '21 17:04 felixarntz

IB ✅

Regarding the estimate, it can probably fit in 3 but I feel like we should give it a little more to be on the safe side; bumping to 7.

aaemnnosttv avatar Apr 22 '21 07:04 aaemnnosttv

@asvinb just regarding this:

The changeDataUnit prop should be the currency for the first 2 DataBlock components and metric for the last one

Aren't the values returned by calculateChange percentages? I will just do the absolute change by subtracting one from the other 👍

johnPhillips avatar Apr 22 '21 14:04 johnPhillips

Aren't the values returned by calculateChange percentages?

I will just do the absolute change by subtracting one from the other 👍

@johnPhillips yes you're right, we want absolute values, as noted in the ACS. Thanks for pointing that out!

aaemnnosttv avatar Apr 23 '21 05:04 aaemnnosttv

@johnPhillips would you please add a QA Brief?

aaemnnosttv avatar Apr 30 '21 20:04 aaemnnosttv

QA Update: Pass ✅

Verified:

  • All three values now display a 'change' (i.e. with up/ down arrow) if the values have changed.
  • Page RPM and Earnings show 'change' with currency units (e.g. Euro).

image

wpdarren avatar May 04 '21 14:05 wpdarren

Pulling this back for a quick follow up as there is now a prop type warning in the console related to a change I made.

image

Edit: wrong component shown above the devtools, but correct warning.

aaemnnosttv avatar May 05 '21 15:05 aaemnnosttv

QA ✅

Prop type warning no longer shows

image

aaemnnosttv avatar May 05 '21 15:05 aaemnnosttv