Seeing this in Site Kit → Analytics?
Data error in Analytics
There was a critical error on this website while fetching data
In plain English, Site Kit tried to load Analytics data over the WordPress REST API and your site replied with a 500 critical error.
Most of the time that means:
Below is a safe path to confirm that Analytics tracking still works, then uncover which plugin, theme, or server rule is causing the critical error.
Site Kit by Google shows “Data error in Analytics. There was a critical error on this website while fetching data” on the Analytics screen. How do I fix this?
Short version
Site Kit is just the messenger here.
The message means:
“When I asked WordPress for Analytics data, your site threw a critical error.”
WordPress logs a PHP fatal during the REST request. Site Kit sees the 500 error and shows this generic message.
You normally fix it by:
debug.logUse the index below to jump to your situation.
Very often this error affects only the Site Kit dashboard. Your site may still be sending hits to Google Analytics.
If you see at least one active user, tracking works. The issue is with how Site Kit reads and displays data, not with the tags themselves.
You can also use Tag Assistant to check that the Analytics tag fires on your pages.
If tracking is fine, you can focus on fixing the Site Kit UI error without panic. If tracking is broken as well, still follow the steps below, but pay extra attention to the Analytics module reset.
In many cases the only symptom is:
/wp-json/google-site-kit/v1/modules/analytics-4/data/reportIf the rest of your admin and front end works, you can leave Site Kit active while you troubleshoot.
If activating Site Kit blanked the whole site, deactivate it first so you can work:
If you cannot reach wp admin at all, rename the plugin folder:
wp-content/plugins/.google-site-kit to google-site-kit-disabled.WordPress will stop loading Site Kit. Once you have identified the underlying conflict, you can rename it back and reactivate.
The Site Kit message is just the surface. The fix lives in the PHP error just under it.
If you do not already have a debug log:
wp-config.php in your WordPress root./* That's all, stop editing */ add or adjust:define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
wp-content/debug.log.Search the log for:
google-site-kitmodules/analytics or analytics-4Fatal error or TypeErrorTypical patterns you might see:
Write down:
This will tell you whether the culprit lives in Site Kit itself, another plugin, or your theme.
You can leave debug logging on while you test. Just remember to turn it off again later if you prefer.
Site Kit’s own docs recommend the Health Check & Troubleshooting plugin to isolate conflicts without breaking the front end.
are enabled.
Now visit Site Kit → Analytics again.
Stay in Troubleshooting Mode.
Common conflict types:
Update that plugin to the latest version and check its settings. If you still get the error whenever it is active, contact that plugin’s support with:
debug.logYou can then decide whether to keep that plugin, replace it, or wait for a compatibility fix.
When you are done testing, click Disable Troubleshooting Mode in the bar.
If the PHP error lives in Site Kit code or in how it talks to Analytics, a clean reconnect can help.
This does not delete your Analytics property. It just disconnects Site Kit’s link to it.
If the error was caused by a bad property reference or a stale configuration, it often clears here.
If you created a brand new Analytics property during this process, remember that it can take some time before historic data appears. Use the Realtime report to confirm that hits are flowing.
If the error still appears even with:
debug.logthen the problem is likely at hosting or server level.
Typical signs:
/wp-json/ requestsThis rewrites your .htaccess file, which can fix some REST routing issues.
Open a support ticket and include something like this:
I am using the "Site Kit by Google" plugin.
On the Site Kit Analytics screen I see:
"Data error in Analytics
There was a critical error on this website while fetching data"
When I check my browser console I see a 500 error on:
/wp-json/google-site-kit/v1/modules/analytics-4/data/report
And my wp-content/debug.log shows a generic critical error.
Can you please:
1) Check the server error log for the same time and tell me what PHP error occurs.
2) Confirm that requests to /wp-json/ and /wp-json/google-site-kit/ are not blocked by any firewall or mod_security rule.
3) Confirm that PHP and cURL meet Site Kit requirements and that JSON responses are not being modified or compressed in a non standard way.
If they find and fix a rule that was blocking or altering REST responses, the Site Kit error should go away the next time you open Analytics.
If you still see “Data error in Analytics” after:
debug.logthen it is time to reach out to the Site Kit team.
Include:
wp-content/debug.log that occurs when you open Site Kit → AnalyticsYou can open a topic in the Site Kit support forum or follow their “Fixing common issues with Site Kit” and “Using Troubleshooting Mode” docs, which both link to support.
You are in good shape when:
/wp-json/google-site-kit/v1/modules/analytics-4/data/reportwp-content/debug.log has no new PHP fatals when you open Site KitHit Continue Chat below and send:
wp-content/debug.log around the time you open Site Kit → AnalyticsI can help you read the log, narrow down the conflict, and phrase a clear message for Site Kit support or your host.
Scroll down to the contact form below. Enter your name, email, and WordPress needs. Atiba will get back to you as soon as possible.
WP Assistant is a free tool created by Atiba Software, a WordPress design and development company located in Nashville, TN. If you need more personalized WordPress assistance let us know, and we’ll get back to you ASAP!