Google Analytics by MonsterInsights
[Plugin: Google Analytics for WordPress] Fatal error: Call to a member function set_defaults() on a (4 posts)

  1. subnero2001
    Posted 4 years ago #


    I am getting this error repeatedly on different sites that I am running the Google Analytics Plugin on.

    What happens is:

    I login as Admin and get the message at the top that I need to link the Google Analytics Plugin to a Google Analytics account although I have done this multiple times.

    I click to do this and then this message comes up:

    Fatal error: Call to a member function set_defaults() on a non-object in /home/buyrarei/public_html/swissmetalassets.com/wp-content/plugins/google-analytics-for-wordpress/googleanalytics.php on line 1517

    Entire site including admin then goes offline for 5 - 10 minutes and displays the same message no matter what page you try to access.

    Something seems to reset itself after 5 - 10 minutes and then I can login again as Admin and link the Plugin to my Google Analytics account and it seems to work again for a while.

    On some of my sites this only happens occasionally and on others it has happened up to 20 times in one day while I am trying to add new posts or do something on the site.

    Any suggestions?




  2. Zack Katz
    Posted 4 years ago #

    I had this same issue.

    Around line 1515 on googleanalytics.php, change:
    if (!is_array($options)) {

    if (!is_array($options) && class_exists('GA_Admin')) {

  3. Ryan
    Posted 4 years ago #

    Thanks for the tip for where to look. For whatever reason, that didn't work. But I did something similar and changed



    if ($ga_admin) $ga_admin->set_defaults();

    and it appears to be working correctly.

    One thought though. Does this only happen when the plugin is network activated? I didn't try it before the fix, but after I turned off network activate and left it to be manually activated on each site so I can leave it off if needed.

  4. mgrmn
    Posted 3 years ago #

    That will resolve the error, but can not activate tracking in admin panel

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Google Analytics by MonsterInsights
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic