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.19k stars 2.57k forks source link

piwik.js enhancements #739

Closed robocoder closed 13 years ago

robocoder commented 15 years ago

With the JavaScript tracking API in #355 completed, we can turn our attention to some internals:

On the horizon:

Deferred:

Wontfix:

mattab commented 15 years ago

looks good, I just don't think we can set a milestone for removing the deprecated legact tracking: we can't force users to re-tag their websites (think how many thousands websites are concerned).

a great thing that you could do, would be to write a blog post summarizing how we built this cool new functionnality: aggregating user feature requests, bug reports, analyzing how competition works, multiple code reviews, how did you test the code on multiple browsers, writing javascript unit tests, packaging (YUI), etc.

What do you think?

robocoder commented 13 years ago

More ideas (mentioned elsewhere):

To avoid distorted stats, provide optional support for:

robocoder commented 13 years ago

(In [3163]) refs #739, refs #1694 - instead of a bing cache buster, detect when page is loaded from google or bing cache, and apply a fix to the url

robocoder commented 13 years ago

(In [3164]) refs #739, refs #1694 - fallback to the cache url if we can't parse it

robocoder commented 13 years ago

(In [3165]) refs #1694, refs #739 - make cacheFixup() testable

robocoder commented 13 years ago

(In [3167]) refs #1694, refs #739 - Yahoo's cache result is served from Inktomi allocated ip addresses

robocoder commented 13 years ago

(In [3172]) refs #739 - drop IE5 support (arguments.callee removed in ES5 spec but at present, no browser appears to implement strict mode)

robocoder commented 13 years ago

See http://forum.piwik.org/index.php?showtopic=16661 for Xaver's async mods.

robocoder commented 13 years ago

(In [3284]) refs #739 - add DEBUG markers so that the unit test scaffolding can be removed from the production script

robocoder commented 13 years ago

Note; Compressing piwik.js via yuicompressor currently results in a 9079 bytes long file (using the sed instructions in the README). For comparison, compressing via uglifyjs (which requires nodejs) results in a shorter file, only 8660 bytes long.

robocoder commented 13 years ago

(In [3285]) refs #739 - clarify that these are test hooks ... they were never practical in production due to name mangling by yuicompressor

mattab commented 13 years ago

Currently, the Bing / Google cache fixups are done in piwik.js. This is better than before, however it will result in inconsistent results when the Tracking API is used, as it will not go through piwik.js and therefore Bing/Google cache will not be tracked the same.

robocoder commented 13 years ago

(In [3374]) fixes #1842, refs #739 - implement asynchronous tracking (thanks Xaver); see updated documentation, http://piwik.org/doc/javascript-tracking/

robocoder commented 13 years ago

(In [3375]) refs #1842, refs #739 - implement push functions

robocoder commented 13 years ago

merging suggestions from comments into main ticket description; adding a couple for completeness

robocoder commented 13 years ago

(In [3686]) refs #739, refs 409 - updated to pass jslint 2011-01-06; includes the prototype first-party cookie implementation (not up-to-date with recent discussions with matt)

robocoder commented 13 years ago

Going to sleep on this. Too tired to decide whether this would be a feature or considered a security risk?

// automatically use a subdomain wildcard
if (!configCookieDomain && locationHostnameAlias.substr(0, 4) === 'www.') {
    configCookieDomain = locationHostnameAlias.substr(3);
} else if (isString(configCookieDomain) && configCookieDomain.substr(0, 4) === 'www.') {
    configCookieDomain = configCookieDomain.substr(3);
}
robocoder commented 13 years ago

(In [3783]) refs #409 - first party cookies

    var visitorId;

    _paq.push(function () {
        visitorId = this.getVisitorId();
    });

refs #739 - piwik.js improvements

refs #752 - track middle mouse button clicks (via mousedown+mouseup pseudo-click handler); defaults to tracking true "clicks"

refs #1984 - custom variables vs custom data

@todo These are just stubs.

    tracker.setCustomData(null);
mattab commented 13 years ago

Reopening, as I have questions / clarifications


addEventListener(element, 'click', clickHandler, false);
addEventListener(element, 'click', clickHandler, false); 
robocoder commented 13 years ago

(In [3788]) fixes #739 - addEventListeners() on mouseup and mousedown; good catch, Matt!

refs #2041 - setHeartBeatTimer - uses setTimeout, so it happens only once (vs setInterval is recurring); only happens on the landing page; intended to be used to improve bounce rate report; changed it to send ping=1 in the request

robocoder commented 13 years ago

(In [3792]) refs #739 - updated to jslint 2011-01-21 which has coding style checks added (e.g., indentation)

robocoder commented 13 years ago

(In [3793]) refs #739 - use JSON reference implementation given that we included both stringify() and json_parse(); some minor mods for greater browser portability

Also:

robocoder commented 13 years ago

(In [3795]) refs #739 - add Jash - JavaScript shell (GPL) to tests/javascript

robocoder commented 13 years ago

(In [3796]) refs #739 - prevent multiple instances of Jash; use the self-hosted copy of Jash.css; include missing icon