diff --git a/README.md b/README.md index 3cff84ac..cf9a7ab8 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,7 @@ Run `makejs -t` to list all possible targets. * localization now in separate files * updates translations * adds `he` translation by [Tomer Cohen](https://github.com/tomer) -* updates [jQuery](http://jquery.com) to 1.8.0 -* updates [HTML5 ★ Boilerplate](http://html5boilerplate.com) to 4.0.0 +* updates 3rd party libs ### v0.21 - *2012-08-06* diff --git a/src/_h5ai/config.js b/src/_h5ai/config.js index 603235ea..6e028073 100644 --- a/src/_h5ai/config.js +++ b/src/_h5ai/config.js @@ -195,10 +195,11 @@ var H5AI_CONFIG = { /* [all] Adds Piwik tracker javascript code. + baseURL without protocol */ "piwik-analytics": { "enabled": false, - "baseURL": "mydomain.tld/piwik", /* no protocol */ + "baseURL": "mydomain.tld/piwik", "idSite": 1 }, diff --git a/src/_h5ai/js/inc/ext/piwik-analytics.js b/src/_h5ai/js/inc/ext/piwik-analytics.js index e56d9ad4..dd73f890 100755 --- a/src/_h5ai/js/inc/ext/piwik-analytics.js +++ b/src/_h5ai/js/inc/ext/piwik-analytics.js @@ -1,38 +1,33 @@ - -modulejs.define('ext/piwik-analytics', ['_', 'core/settings'], function (_, allsettings) { - - var defaults = { - enabled: false, - "baseURL": "not-set", - "idSite": 0 - }, - - template = function(baseURL, idSite) { - - return '' - } - - settings = _.extend({}, defaults, allsettings['piwik-analytics']), - - init = function () { - - if (!settings.enabled) { - return; - } - - var $body = $('body'); - - $body.append(template(settings.baseURL, settings.idSite)); - }; - - init(); -}); + +modulejs.define('ext/piwik-analytics', ['_', '$', 'core/settings'], function (_, $, allsettings) { + + var defaults = { + enabled: false, + baseURL: 'not-set', + idSite: 0 + }, + + settings = _.extend({}, defaults, allsettings['piwik-analytics']), + + init = function () { + + if (!settings.enabled) { + return; + } + + // reference: http://piwik.org/docs/javascript-tracking/ + + var pkBaseURL = (("https:" === document.location.protocol) ? "https://" : "http://") + settings.baseURL + '/'; + + $('