Closed blubbll closed 4 years ago
@Toub That sounds like a reasonable solution that would both still protect inexperienced users and allow custom URLs.
If you create a PR, I'll release a new version.
Looking at the code, this is already supported:
Constructor:
/**
* @constructor
* @param {Number} siteId Id of the site you want to track
* @param {String} trackerUrl URL of your Matomo instance
* @param {Boolean} [true] noURLValidation Set to true if the `piwik.php` has been renamed
*/
function MatomoTracker (siteId, trackerUrl, noURLValidation) {
// [...]
if (!noURLValidation) {
assert.ok(trackerUrl.endsWith('matomo.php') || trackerUrl.endsWith('piwik.php'), 'A tracker URL must end with "matomo.php" or "piwik.php"');
}
Test:
it('should allow invalid URL if noURLValidation is set', () => {
(() => new MatomoTracker(1, 'http://example.com/index.php', true)).should.not.throw(/tracker/);
});
l will send a PR with a simple documentation update.
If I use a proxy to rename the URL, I should be able to use a different URL ending.
However, the client throws an error:
I understand this can save a lot of time for users who provide a wrong URL.
So, what about providing an extra parameter to allow to provide any URL?