INN / Google-Analytics-Popular-Posts

A WordPress plugin that uses Google Analytics data to determine the most popular posts on your site and display a list of popular posts via the included widget.
https://wordpress.org/plugins/ga-popular-posts/
23 stars 7 forks source link

Google API exceptions are not reported #71

Closed foliovision closed 4 years ago

foliovision commented 7 years ago

I had a though time putting in the "Property View ID". The cron was just hanging up and no stats were fetched.

I had to check the PHP error logs to see:

2017/02/02 07:10:22 [error] 13163#13163: *165176 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught exception 'Google_Service_Exception' with message 'Error calling GET https://www.googleapis.com/analytics/v3/data/ga?ids=UA-45376815-1&start-date=today&end-date=today&metrics=ga%3Asessions%2Cga%3Apageviews%2Cga%3Aexits%2Cga%3AbounceRate%2Cga%3AavgSessionDuration%2Cga%3AavgTimeOnPage&dimensions=ga%3ApagePath&max-results=1000&sort=-ga%3Asessions: (400) Invalid value 'UA-1234567-1'. Values must match the following regular expression: 'ga:[0-9]+'' in /var/www/wp-content/plugins/ga-popular-posts/api/src/Google/Http/REST.php:76
Stack trace:
#0 /var/www/wp-content/plugins/ga-popular-posts/api/src/Google/Http/REST.php(41): Google_Http_REST::decodeHttpResponse(Object(Google_Http_Request))
#1 /var/www/wp-content/plugins/ga-popular-posts/api/src/Google/Client.php(546): Google_Http_REST::execute(Object(Google_Client), Object(Google_Http_Request))
#2 /var/www/wp-content/plugins/ga-popular-posts/api/src/Google/Service/Resource.php(190): Google_Client->execute(Object(Google_Http_" while reading response header from upstream, client: 54.84.129.139, server: www.site.com, request: "POST /wp-cron.php?doing_wp_cron=1486044622.0374679565429687500000 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-user.sock:", host: "site.com", referrer: "http://site.com/wp-cron.php?doing_wp_cron=1486044622.0374679565429687500000"

It should just be showing this right on that screen:

Invalid value 'UA-1234567-1'. Values must match the following regular expression: 'ga:[0-9]+'