mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Move plugins to webmail repository.
This commit is contained in:
parent
17958b15cb
commit
cf0968b5a8
32 changed files with 4348 additions and 0 deletions
95
plugins/google-analytics/js/include.js
Normal file
95
plugins/google-analytics/js/include.js
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
|
||||
$(function () {
|
||||
|
||||
var
|
||||
sAccount = window.rl.pluginSettingsGet('google-analytics', 'account'),
|
||||
sDomain = window.rl.pluginSettingsGet('google-analytics', 'domain_name'),
|
||||
bUniversalAnalytics = !!window.rl.pluginSettingsGet('google-analytics', 'universal_analytics'),
|
||||
bTrackPageview = !!window.rl.pluginSettingsGet('google-analytics', 'track_pageview'),
|
||||
bSendEvent = !!window.rl.pluginSettingsGet('google-analytics', 'send_events'),
|
||||
fSendEvent = null
|
||||
;
|
||||
|
||||
if (sAccount && '' !== sAccount)
|
||||
{
|
||||
if (bUniversalAnalytics)
|
||||
{
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
if (window.ga)
|
||||
{
|
||||
if (sDomain)
|
||||
{
|
||||
window.ga('create', sAccount, sDomain);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.ga('create', sAccount);
|
||||
}
|
||||
|
||||
if (bTrackPageview)
|
||||
{
|
||||
window.ga('send', 'pageview');
|
||||
window.setInterval(function () {
|
||||
window.ga('send', 'pageview');
|
||||
}, 1000 * 60 * 2);
|
||||
}
|
||||
|
||||
if (bSendEvent)
|
||||
{
|
||||
fSendEvent = function(sCategory, sAction, sLabel) {
|
||||
window.ga('send', 'event', sCategory, sAction, sLabel);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
window._gaq = window._gaq || [];
|
||||
window._gaq.push(['_setAccount', sAccount]);
|
||||
|
||||
if (sDomain)
|
||||
{
|
||||
window._gaq.push(['_setDomainName', sDomain]);
|
||||
}
|
||||
|
||||
if (bTrackPageview)
|
||||
{
|
||||
window._gaq.push(['_trackPageview']);
|
||||
window.setInterval(function () {
|
||||
window._gaq.push(['_trackPageview']);
|
||||
}, 1000 * 60 * 2);
|
||||
}
|
||||
|
||||
if (bSendEvent)
|
||||
{
|
||||
fSendEvent = function(sCategory, sAction, sLabel) {
|
||||
window._gaq.push(['_trackEvent', sCategory, sAction, sLabel]);
|
||||
};
|
||||
}
|
||||
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
}
|
||||
|
||||
if (fSendEvent)
|
||||
{
|
||||
window.rl.addHook('ajax-default-response', function (sAction, oData, sType) {
|
||||
switch (sAction)
|
||||
{
|
||||
case 'Login':
|
||||
case 'SendMessage':
|
||||
case 'MessageMove':
|
||||
case 'MessageDelete':
|
||||
fSendEvent('RainLoop', sAction,
|
||||
'success' === sType && oData && oData['Result'] ? 'true' : 'false');
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue