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.93k stars 2.66k forks source link

piwik.js modernization #8515

Open robocoder opened 9 years ago

robocoder commented 9 years ago

I'm AFK so I can't test this and submit a PR, but overall is fairly trivial...

The now variable here isn't being used in logPageView(), so it can be removed:

now = new Date(),

I suggest getting rid of this workaround:

Date.prototype.getTimeAlias = Date.prototype.getTime;

and change the many occurrences of something = new Date() ... something.getTime() to +new Date (the '+' casts the object to an integer, thus yielding the time in milliseconds).

It's been 4 years, I recommend removing the JSON polyfill as native browser support has improved (and this line means it can no longer polyfill broken JSON implementations):

JSON2 = window.JSON || {};

Wrap utf8_encode and sha1 into a polyfill for crypto.subtle.digest.

mattab commented 9 years ago

Thanks for suggestions @robocoder. I think @dhoko also suggested some of these before. pull request(s) are most welcome :-)