Module Stats widget charts are inconsistent across modules
Bug Description
Looking at the widget-based versions of "Stats" component charts, I noticed a few inconsistencies across them which we should address.
Search Console
AdSense
Analytics

Inconsistencies
Chart Width
- After merging https://github.com/google/site-kit-wp/pull/3078, charts for Search Console and AdSense have consistent dimensions
- The Analytics chart is now the one that stands out as different at this viewport size
- Overall it's very wide, but also looks like it goes a little too far to the right
- Attention should be paid to how these look in mobile as well which seems to differ (or at least require some customization) to allow for enough space for y-axis labels (for all available choices) in smaller viewports
Overview
- AdSense has no gap/padding around the overview and is flush against the widget header and sides as a result.
This is most obvious by looking at the blue bar
With other issues improving consistency (such as limiting the selected stats to 1) it seems like maybe we can extract a new component or two that all of the module-specific versions use internally to avoid duplication, and the inconsistency that comes with it. If the charts can mostly use the same options, then we should probably use a common component for these parts.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The graphs on the Search Console, AdSense, and Analytics module pages should be visually aligned (refactored widget-based version only), with the Analytics graph mostly serving as the reference that the other two should be updated to follow. Particularly:
- The AdSense graph should receive the same spacing above the big numbers as Analytics and Search Console have (spacing between the blue "selected" indicator and the widget header).
- The Search Console and AdSense graphs should have no extra spacing around them, they should only have the regular widget body padding the same way that the Analytics graph has, plus consistent spacing needed on the left side only to allow for the y-axis labels.
- All three of these graphs should be adjusted to use smooth lines instead of hard corners, similar to the graph in the new All Traffic widget on the Site Kit dashboard.
Implementation Brief
- update the
.googlesitekit-adsense-performance-overviewin the SASS to have padding of24pxby default and16pxup to960pxviewport width. ($bp-desktop) - edit
assets/js/modules/adsense/components/module/ModuleOverviewWidget/Stats.jsand update thechartAreato have:width: '100%'left: 60
- also update the
curveTypetofunction - edit
assets/js/modules/search-console/components/module/ModuleOverviewWidget/Stats.jsand update thechartAreato have:height: '80%'width: '100%'left: 60
- also update the
curveTypetofunction - edit
assets/js/modules/analytics/components/module/ModuleOverviewWidget/Stats.jsand update thecurveTypetofunction
Test Coverage
- N/A
Visual Regression Changes
- Update visual tests accordingly
QA Brief
- Inspect the overview charts on the Search Console, AdSense, and Analytics module pages, and verify that the ACs have been met.
Changelog entry
- Update charts to use consistent styles between modules.
@felixarntz we should probably get @aarondruck 's input here as to how these inconsistencies should be resolved.
Ideally, it would be great if we could extract a common (wrapper) component that the various dashboards would all share.
@aaemnnosttv I've added ACs here based on the related UX feedback and discussion.
@Hazlitte The ACs and discussion mentioning combining these components (the Overview and Stats components, see https://github.com/google/site-kit-wp/blob/2a18934d46d4cadcb169c50c406ec13f28c481d6/assets/js/modules/adsense/components/module/ModuleOverviewWidget/index.js#L124-L137 for the AdSense version) into a common component, which I think should be possible and would save a lot of future bugs like this.
I actually ran into these all being different and needing refactoring during the migration to GoogleChartsV2 component in #2916. The number of props Overview and Stats take are minimal and they share a lot of common code, so it'd be cool to have the IB tackle refactoring that "Data block + chart" into a common component given they share data anyway.
Oddly, the Analytics component even calls the <Stats /> component SiteStats instead, which is confusing and further argument to consolidate these 😄 https://github.com/google/site-kit-wp/blob/2a18934d46d4cadcb169c50c406ec13f28c481d6/assets/js/modules/analytics/components/module/ModuleOverviewWidget/index.js#L105-L116
Let's try for an IB that creates a common component that encompasses that behaviour and base it on the Analytics styles, which are the "Correct" ones here. Then update the AdSense and Search Console components to use that.
Hi @felixarntz ,
In the Adsense, Analytics and Search Console ModuleOverviewWidgets there are differences in the way that data is handled and components rendered for each of the Overview and Stats/SiteStats components. As a result and depending on the approach, it may be desirable to break this down into 4 tickets:
- Fix the layout bugs as per the existing IB
- Create a common stats chart component for the Adsense/Analytics/Search Console widgets
- Create a common overview component for them
- Create a common widget content component that returns the common overview and chart stats components I discussed this with @aaemnnosttv. He felt that 4 tickets may be too granular and we should see if you would prefer to do this in one issue or refactor in a follow-up issue/s. As a high level estimate I would say that handling this as a single ticket is probably a 19.
@Hazlitte @tofumatt I think we should keep this simple for now. We should be able to achieve similar layout using classes and CSS, let's not do any JS refactoring to use a common component, as that would indeed increase the scope of this issue.
I would advise to more pragmatically stick to the ACs here and not do any component refactoring, i.e. @Hazlitte this issue is or should be only your number 1. The other three would be refactoring that's potentially worth doing, but not within this issue.
IB ✅
QA Update: Fail ❌
@johnPhillips I have a few initial observations while testing this and I'm unsure if its linked with this or not.
Note: I used the Tester plugin to activate widgets.moduleScreens to ensure that I was only seeing the widgets not legacy.
-
On the Adsense module page, there's a larger gap at the bottom of the big numbers.
-
On the same module, the spacing on the left side of the chart (next to the values - y axis) is slightly less than the others module pages.

Verified:
- All three of these graphs use smooth lines instead of hard corners.
- The AdSense graph has the same spacing above the big numbers as Analytics and Search Console have.

Thanks @wpdarren!
@johnPhillips from what I see, it looks like this is related to the AdSense Overview component which does not use Grid components for its layout
https://github.com/google/site-kit-wp/blob/a2772f62914945ff261e6332a499a60cf2e520f7/assets/js/modules/adsense/components/module/ModuleOverviewWidget/Overview.js#L41-L42
Compared to the same components for Analytics
https://github.com/google/site-kit-wp/blob/a2772f62914945ff261e6332a499a60cf2e520f7/assets/js/modules/analytics/components/module/ModuleOverviewWidget/Overview.js#L74-L78
and Search Console
https://github.com/google/site-kit-wp/blob/a2772f62914945ff261e6332a499a60cf2e520f7/assets/js/modules/search-console/components/module/ModuleOverviewWidget/Overview.js#L55-L58
Darren's first point of feedback is addressed by using the grid because there is a css rule that removes top padding when two grids are adjacent to one another.
Regarding his second point about the space on the left side of the y-axis, I think this may be visually true, but the grid is in the right place. I think it's just that the labels for AdSense are longer/wider.
There's another minor inconsistency that I noticed as well which should also be resolved by using grid around the DataBlocks which is the width of those metrics are slightly different on AdSense than on Analytics and Search Console overviews.
The easiest way to compare is to open all 3 in separate tabs and then toggle between them. You should see the metrics, graphs, and the blue line under the selected metrics in the same place and same size.
Please create the follow-up PR from main and to target main now that 1.35.0 code is in this branch.
Thanks both.
Darren's first point of feedback is addressed by using the grid because there is a css rule that removes top padding when two grids are adjacent to one another. [...] There's another minor inconsistency that I noticed as well which should also be resolved by using grid around the DataBlocks which is the width of those metrics are slightly different on AdSense than on Analytics and Search Console overviews.
Yes, it looks like AdSense was doing its own thing here while the other two use Grid etc. I've added this and it seems to have fixed both of these issues.
Regarding his second point about the space on the left side of the y-axis, I think this may be visually true, but the grid is in the right place. I think it's just that the labels for AdSense are longer/wider.
I've verified this: it is indeed the same but as you say, the AdSense labels are longer which pushes the axis across slightly.
Back to you for another pass @wpdarren 👍
QA Update: ❌
@johnPhillips @aaemnnosttv I have cleared cache, and still not seeing a consistent layout of the graphs.
This is Search console - you can see the white space highlighted

This is Analytics - you can see the white space highlighted

This is Adsense - which looks fine to me.

I also started to QA this on mobile devices, I noticed on the x-axis, the last date, is not displayed in full. This does not occur with the current release, so thought you might want to look at this.

Verified:
- The AdSense graph has the same spacing above the big numbers as Analytics and Search Console. - Screenshot
- All three of these graphs should be adjusted to use smooth lines instead of hard corners - Screenshot
- On the Adsense module page, the larger gap at the bottom of the big numbers is fixed.
@wpdarren the first issue you mention (whitespace on the left hand side) was discussed above, I think. The issue is that the labels on the AdSense chart are longer so the axis is pushed across. The chart itself (including the axis) is the same size. See below:
| Search console | AdSense |
|---|---|
![]() |
![]() |
I'll investigate the text truncation on mobile now and report back.
CC @aaemnnosttv
@wpdarren the truncation on mobile seems to be due to the changes to the chartArea setting, which were implemented as per the IB.
This behaviour seems to be consistent across the three modules, however.
@aaemnnosttv can you advise?
@johnPhillips thank you for the reminder re. the whitespace and re. mobile, yes, I noticed this on all 3 modules.
@wpdarren regarding the truncation of the x-axis label in mobile, this would be good to improve but I would say it's out of scope for this issue. Regarding the distance between the left edge of the viewport and the y-axis labels, as @johnPhillips mentioned this is due to unavoidable variability in the length of the labels. We need to allow some extra space to accommodate for this variance to prevent longer labels from being truncated. You'll notice however that the chart itself is in a consistent location on all three though.
Ready for a final pass if there's anything else @wpdarren 👍
QA Update: Pass ✅
- The AdSense graph receives the same spacing above the big numbers as Analytics and Search Console
- The Search Console and AdSense graphs have no extra spacing around them.
- The graphs should be adjusted to use smooth lines instead of hard corners.

