I’m using the Google Analyticator plugin in WordPress, and have ran into the following error message when setting this up on two different blogs.
“There was an Analytics API service error 400:Error fetching OAuth2 access token, message: ‘invalid_grant’
I was seeing this error on the WordPress Dashboard page where the Google Analytics dashboard should have been displaying. The plugin settings page had this message as wel.
The issue is that the plugin has not been granted access to Google Analytics. So this needs to be done prior to this working.
The Fix:
It’s actually really simple, it’s just a matter of finding the correct locations to click.
– In the WordPress Admin page, go to Settings -> Google Analytics.
– Scroll down to the bottom of the page and click on the link “Deauthorize & Reset Google Analyticator.” (For me, it was directly above an ad. Not the easiest to find, but it’s there)
– On this page, there is a link that says “Click Here” near the top. This opens another page, which is Google Analytics. If logged in, you’ll see a blue button “Allow Access”. Click on that.
– Copy the code in the text box that appears.
– Go back to your WordPress page and paste the code into the verificiation box. Click “Save and Continue”.
– You are now verified with Google Analytics. You can now set up your Google Analyicator settings and be along your merry way!