MonsterInsights

Error with MonsterInsights – Google Analytics Dashboard for WordPress

You may have this kind of error with MonsterInsights – Google Analytics Dashboard for WordPress :

Error
The API returned a 400 response with this message: MonsterInsights failed to retrieve the new report data. Error message: { “error”: “invalid_grant”, “error_description”: “Bad Request” }

Or :

Google Analytics for WordPress by MonsterInsights failed to retrieve the new report data. Error message: { “error”: “invalid_grant”, “error_description”: “Bad Request” }

Or :

PHP Fatal error: Cannot declare class MI_MetaBox, because the name is already in use in /wp-content/plugins/google-analytics-for-wordpress/includes/admin/meta-box.php on line 11

Or :

PHP Warning: file_exists(): open_basedir restriction in effect. File(/wp-content/plugins/https://www.monsterinsights.com/lite/) is not within the allowed path(s): () in \wp-admin\menu-header.php on line 256

Or :

PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in wp-content/plugins/google-analytics-for-wordpress/includes/admin/notifications/notification-upgrade-eu-traffic.php:43

Or :

The API returned a 403 response with this message: Your MonsterInsights authentication has expired. Please re-authenticate on the MonsterInsights settings panel.

Or :

The firewall of your server is blocking outbound calls. Please contact your hosting provider to fix this issue. cURL error 7: Failed to connect : Network is unreachable

Or :

Fatal error: Uncaught ValueError: Unknown format specifier "k" in /wp-content/plugins/google-analytics-for-wordpress/lite/includes/admin/helpers.php:78
Stack trace:
#0 /wp-content/plugins/google-analytics-for-wordpress/lite/includes/admin/helpers.php(78): printf()

Or :

render@/wp-content/plugins/google-analytics-for-wordpress/assets/gutenberg/js/editor.min.js?ver=8.3.1:6:74546
we@/wp-includes/js/dist/vendor/react-dom.min.js:84:294
zj@/wp-includes/js/dist/vendor/react-dom.min.js:226:498
Th@/wp-includes/js/dist/vendor/react-dom.min.js:152:225
tj@/wp-includes/js/dist/vendor/react-dom.min.js:152:154
Te@/wp-includes/js/dist/vendor/react-dom.min.js:146:153
Te@[native code]
@/wp-includes/js/dist/vendor/react-dom.min.js:61:69
unstable_runWithPriority@/wp-includes/js/dist/vendor/react.min.js:25:261
Pg@/wp-includes/js/dist/vendor/react-dom.min.js:61:16
ha@/wp-includes/js/dist/vendor/react-dom.min.js:60:453
Ja@/wp-includes/js/dist/vendor/react-dom.min.js:224:402
ch@/wp-includes/js/dist/vendor/react-dom.min.js:93:81
ch@[native code]
e@/wp-includes/js/dist/data.min.js:2:20892
t@/wp-includes/js/dist/data.min.js:2:20959
@/wp-includes/js/dist/data.min.js:2:15083
b@/wp-includes/js/dist/data.min.js:2:8589
@/wp-includes/js/dist/redux-routine.min.js:2:1354
some@[native code]
r@/wp-includes/js/dist/redux-routine.min.js:2:9237
@/wp-includes/js/dist/redux-routine.min.js:2:9187
@/wp-includes/js/dist/redux-routine.min.js:2:6329
some@[native code]
r@/wp-includes/js/dist/redux-routine.min.js:2:9237
@/wp-includes/js/dist/redux-routine.min.js:2:9182
promiseReactionJob@[native code]

Or :

The error:
An error of type E_COMPILE_ERROR was caused in line 456 of the file /wp-content/plugins/google-analytics-for-wordpress/googleanalytics.php. Error message: require_once(): Failed opening required ‘/wp-content/plugins/google-analytics-for-wordpress/lite/includes/license-compat.php’ (include_path=’.:/php’)

There are multiple solutions to try to make it work.

Updates

The first thing to do if you are stuck with MonsterInsights – Google Analytics Dashboard for WordPress is to ensure that all your WordPress is up to date. You should check your :

  • WordPress
  • Plugins
  • Theme

Once all these updates are done, check back if these errors appear.

Check MonsterInsights – Google Analytics Dashboard for WordPress

Sometimes, you just need to disable the plugin, and enable it just after to make it work again.

If it doesn’t work, your MonsterInsights – Google Analytics Dashboard for WordPress plugin may be corrupted. To ensure that it’s not your case, you have to re-download the plugin (or the theme delivered with the plugin) and try to install it again.

Check others plugins

Are you sure that the error is related to MonsterInsights – Google Analytics Dashboard for WordPress? Maybe not.

It could be related to another plugin that is not compatible. It could happen when you use a cache plugin, a security plugin, or simply a poorly developed plugin.

Disable all plugins. Then, check for your error, if the error is still there, the problem is not related to plugins compatibility. If there are no more errors, then enable every plugin one by one and check for the error. The goal is to target the plugin involved.

Try another theme

The error can be a problem with your theme.

If it’s not already done, then you should install & activate the default WordPress theme like Twenty Twenty-Two. Check for the error, and see what is happening to be sure that your WordPress theme is not the cause.

Permalinks & htaccess

If it doesn’t work, you may have a problem with your WordPress permalinks and/or your htaccess file. You should go on your WordPress dashboard, and re-saving permalinks from the permalinks page.

Contact the developer

If all these solutions don’t work, we advise you to contact the plugin developer.

You may have found a new bug, or a specific issue. You should get in touch with the developer either on the WordPress plugin forum, either by mail, either on their specific website with their own support.

Alternative solutions

If the developer doesn’t reply, or your problem is very urgent, then you should try an alternative to the plugin.

There are thousands of plugins on the official directory, and many others outside. You should try to find and test them!

If the issue is very specific, and the plugin could not be replaced, we advise you to contact an expert.
This is the best way to ensure you're not going to break your site anymore.