JavaScript error: Failed to load resource

Everything seems to load fine, but no visits are tracked. Found another thread with similiar problem that said open “Open Developer Tools” in Chrome and see if there’s any error, so I did and this is what I found:
Failed to load resource: http://MYSITE.se/wp-content/plugins/wp-piwik/proxy/piwik.php the server responded with a status of 500 (Internal Server Error)

I've visited the site with Firefox, Chrome and MS Edge from two different computers but no visits gets recorded

I’ve tried finding out what to do next, but no luck, so appreciate any thoughts on how to fix this

We are going to need more details before we can even hazard a guess.

What happens when you go to that URL in your browser? Do you get anything in your server log? How is Piwik installed and where? Are you using straight PHP or Javascript? Any other pertinent details.

The site loads like it should, the tracking code is viewable when checking

It’s installed on my VPS, using PHP API and proxy mode since I want to track a WP-multisite installation without giving away details on tracking URL which would leave a footprint that I’m not too keen on leaving (building a PBN)

And yes, using WP-Piwik to connect (which seems to work fine…)

…and no…not sure what happens in log-files, never looked at them, not that tech-savvy…

Data from the testscript (all sites removed…)

`WP-Piwik 1.0.11
Mode: php

Test 1/3: global.getPiwikVersion

array(1) {
[“value”]=>
string(6) “2.16.2”
}

array(1) {
[0]=>
string(73) “module=API&format=json&method=API.getPiwikVersion&idSite=1&token_auth=…”
}

Test 2/3: SitesManager.getSitesWithAtLeastViewAccess

array(110) {
[0]=>
array(17) {
[“idsite”]=>
string(1) “1”
[“name”]=>
string(11) “** Empty **”
[“main_url”]=>
string(20) “http://80.248.227.66
[“ts_created”]=>
string(19) “2016-09-06 13:30:49”
[“ecommerce”]=>
string(1) “0”
[“sitesearch”]=>
string(1) “1”
[“sitesearch_keyword_parameters”]=>
string(0) “”
[“sitesearch_category_parameters”]=>
string(0) “”
[“timezone”]=>
string(16) “Europe/Stockholm”
[“currency”]=>
string(3) “USD”
[“exclude_unknown_urls”]=>
string(1) “0”
[“excluded_ips”]=>
string(0) “”
[“excluded_parameters”]=>
string(0) “”
[“excluded_user_agents”]=>
string(0) “”
[“group”]=>
string(0) “”
[“type”]=>
string(7) “website”
[“keep_url_fragment”]=>
string(1) “0”
}

*** BIG BUNCH OF SITES LOOKING THE SAME AS ABOVE ***

array(1) {
[0]=>
string(96) “module=API&format=json&method=SitesManager.getSitesWithAtLeastViewAccess&idSite=1&token_auth=…”
}

Test 3/3: SitesManager.getSitesIdFromSiteUrl

array(1) {
[0]=>
array(1) {
[“idsite”]=>
string(1) “1”
}
}

array(1) {
[0]=>
string(113) “module=API&format=json&method=SitesManager.getSitesIdFromSiteUrl&idSite=1&url=http://80.248.227.66&token_auth=…”
}

array(2) {
[“global_settings”]=>
array(59) {
[“revision”]=>
string(10) “2016090101”
[“last_settings_update”]=>
string(10) “1473168981”
[“piwik_mode”]=>
string(3) “php”
[“piwik_url”]=>
string(26) “/home/www/wordpress/piwik/”
[“piwik_path”]=>
string(26) “/home/www/wordpress/piwik/”
[“piwik_user”]=>
string(0) “”
[“piwik_token”]=>
string(3) “set”
[“auto_site_config”]=>
string(1) “1”
[“default_date”]=>
string(5) “today”
[“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(5) “proxy”
[“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) “1”
[“track_404”]=>
string(1) “1”
[“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”
[“track_user_id”]=>
string(8) “disabled”
[“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”
[“disable_ssl_verify_host”]=>
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) “1”
[“noscript_code”]=>
string(135) “


[“tracking_code”]=>
string(545) "

"
[“last_tracking_code_update”]=>
string(10) “1473282084”
[“dashboard_revision”]=>
string(1) “0”
}
}
`

I just did a test adding an outside site, and then all worked smoothly…`

The tracking code being used that’s not working is this:

<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//80.248.227.66/wp-content/plugins/wp-piwik/proxy/"
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', '1']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.php'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Piwik Code -->

And the code used that was working:

    <!-- Piwik -->
    <script type="text/javascript">
      var _paq = _paq || [];
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="//80.248.227.66/piwik/";
        _paq.push(['setTrackerUrl', u+'piwik.php']);
        _paq.push(['setSiteId', '1']);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <noscript><p><img src="//80.248.227.66/piwik/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
    <!-- End Piwik Code -->

So maybe this is only related to the plugin…?

…just realized setSiteId was for another site and not the real testsite, but still, hits was tracked…

Just tested running the working code above in a HTML-file on the VPS where I have problem, and it worked fine, so seems to be something wrong with the code the WP-Piwik plugin is using…

Does http://80.248.227.66/wp-content/plugins/wp-piwik/proxy/piwik.php exist?

Haven’t had time to look inte this any further yet, but that file exists

got me beat. I don’t use it that way . Perhaps someone more knowlegeable than me can help.