Having trouble setting up self hosted WP-Piwik

EDIT: I’ve subsequently realised this is the wrong place to publish this, and published it here: https://wordpress.org/support/topic/wp-piwik-106-was-not-able-to-connect-to-piwik-using-your-configuration?replies=1#post-7913517

Hi

I followed the official guides:
http://piwik.org/docs/installation/#the-5-minut-piwik-installation

Everything went fine, I saved the files inside the piwik folder to:
/html_public/analytics.
I copied the contents of the extracted folder piwik, rather than the folder itself, to that location.
I’m able to access the interface via http://analytics.mydomain.com.

I’ve installed the WP-Piwik add-on for Wordpress and on the Connect to Piwik page entered the following:

Piwik Mode: Self Hosted (HTTP API, default)
Piwik URL: analytics.mydomain.com
Auth token: copied and pasted everything after &token_auth= from the API page.

When I click Save Changes I get:

WP-Piwik 1.0.6 was not able to connect to Piwik using your configuration. Check the »Connect to Piwik« section below.

I’ve used a few options in the Support section of the plugin confirmation screens, including Reset WP-Piwik.

The output of the testscript follows:

`WP-Piwik 1.0.6
Mode: http

Test 1/3: global.getPiwikVersion

bool(false)

array(2) {
[0]=>
string(300) "HTTP/1.1 400 Bad Request
Server: nginx
Date: Wed, 20 Jan 2016 14:37:37 GMT
Content-Type: text/html
Content-Length: 1393
Connection: keep-alive
Last-Modified: Mon, 14 Jul 2014 12:31:44 GMT
ETag: “1e12ef-571-4fe26794acc00”
Accept-Ranges: bytes
Host-Header: 192fc2e7e50945beb8231a492d6a8024

"
[1]=>
string(140) “analytics.mydomain.com/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3De&token_auth=…”
}

Test 2/3: SitesManager.getSitesWithAtLeastViewAccess

bool(false)

array(2) {
[0]=>
string(300) "HTTP/1.1 400 Bad Request
Server: nginx
Date: Wed, 20 Jan 2016 14:37:37 GMT
Content-Type: text/html
Content-Length: 1393
Connection: keep-alive
Last-Modified: Mon, 14 Jul 2014 12:31:44 GMT
ETag: “1e12ef-571-4fe26794acc00”
Accept-Ranges: bytes
Host-Header: 192fc2e7e50945beb8231a492d6a8024

"
[1]=>
string(213) “analytics.mydomain.com/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3De&urls[1]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3De&token_auth=…”
}

Test 3/3: SitesManager.getSitesIdFromSiteUrl

bool(false)

array(2) {
[0]=>
string(300) "HTTP/1.1 400 Bad Request
Server: nginx
Date: Wed, 20 Jan 2016 14:37:37 GMT
Content-Type: text/html
Content-Length: 1393
Connection: keep-alive
Last-Modified: Mon, 14 Jul 2014 12:31:44 GMT
ETag: “1e12ef-571-4fe26794acc00”
Accept-Ranges: bytes
Host-Header: 192fc2e7e50945beb8231a492d6a8024

"
[1]=>
string(315) “analytics.mydomain.com/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3De&urls[1]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3De&urls[2]=method%3DSitesManager.getSitesIdFromSiteUrl%26idSite%3De%26url%3Dhttp%3A%2F%2Fduncanbetts.com&token_auth=…”
}

array(2) {
[“global_settings”]=>
array(57) {
[“revision”]=>
string(10) “2016010901”
[“last_settings_update”]=>
string(10) “1453300602”
[“piwik_mode”]=>
string(4) “http”
[“piwik_url”]=>
string(26) “analytics.mydomain.com/
[“piwik_path”]=>
string(23) “/public_html/analytics/”
[“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(8) “disabled”
[“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(8) “disabled”
[“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) “0”
[“add_post_annotations”]=>
string(1) “0”
[“add_customvars_box”]=>
string(1) “0”
[“add_download_extensions”]=>
string(0) “”
[“set_download_extensions”]=>
string(0) “”
[“disable_cookies”]=>
string(1) “0”
[“limit_cookies”]=>
string(1) “0”
[“limit_cookies_visitor”]=>
string(8) “34186669”
[“limit_cookies_session”]=>
string(4) “1800”
[“limit_cookies_referral”]=>
string(8) “15778463”
[“track_admin”]=>
string(1) “0”
[“capability_stealth”]=>
array(0) {
}
[“track_across”]=>
string(1) “0”
[“track_across_alias”]=>
string(1) “0”
[“track_feed”]=>
string(1) “0”
[“track_feed_addcampaign”]=>
string(1) “0”
[“track_feed_campaign”]=>
string(4) “feed”
[“track_heartbeat”]=>
string(1) “0”
[“cache”]=>
string(1) “1”
[“http_connection”]=>
string(4) “curl”
[“http_method”]=>
string(4) “post”
[“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”
[“update_notice”]=>
string(7) “enabled”
}
[“settings”]=>
array(6) {
[“name”]=>
string(0) “”
[“site_id”]=>
string(1) “e”
[“noscript_code”]=>
string(0) “”
[“tracking_code”]=>
string(0) “”
[“last_tracking_code_update”]=>
string(1) “0”
[“dashboard_revision”]=>
string(1) “0”
}
}
`

Any idea what I should do next? I understand HTTP Error 400 to mean malformed request so I don’t know what to try next.

I’ve replaced my domain name with mydomain above.

This problem I believe was caused by that I’m using shared hosting (SiteGround Starter Plan for WordPress to be exact). I resolved it by selecting PHP API instead of HTTP API and connecting that way instead.
I found my full server path in File Manager in cPanel.

1 Like