piwik does not work, error when connecting to script
-
Hello,
i have issue after some WP PIWIK update. I can not connect to script. It is installed on the same server as WordPress.
THis is the error i receive:WP-Piwik 1.0.1 konnte sich mit Deiner Konfiguration nicht mit Piwik verbinden. Bitte überprüfe die ?Mit Piwik verbinden?-Sektion unten.
So, Piwik url and Token are correct.
Please help. Thanks!
-
Sorry, I was not able to check this yesterday. I will do so today.
Thank you, i hope we can solve this.
Works like a charm here:
https://www.tiikoni.com/tis/view/?id=35c754f
https://www.tiikoni.com/tis/view/?id=563820bAre you using a caching plugin or tool? Can you try to disable WP-Piwik’s caching (Settings -> WP-Piwik -> Expert settings)?
Btw. are you sure the plugin connection stopped working with updating the plugin? Maybe you did not check the stats and settings several days before the update and WP-Piwik just continued adding the previously fetched tracking code… with updating the plugin, you checked the settings and the error occurred? –> In this case, please also check if changes to the server configuration were made (“400 Bad request”). E.g., some hosts don’t allow HTTP requests to the local machine.
Sorry for the delay. I’ve removed identifying URL for security. If i’m reading this correct, i’m getting a 401 Unauthorized error. Not sure why though, everything was working properly before update. I have not tried to reset plugin yet though. Will after response.
Thank you for your time
WP-Piwik 1.0.1 Mode: http Test 1/3: global.getPiwikVersion bool(false) array(2) { [0]=> string(345) "HTTP/1.1 401 Unauthorized Date: Thu, 04 Jun 2015 04:58:53 GMT Server: Apache X-Powered-By: PHP/5.4.38 Pragma: Expires: Cache-Control: no-store, must-revalidate X-Frame-Options: sameorigin Set-Cookie: PIWIK_SESSID=2bb141d4ef7c507182d785840ec6c6b2; path=/; HttpOnly Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 " [1]=> string(150) "https://www.analytics.DOMAIN_NAME.com/?module=API&method=API.getBulkRequest&format=php&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3Dn%2Fa&token_auth=..." } Test 2/3: SitesManager.getSitesWithAtLeastViewAccess bool(false) array(2) { [0]=> string(345) "HTTP/1.1 401 Unauthorized Date: Thu, 04 Jun 2015 04:58:54 GMT Server: Apache X-Powered-By: PHP/5.4.38 Pragma: Expires: Cache-Control: no-store, must-revalidate X-Frame-Options: sameorigin Set-Cookie: PIWIK_SESSID=d3fe72d24cb774f7bcce4e3287c8193e; path=/; HttpOnly Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 " [1]=> string(227) "https://www.analytics.DOMAIN_NAME.com/?module=API&method=API.getBulkRequest&format=php&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3Dn%2Fa&urls[1]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3Dn%2Fa&token_auth=..." } Test 3/3: SitesManager.getSitesIdFromSiteUrl bool(false) array(2) { [0]=> string(345) "HTTP/1.1 401 Unauthorized Date: Thu, 04 Jun 2015 04:58:54 GMT Server: Apache X-Powered-By: PHP/5.4.38 Pragma: Expires: Cache-Control: no-store, must-revalidate X-Frame-Options: sameorigin Set-Cookie: PIWIK_SESSID=98e0801c9ea361f991c46fc1661fe26d; path=/; HttpOnly Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 " [1]=> string(336) "https://www.analytics.DOMAIN_NAME.com/?module=API&method=API.getBulkRequest&format=php&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3Dn%2Fa&urls[1]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3Dn%2Fa&urls[2]=method%3DSitesManager.getSitesIdFromSiteUrl%26idSite%3Dn%2Fa%26url%3Dhttp%3A%2F%2Fwww.CLIENT_DOMAIN_NAME.org&token_auth=..." } array(2) { ["global_settings"]=> array(52) { ["revision"]=> string(10) "2015053001" ["last_settings_update"]=> string(10) "1433195530" ["piwik_mode"]=> string(4) "http" ["piwik_url"]=> string(33) "https://www.analytics.DOMAIN_NAME.com/" ["piwik_path"]=> string(33) "https://www.analytics.DOMAIN_NAME.com/" ["piwik_user"]=> string(0) "" ["piwik_token"]=> string(3) "set" ["auto_site_config"]=> string(1) "1" ["default_date"]=> string(9) "yesterday" ["stats_seo"]=> string(1) "0" ["dashboard_widget"]=> string(6) "last30" ["dashboard_chart"]=> string(1) "0" ["dashboard_seo"]=> string(1) "0" ["toolbar"]=> string(1) "0" ["capability_read_stats"]=> array(5) { ["administrator"]=> string(1) "1" ["editor"]=> string(1) "0" ["author"]=> string(1) "0" ["contributor"]=> string(1) "0" ["subscriber"]=> string(1) "0" } ["perpost_stats"]=> string(1) "0" ["plugin_display_name"]=> string(8) "WP-Piwik" ["piwik_shortcut"]=> string(1) "0" ["shortcodes"]=> string(1) "0" ["track_mode"]=> string(7) "default" ["track_codeposition"]=> string(6) "footer" ["track_noscript"]=> string(1) "0" ["track_nojavascript"]=> string(1) "0" ["proxy_url"]=> string(0) "" ["track_content"]=> string(8) "disabled" ["track_search"]=> string(1) "0" ["track_404"]=> string(1) "1" ["add_post_annotations"]=> string(1) "0" ["add_customvars_box"]=> string(1) "1" ["add_download_extensions"]=> string(0) "" ["disable_cookies"]=> string(1) "0" ["limit_cookies"]=> string(1) "0" ["limit_cookies_visitor"]=> string(7) "1209600" ["limit_cookies_session"]=> string(1) "0" ["limit_cookies_referral"]=> string(8) "15778463" ["track_admin"]=> string(1) "0" ["capability_stealth"]=> array(1) { ["administrator"]=> string(1) "1" } ["track_across"]=> string(1) "0" ["track_across_alias"]=> string(1) "0" ["track_feed"]=> string(1) "1" ["track_feed_addcampaign"]=> string(1) "0" ["track_feed_campaign"]=> string(4) "feed" ["cache"]=> string(1) "0" ["disable_timelimit"]=> string(1) "0" ["connection_timeout"]=> string(1) "5" ["disable_ssl_verify"]=> string(1) "0" ["piwik_useragent"]=> string(3) "php" ["piwik_useragent_string"]=> string(8) "WP-Piwik" ["track_datacfasync"]=> string(1) "0" ["track_cdnurl"]=> string(0) "" ["track_cdnurlssl"]=> string(0) "" ["force_protocol"]=> string(8) "disabled" } ["settings"]=> array(6) { ["name"]=> string(0) "" ["site_id"]=> string(3) "n/a" ["noscript_code"]=> string(0) "" ["tracking_code"]=> string(0) "" ["last_tracking_code_update"]=> string(10) "1433195530" ["dashboard_revision"]=> string(1) "0" } }
no caching tools/plugins etc.. i have tried like you suggested and it still doesnt work. At the end i can send you WP login and just go through the settings.
It was working normally and after update was broken connection. I didn’t do anything else except waiting for new Plugin version because there was some discussion that Plugin update broke the connection. So i was hoping that one of the next updates will solve the issue.Can possibly be a problem with some other plugin? Like incompatibility or smth?
Ok so what i did, i have changed connection to be like this:
https://i.imgur.com/4HW8hUg.jpg
because it is installed on the same server and it start working. It looks like some http connection but issue on server, i guess.
Ok, nice to hear the PHP connection works for you. The configuration is complicated for most users, but if it works, it’s a good choice because it is a more stable solution.
But can you, please, just do one more test, even if it’s working as expected, now? I still hope to get behind the issue, so I can help other users with a similar connection problem.
Just copy and paste the following little test script into a PHP file at your server. Please replace the URLs with your blog URL and your Piwik URL and access the script using your browser.
Does this script deliver meaningful results or do you still get a “400 Bad request”?
<pre><?php $sites[] = "https://www.example.com/"; $sites[] = "https://piwik.example.com/"; foreach ($sites as $site) { echo "=== CURL ===\n\n"; if (function_exists('curl_init')) { $c = curl_init($site); curl_setopt($c, CURLOPT_POST, 1); curl_setopt($c, CURLOPT_POSTFIELDS, "" ); curl_setopt($c, CURLOPT_USERAGENT, ini_get('user_agent') ); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($c, CURLOPT_HEADER, 1 ); curl_setopt($c, CURLOPT_TIMEOUT, 60 ); $result = curl_exec($c); curl_close($c); var_dump($result); } else echo "cURL not available\n\n"; echo "=== FOPEN ===\n\n"; $context = stream_context_create(array('http'=>array('timeout' => 60 ))); $result = file_get_contents($site, false, $context); $headers = get_headers($site, 1); var_dump($headers); var_dump($result); } ?></pre>
Lil Chris: Your issue is not related to this one, because you get NO 400 Bad request. In fact, your test script answers “401 Unauthorized”. So the access to your Piwik server is restricted in some way, e.g. by htpasswd or defined IP ranges. First you should check your .htaccess configuration. If you need further support, please create your own thread with more details.
ok, thanks.
- The topic ‘piwik does not work, error when connecting to script’ is closed to new replies.