matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.71k stars 2.62k forks source link

TrackerConfig altering supplied url #11688

Closed Rockvole closed 7 years ago

Rockvole commented 7 years ago

I configured my server for web and android analytics like this : /js/p.php is a symbolic link to /piwik/piwik.php /js/p.js is a symbolic link to /piwik/p.js The piwik directory is restricted access to my ip only.

I did this since I noticed that ublock origin blocks any url with the word "piwik" in it so my requests were not getting through. It seems that TrackerConfig is altering my supplied /js/p.php to /js/p.php/piwik.php

mattab commented 7 years ago

It seems that TrackerConfig is altering my supplied /js/p.php to /js/p.php/piwik.php

What do you mean by this?

Rockvole commented 7 years ago

From TrackerConfig.java :

public TrackerConfig(@NonNull String apiUrl, int siteId, String trackerName) {
        try {
            if (apiUrl.endsWith("piwik.php") || apiUrl.endsWith("piwik-proxy.php")) {
                mApiUrl = new URL(apiUrl);
            } else {
                if (!apiUrl.endsWith("/")) apiUrl += "/";
                mApiUrl = new URL(apiUrl + "piwik.php");
            }
        } catch (MalformedURLException e) { throw new RuntimeException(e); }
        mSiteId = siteId;
        mTrackerName = trackerName;
    }

The code is forcing all url's to contain piwik, when any url's containing piwik will be blocked by ublock origin.

mattab commented 7 years ago

@Rockvole please report the issue in the Java SDK issue tracker here: https://github.com/piwik/piwik-java-tracker/issues