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

Update filtering of (not set) values in reportRowsWithSetValues to check for blank values #10143

Closed
3 tasks done
ankitrox opened this issue Jan 30, 2025 · 7 comments
Closed
3 tasks done
Labels
Module: Analytics Google Analytics module related issues P0 High priority Team M Issues for Squad 2

Comments

@ankitrox
Copy link
Collaborator

ankitrox commented Jan 30, 2025

Feature Description

From a recent notice about upcoming changes to the Data API

The Google Analytics Data API is changing the way empty fields are treated in reports.

Today, for fields where Google Analytics doesn’t receive any data, the value (not set) is returned in a report. The Google Analytics Data API will return blank values instead of (not set), beginning in March 2025.

Action Required:

Google Analytics Data API users that are pulling reporting data with filters comparing against the (not set) value will need to update their filtering conditions to compare against a blank value using the EmptyFilter filter type.
If you don’t take action, your reports may show incorrect or empty results.

See also: #10059, #10177.


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

Acceptance criteria

  • JS-side filtering for '(not set)' report values (as opposed to filtering via dimension filters in report options), should be updated to filter for empty values as well.
  • This update should be release in time for the change to the Analytics Data API in March 2025 as per the Feature Description.

Note

We can follow up with a subsequent issue to remove all reference to "(not set)" from the codebase.

Implementation Brief

  • In assets/js/modules/analytics-4/utils/report-rows-with-set-values.js

    • Update reportRowsWithSetValues function to also filter out the blank value '' along with (not set).
      export function reportRowsWithSetValues( rows, maxRows = 3 ) {
      const rowsWithSetValues = rows.filter(
      ( { dimensionValues } ) => dimensionValues[ 0 ].value !== '(not set)'
      );
      return rowsWithSetValues.slice( 0, maxRows );
      }
  • In assets/js/modules/analytics-4/components/dashboard/DashboardAllTrafficWidgetGA4/UserDimensionsPieChart.js

  • reportRowsWithSetValues function is being used by following components, so make sure that correct number of rows are being fetched and passed.

Test Coverage

  • Expand tests for reportRowsWithSetValues to also account for blank values.
  • Fix any failing tests and stories.

QA Brief

  1. Set up the Site Kit with Key Metrics widgets having Top Cities and Top Countries widget in it.

  2. Also setup the Audience Segmentation feature such that AS tiles are available on dashboard.

  3. Ensure that none of the tile across KM and AS shows the (not set) or blank value ('').

Note: It's difficult to get the (not set) or blank value, so try different date ranges, if all looks fine, this should be good to go as we have necessary tests in place which are passing.

Changelog entry

  • Ensure that client-side filtering of unset Analytics report values filters out empty strings as well as '(not set)', to align with changes to the Analytics Data API.
@ankitrox ankitrox changed the title Update filtering of (not set) values to check for blank value instead Update filtering of (not set) values in reportRowsWithSetValues and UserDimensionsPieChart to check for blank values Jan 30, 2025
@techanvil techanvil changed the title Update filtering of (not set) values in reportRowsWithSetValues and UserDimensionsPieChart to check for blank values March 2025: Update filtering of (not set) values in reportRowsWithSetValues and UserDimensionsPieChart to check for blank values Feb 5, 2025
@techanvil techanvil self-assigned this Feb 5, 2025
@techanvil techanvil changed the title March 2025: Update filtering of (not set) values in reportRowsWithSetValues and UserDimensionsPieChart to check for blank values [For release in March 2025]: Update filtering of (not set) values in reportRowsWithSetValues and UserDimensionsPieChart to check for blank values Feb 5, 2025
@techanvil techanvil assigned ankitrox and unassigned techanvil Feb 5, 2025
@techanvil
Copy link
Collaborator

Hey @ankitrox, thanks for creating this issue.

The initial AC you provided was more on the way to being an IB, so I've provided a new set of AC and moved your version to the IB section.

Seeing as you've got the context on this, it would probably make sense for you to continue to flesh out the IB so I've assigned it back to you in IB, of course please feel free to unassign it if you don't have capacity.

@ankitrox ankitrox removed their assignment Feb 21, 2025
@ankitrox
Copy link
Collaborator Author

Thank you @techanvil for updating the acceptance criteria.

I have updated the IB section as per the required actions for this change and also updated test coverage section.

Moving this to IBR and unassigned myself so that anyone who has bandwidth can pick this for review.

Thank you.

@tofumatt tofumatt added P1 Medium priority Module: Analytics Google Analytics module related issues labels Feb 26, 2025
@techanvil techanvil changed the title [For release in March 2025]: Update filtering of (not set) values in reportRowsWithSetValues and UserDimensionsPieChart to check for blank values Update filtering of (not set) values in reportRowsWithSetValues and UserDimensionsPieChart to check for blank values Mar 3, 2025
@techanvil techanvil self-assigned this Mar 3, 2025
@techanvil
Copy link
Collaborator

Thanks @ankitrox, this IB LGTM. Taking the approach of checking for an empty value while retaining the check for (not set) is sensible, we can follow up with a separate issue to remove all references to (not set) after this change has had time to bed in. I've tweaked the AC accordingly and will create a followup issue.

IB ✅

@techanvil techanvil added P0 High priority and removed P1 Medium priority labels Mar 3, 2025
@techanvil
Copy link
Collaborator

Note that this is a high priority issue as it's already March so we need to get this in ASAP.

@techanvil techanvil removed their assignment Mar 3, 2025
@ankitrox ankitrox self-assigned this Mar 3, 2025
@ivonac4 ivonac4 added the Team M Issues for Squad 2 label Mar 3, 2025
@ankitrox ankitrox removed their assignment Mar 4, 2025
@techanvil techanvil self-assigned this Mar 4, 2025
@techanvil techanvil changed the title Update filtering of (not set) values in reportRowsWithSetValues and UserDimensionsPieChart to check for blank values Update filtering of (not set) values in reportRowsWithSetValues to check for blank values Mar 4, 2025
@techanvil techanvil assigned ankitrox and unassigned techanvil Mar 4, 2025
@techanvil
Copy link
Collaborator

Hi @ankitrox, I've merged the PR for this issue, but please can you add a QAB?

@ankitrox ankitrox removed their assignment Mar 5, 2025
@wpdarren wpdarren self-assigned this Mar 5, 2025
@mohitwp mohitwp assigned mohitwp and unassigned wpdarren Mar 5, 2025
@mohitwp
Copy link
Collaborator

mohitwp commented Mar 5, 2025

QA Update ⚠

  • Tested on main environment.
  • Tested this using different site.
  • Verified KM Top cities and Top countries metric.
  • Verified Audience segmentation Group tiles.
  • I'm not getting 'Not set' data value on any of the live site.
  • I found that Creatortrail site have blank data entry which is now removed on main environment.

@wpdarren Could you please double-check if you can reproduce the required data value on any of your sites? Thanks !

Latest -

28 days

Image

Image

14 days

Image

Image

7 days

Image

Image

90 days

Image

Image

Main environment

28 days

Image

Image

7 days

Image

Image

14 days

Image

Image

90 days

Image

Image

@mohitwp mohitwp assigned wpdarren and unassigned mohitwp Mar 5, 2025
@wpdarren
Copy link
Collaborator

wpdarren commented Mar 5, 2025

QA Update: ✅

I went through a few of my test websites and was unable to find one where [not set] was appearing in KMW tiles or Audience Segmentation data.

As the engineer mentioned, It's difficult to find the [not set] in Analytics data, even when trying different date ranges. The fact that @mohitwp can see that blank value is removed on one site, I feel this should be good to go as we have necessary E2E tests in place which are passing.

@wpdarren wpdarren removed their assignment Mar 5, 2025
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 P0 High priority Team M Issues for Squad 2
Projects
None yet
Development

No branches or pull requests

6 participants