Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line chart not appearing for 'Unique Visitors From Search' widget on Site Kit Dashboard #4237

Closed
wpdarren opened this issue Oct 18, 2021 · 7 comments
Labels
Module: Analytics Google Analytics module related issues P1 Medium priority Type: Bug Something isn't working

Comments

@wpdarren
Copy link
Collaborator

wpdarren commented Oct 18, 2021

Bug Description

On Site Kit Dashboard the Unique Visitors from Search widget does not have the line chart underneath it. Initially, I thought it was related to #4086 but after further investigation it appears that it was an issue from a previous release.

The line chart should appear as per other widgets.

image.png


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

Acceptance criteria

  • The "Unique Visitors from Search" widget should also show a sparkline when there is 0 data. (It should be a green flat sparkline like in the 0 data case in other widgets in e.g. the Search Funnel.)
    • The "Bounce Rate" widget (in the entity dashboard) does show a sparkline even with 0 data (as expected), so there seems to be something off specifically with the "Unique Visitors from Search" widget, not necessarily all Analytics widgets.

Implementation Brief

  • Update DashboardSearchVisitorsWidget to remove ga:channelGrouping from the dimensions argument for all reports in the component, so that the sparkline report only uses ga:date for dimensions and the visitors report doesn't use any dimensions.
    • This will ensure that the sparkline response includes the results properly grouped by only date, which should fix the problem with the rows being empty.
    • The ga:channelGrouping dimension should have never been included here in the first place, since we don't want results grouped by it. It wouldn't even make sense since we use ga:channelGrouping as a dimension filter so it would only ever be a single group anyway.
  • Update the accompanying DashboardSearchVisitorsWidget.stories.js file so that the sparkline and visitor report arguments are adjusted accordingly to the component change, to ensure the Storybook stories still work as expected.

Test Coverage

N/A

QA Brief

  • You'll need an account with Analytics connected but zero data. If you don't already have one, setting up a fresh Jurassic Ninja site and connecting Analytics will accomplish this, although you'll have to wait a while for the data to become available.
  • Navigate to the Dashboard.
  • Verify the Unique Visitors from Search widget shows a zero and does have a flat line beneath it.

Changelog entry

  • Fix missing Unique Visitors From Search sparkline issue for zero data state.
@wpdarren wpdarren added the Type: Bug Something isn't working label Oct 18, 2021
@aaemnnosttv aaemnnosttv added Module: Analytics Google Analytics module related issues P1 Medium priority labels Oct 19, 2021
@felixarntz felixarntz assigned felixarntz and unassigned felixarntz Oct 27, 2021
@asvinb
Copy link
Collaborator

asvinb commented Nov 2, 2021

Related issue and possible fix: #3774

@techanvil techanvil assigned techanvil and unassigned techanvil Nov 2, 2021
@asvinb asvinb assigned asvinb and unassigned asvinb Nov 3, 2021
@felixarntz
Copy link
Member

felixarntz commented Nov 3, 2021

@asvinb The current IB here isn't a proper solution for the problem. While it would backfill dates, the problem here is somewhere else, which is slightly more obscure: The only time that Analytics is expected to not return any dates despite ga:date being requested as a dimension is when Analytics is gathering data. However, this is already ruled out when this widget is rendered since it's only rendered if Analytics isn't gathering data. On the server-side we set the includeEmptyRows option for Analytics, so it should never have missing dates in the first place.

I've researched and tested this, and the problem for why this happens (possibly also fixes #3774) is that for some reason the DashboardSearchVisitorsWidget includes ga:channelGrouping as a dimension. This is entirely unnecessary since we don't need that dimension, we only care about ga:date as a dimension. We do need ga:channelGrouping as a filter, but not as an actual dimension to group results by. I tested the same request we currently fire without the ga:channelGrouping dimension, and it works as expected then and includes the dates. I'm not entirely sure why that is, but maybe there's some extra complexity around using multiple dimensions, which we typically don't do in Site Kit. Anyway, in the case here that second dimension is entirely unnecessary.

Since I've tested and found the above solution, I'm going to update the IB accordingly. cc @aaemnnosttv @eugene-manuilov for awareness - this is probably worth keeping in mind for the future, should something similar arise again.

@asvinb
Copy link
Collaborator

asvinb commented Nov 4, 2021

Thanks @felixarntz , that's some really helpful info.

@aaemnnosttv
Copy link
Collaborator

We do need ga:channelGrouping as a filter, but not as an actual dimension to group results by.

@felixarntz are you saying we can use it in the request as a filter without listing it as a dimension?

@felixarntz
Copy link
Member

@aaemnnosttv Yes - dimensionFilters and dimensions have no relationship with each other, except they both deal with dimensions. But one is a filter and the other one defines how to "format" the response, so they're unrelated.

@eugene-manuilov
Copy link
Collaborator

Ok, IB looks good to me. ✔️

@eugene-manuilov eugene-manuilov removed their assignment Nov 9, 2021
@techanvil techanvil self-assigned this Nov 11, 2021
@techanvil techanvil removed their assignment Nov 16, 2021
@wpdarren wpdarren self-assigned this Nov 17, 2021
@wpdarren
Copy link
Collaborator Author

QA Update: ✅

Verified:

  • The Unique Visitors from Search widget shows a zero and does have a flat line beneath it.
  • When The Unique Visitors from Search widget has data, there is an appropriate line chart underneath it.

image

@wpdarren wpdarren removed their assignment Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module: Analytics Google Analytics module related issues P1 Medium priority Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants