Plugin system improvements

+ piwik analytics plugin (not tested)
This commit is contained in:
RainLoop Team 2014-09-25 19:37:11 +04:00
parent 4c38993c26
commit 085095b717
11 changed files with 137 additions and 11 deletions

View file

@ -0,0 +1,32 @@
$(function () {
var
sPiwikURL = '' + window.rl.pluginSettingsGet('piwik-analytics', 'piwik_url'),
sSiteID = '' + window.rl.pluginSettingsGet('piwik-analytics', 'site_id')
;
if ('' !== sPiwikURL && '' !== sSiteID)
{
sPiwikURL = sPiwikURL.replace(/[\\\/\s]+$/, '') + '/';
if (/^https?:/i.test(sPiwikURL))
{
sPiwikURL = 'http://' + sPiwikURL;
}
window._paq = window._paq || [];
(function(window){
window._paq.push(['setSiteId', sSiteID]);
window._paq.push(['setTrackerUrl', sPiwikURL + 'piwik.php']);
window._paq.push(['trackPageView']);
window.setInterval(function () {
window._paq.push(['trackPageView']);
}, 1000 * 60 * 2);
var d = window.document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript'; g.defer = true; g.async = true; g.src = sPiwikURL + 'piwik.js';
if (s && s.parentNode) {
s.parentNode.insertBefore(g, s);
}
}(window));
}
});