google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.25k stars 290 forks source link

Data Error Fail appears on the Most popular products key metrics widget #8152

Closed jamesozzie closed 7 months ago

jamesozzie commented 9 months ago

Bug Description

We encountered 3 reports in the support forums of a "Data Loading Failed" errors within the Most popular products key metric only, as per the screenshots below. We were not able to recreate this in testing so far, but we are continuing to monitor and test this, while gathering details from impacted users.

Reports

Screenshots

image

image

Additional Context

Console Errors ``` JQMIGRATE: Migrate is installed, version 3.4.1 /wp-json/google-site-kit/v1/core/user/data/survey-trigger?_locale=user:1 Failed to load resource: the server responded with a status of 503 () googlesitekit-api-6b06a5c9b165bf7e28a4.js:3 Google Site Kit API Error method:POST datapoint:survey-trigger type:core identifier:user error:”The response is not a valid JSON response.” (anonymous) @ googlesitekit-api-6b06a5c9b165bf7e28a4.js:3 /wp-json/google-site-kit/v1/modules/analytics-4/data/report?metrics%5B0%5D%5Bname%5D=screenPageViews&dimensions%5B0%5D%5Bname%5D=pagePath&startDate=2024-02-01&endDate=2024-02-28&dimensionFilters%5BcustomEvent%3Agooglesitekit_post_type%5D%5BfilterType%5D=stringFilter&dimensionFilters%5BcustomEvent%3Agooglesitekit_post_type%5D%5BmatchType%5D=EXACT&dimensionFilters%5BcustomEvent%3Agooglesitekit_post_type%5D%5Bvalue%5D=product&orderby%5B0%5D%5Bmetric%5D%5BmetricName%5D=screenPageViews&orderby%5B0%5D%5Bdesc%5D=true&limit=3&_locale=user:1 Failed to load resource: the server responded with a status of 400 () googlesitekit-api-6b06a5c9b165bf7e28a4.js:3 Google Site Kit API Error method:GET datapoint:report type:modules identifier:analytics-4 error:”Field customEvent:googlesitekit_post_type is not a valid dimension. For a list of valid dimensions and metrics, see https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema “ (anonymous) @ googlesitekit-api-6b06a5c9b165bf7e28a4.js:3 report:1 Failed to load resource: the server responded with a status of 503 () googlesitekit-api-6b06a5c9b165bf7e28a4.js:3 Google Site Kit API Error method:GET datapoint:report type:modules identifier:analytics-4 error:”The response is not a valid JSON response.” (anonymous) @ googlesitekit-api-6b06a5c9b165bf7e28a4.js:3 u @ googlesitekit-vendor-dfed20715cb9adaf207b.js:7 (anonymous) @ googlesitekit-vendor-dfed20715cb9adaf207b.js:7 forEach.e. @ googlesitekit-vendor-dfed20715cb9adaf207b.js:7 n @ googlesitekit-vendor-dfed20715cb9adaf207b.js:1 s @ googlesitekit-vendor-dfed20715cb9adaf207b.js:1 ```

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

Acceptance criteria

Implementation Brief

Test Coverage

QA Brief

Changelog entry

jamesozzie commented 7 months ago

Another report of this occurred today. Details based on user updates added to main summary above.

jamesozzie commented 7 months ago

Another user reported this in the support forums today. Details added to the impacted users section in the main body of this issue.

I also checked a site with WooCommerce traffic on this today, using an older version of WooCommerce and also the same version as this impacted user. In my case the same didn't occur, on either site. Screenshots below. I suspect there may be an issue in how we're detected products, or there is a multi plugin configuration impacting reporting. To be tested further with the same active plugins.

image

jamesozzie commented 7 months ago

From reviewing existing reports of this, and further testing, this can occur if one or more required custom dimensions are missing. For those impacted, in order to allow Site Kit to recreate the required custom dimensions, follow the steps below:

  1. Click on the “Change metrics” option from your Site Kit dashboard
  2. Deselect the “Most popular products by pageviews” metric
  3. Click on the “Apply changes” button
  4. You will see on your Site Kit dashboard that this tile no longer exists. Click on the “Change metrics” link once more
  5. Select the “Most popular products by pageviews” metric once more. You will see a notice that your Analytics property will be updated.
  6. Click on the “Apply changes” button
  7. You may see the Data loading failed error once more, but please wait an hour as we cache responses.
  8. Wait some time before visiting your Site Kit dashboard once more, checking the “Most popular products” key metrics tile.

Closing this issue given this only occurs if the required custom dimensions are no longer present in Analytics. The above workaround will allow users to view this tile once more.