Soon after the Site Kit update was released, a majority of WordPress users, including me, started getting WordPress REST API error in Google Analytics. In this article, i will elaborate that how i wasted more than 5 days with nonsense hope and tried almost every way to fix the issue.
Here i will explain that how i fixed this issue without any support or expert from WP Lions.
I also contacted the Google Site Kit plugin support, my hosting provider and some other associate developers but nothing was helpful in this regard as everyone was prescribing different-different solutions. Even, none of their solutions were working.
Site Kit in My Site was not working properly. I was constantly getting an error message – Your site may not be ready for Site Kit. Site Kit cannot access the WordPress REST API. Please ensure it is enabled on your site.
When i was re-activating the plugin, the below message was displaying to my screen.
This error probably occurs on the Website Dashboard when Site Kit is unable to access the WordPress REST API. All those users who face this error need to enable WordPress rest API on their websites.
Some snapshots are being shared to identify the issue correctly.
How to fix REST API error in Google Analytics manually
First of all what you need to reset your site Kit plugin by the process shown in the below image –
After resetting the Google Site Kit please don’t forget to deactivate and delete the same. This process will erase the conflicts or any nonce file from the database completely. Now re-install the plugin and connect it again with your earlier email account.
Oh! you are done. You will see that the Google Site Kit plugin is now working without any issue. However, in any case, if this method does not work for you, please try another method explained below –
How to fix REST API error in Google Analytics with automatic process
Your issue will get vanished in the first method but if still, your issue has not gone please try another method as the issue is potentially resulting from the mixed content error or in lack of valid HTTP redirection.
Please follow these steps –
If the issue is arising out due to HTTP redirection, you should simply go to Tools tab >> Site health and locate any highlighted error/message that the system shows. Switching your site from HTTP to HTTPS is a one-click move.
Just follow the step and WordPress will automatically update the database URLs. You do not need to edit any code in public.html file.
How to fix REST API error in Google Analytics through plugin
If your issue still persists, we highly recommend you to check your site health first and also try to remember that what the changes you have implemented to your website in the last few days.
- Alternatively, Download this plugin – Health Check & Troubleshooting
Before downloading this plugin make sure that you have cleared your browser history. If you are not comfortable with that please login in New Incognito Window and install this plugin.
- Activate the plugin and navigate to Plugins >> Health Check & Troubleshooting >> Troubleshoot
- On the right top upper side of the same screen, find the Available Plugins tab. Here you see Enable option just next to the “Site Kit by Google”. Click to enable it.
- Now try to connect the Analytics module within Site Kit once again.
Hope your issue is resolved with the help of these techniques. In an exceptional case if you are facing this issue still that means you have a critical error in your site and need to have it checked by an expert. You can hire a Developer from WP Lions on a single move here.