WordPress.org

Forums

Google Analytics Dashboard for WP
[resolved] Keeps asking us to authorize (22 posts)

  1. Gregg Banse
    Member
    Posted 1 year ago #

    We're testing this plugin in on several of our websites, some are multisite installs and others standalone. The plugin seems to work great when it's first setup in either situation but after a few days when I go back to the site, I find it's asking for authorization again.

    Why does this keep happening?
    Does it need the user to be logged into the correct Google account at all times?

    https://wordpress.org/plugins/google-analytics-dashboard-for-wp/

  2. Alin Marcu
    Member
    Plugin Author

    Posted 1 year ago #

    No, look in General Settings -> Debugging Data for errors and in your PHP error log.

  3. Gregg Banse
    Member
    Posted 1 year ago #

    Hi Alin,
    Thanks for the reply. Last error:

    Last Error: exception 'Google_AuthException' with message 'Error refreshing the OAuth2 token, message: '{
      "error" : "invalid_grant"
    }'' in /data/COLA/wp-content/plugins/google-analytics-dashboard-for-wp/tools/src/auth/Google_OAuth2.php:288
  4. Alin Marcu
    Member
    Plugin Author

    Posted 1 year ago #

    Can you check the clock on your server and make sure is synced with NTP?

  5. Gregg Banse
    Member
    Posted 1 year ago #

    I'm not sure how to do that so I've asked the host's support team. Will let you know. Thanks.

  6. Gregg Banse
    Member
    Posted 1 year ago #

    Hello Alin,
    That seems to have done the trick. Thank you. Turns out the issues was in the PHP.ini file. Datetimezone was commented out. Set this and all seems to be working fine.

  7. Gregg Banse
    Member
    Posted 1 year ago #

    Meh... still happening. I've checked and made sure NTP is set to the servers in our location:

    server 0.north-america.pool.ntp.org
    	   server 1.north-america.pool.ntp.org
    	   server 2.north-america.pool.ntp.org
    	   server 3.north-america.pool.ntp.org

    PHP.ini is set correctly as well.

    Still getting this error:

    Last Error: exception 'Google_AuthException' with message 'Error refreshing the OAuth2 token, message: '{
      "error" : "invalid_grant"
    }'' in /wp-content/plugins/google-analytics-dashboard-for-wp/tools/src/auth/Google_OAuth2.php:288
    Stack trace:
    #0 /wp-content/plugins/google-analytics-dashboard-for-wp/tools/src/auth/Google_OAuth2.php(248): Google_OAuth2->refreshTokenRequest(Array)
    #1 /wp-content/plugins/google-analytics-dashboard-for-wp/tools/src/Google_Client.php(311): Google_OAuth2->refreshToken('1/u16MQiGZ_R9fZ...')
    #2 /wp-content/plugins/google-analytics-dashboard-for-wp/tools/gapi.php(141): Google_Client->refreshToken('1/u16MQiGZ_R9fZ...')
    #3 /wp-content/plugins/google-analytics-dashboard-for-wp/tools/gapi.php(47): GADASH_GAPI->ga_dash_refresh_token()
    #4 /wp-content/plugins/google-analytics-dashboard-for-wp/tools/gapi.php(1090): GADASH_GAPI->__construct()
    #5 /wp-content/plugins/google-analytics-dashboard-for-wp/admin/dashboard_widgets.php(140): include_once('/wp-c...')
    #6 [internal function]: GADASH_Widgets->gadash_dashboard_widgets('', Array)
    #7 /wp-admin/includes/template.php(985): call_user_func(Array, '', Array)
    #8 /wp-admin/includes/dashboard.php(193): do_meta_boxes('dashboard', 'side', '')
    #9 /wp-admin/index.php(125): wp_dashboard()
    #10 {main}

    Is there a limit to the number of GA Accounts or properties the plugin can work with?

  8. Alin Marcu
    Member
    Plugin Author

    Posted 1 year ago #

    The plugin has no limit for the number of GA accounts or properties, but there is a limit of 25 tokens per Google Analytics account (this limit is imposed by Google).

    You can receive an invalid grant when:

    1. server's clock is not synced with NTP
    2. the refresh token limit has been exceeded

    you can read more about that here (see the last paragraph):

    https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtAuthorization

  9. Gregg Banse
    Member
    Posted 1 year ago #

    The 25 token limit must be the issue. We have all of our University web properties under one GA user. Seems like the solution would be to divide up the properties among different GA users?

  10. Gregg Banse
    Member
    Posted 1 year ago #

    Odd - In the error log I see a bunch of properties that no longer exist in my GA account. Are they cached somehow?

  11. Alin Marcu
    Member
    Plugin Author

    Posted 1 year ago #

    The only way to refresh the web properties list is to clear the authorization and authorize again.

    Each website can have its own GA account and using User Management feature all properties can be shared with your account (for example). You can also use this feature to easily transfer properties between accounts without loosing stats.

    I don't know exactly your organizational chart but you should be able to organize in such a way that a single GA account wont need to authorize more than 25 websites.

  12. Gregg Banse
    Member
    Posted 1 year ago #

    I tried clearing the authorization but they still show up. These are in the error log - not the property selection. Is there a way to clear the log?

    I have several "Accounts" under one GA User. Then each of the Accounts can have up to 10 "Properties". We have 55 Properties in total and each one needs access to it's own GA on the dashboard. I'm wondering if I need to create more accounts or Google users and split the Accounts between the users?

  13. Alin Marcu
    Member
    Plugin Author

    Posted 1 year ago #

    I'm thinking about adding an option on WPMU to authorize only once for the entire network, from Network Admin dashboard. I think this will solve your issue and will increase WPMU compatibility.

  14. Gregg Banse
    Member
    Posted 1 year ago #

    That would be great Alin but do you have a timeline for completing that project?

  15. Kash
    Member
    Posted 1 year ago #

    Hi Alin,

    I have the same problem. When I ask for a new access code for a new sub-site then the stats are the same as on the main-site.

    It would be great to have the option to authorize only once for a multisite installation. i think that in this way should work better.

    Please keep us update on this.
    Best thanks.
    Regards,
    patrizio

  16. Alin Marcu
    Member
    Plugin Author

    Posted 1 year ago #

    @pcasciaro please open your own topic, your problem is not related to this topic.

    @lorax most probably with the 4.3 release, it may take a while.

  17. Gregg Banse
    Member
    Posted 1 year ago #

    Hi Alin,
    Thanks for the reply. How long is a while? Our window of opportunity closes Aug 1. Can do before then?

    G

  18. Alin Marcu
    Member
    Plugin Author

    Posted 1 year ago #

    @lorax a new beta version (4.2.22b) is available here: https://github.com/deconf/google-analytics-dashboard-for-wp/releases

    On network admin you'll have some additional settings which will enable you to use a single authorization for the entire network.

    When you have time, give it a try and submit bugs/suggestions, if any.

  19. Gregg Banse
    Member
    Posted 1 year ago #

    Thanks Alin,
    I've been away on vacation and am just now getting situated. I'll download and test the beta later this week. Thanks again!

    G

  20. Alin Marcu
    Member
    Plugin Author

    Posted 1 year ago #

    All multisite improvements and features are available in version 4.3, if you update you should see the new menu in your Network Admin.

  21. Gregg Banse
    Member
    Posted 1 year ago #

    ROFL. Sometimes it pays to be late. :)

    Thanks!

  22. Gregg Banse
    Member
    Posted 1 year ago #

    Suggestion: On the Network Setup page, you might want to give the user an option to ignore certain web properties. Example, we have a multi-site setup that has two defunct web properties but they show up in the list.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Google Analytics Dashboard for WP
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic