added google analytics

This commit is contained in:
coderaiser 2012-08-21 10:54:01 -04:00
parent 32e9428027
commit 811f8fcb1b
2 changed files with 39 additions and 2 deletions

View file

@ -23,6 +23,7 @@ var CloudClient = {
Viewer : function(){},/* function loads and shows viewer */
Terminal : function(){},/* function loads and shows terminal*/
Menu : function(){},/* function loads and shows menu */
GoogleAnalytics : function(){},
_loadDir : function(){}, /* Функция привязываеться ко всем
* ссылкам и
@ -284,7 +285,7 @@ CloudClient.Utils = (function(){
' could not be loaded'
});
if(lFunc.onerror &&
if(lFunc && lFunc.onerror &&
typeof lFunc.onerror === 'function')
lFunc.onerror();
});
@ -681,6 +682,21 @@ CloudClient.Editor = (function(pIsReadOnly) {
});
});
CloudClient.GoogleAnalytics = (function(){
/* google analytics */
var lFunc = document.onmousemove;
document.onmousemove = function(){
setTimeout(function(){
Util.jsload('lib/client/google_analytics.js');
},5000);
if(typeof lFunc === 'function')
lFunc();
document.onmousemove = lFunc;
};
});
/* function loads and shows viewer */
CloudClient.Viewer = (function(){
Util.jsload(CloudClient.LIBDIRCLIENT +
@ -1296,12 +1312,17 @@ return CloudClient;
})();
try{
window.onload=function(){
window.onload = function(){
'use strict';
/* базовая инициализация*/
CloudCommander.init();
/* привязываем клавиши к функциям */
CloudCommander.keyBinding();
/* загружаем Google Analytics */
CloudCommander.GoogleAnalytics();
};
}
catch(err){}

View file

@ -0,0 +1,16 @@
var CloudCommander, _gaq;
(function(){
/* setting google analitics tracking code */
_gaq = [['_setAccount', 'UA-33536569-2'], ['_trackPageview']];
window.onerror = function(msg, url, line) {
var preventErrorAlert = true;
_gaq.push(['_trackEvent',
'JS Error',
msg,
navigator.userAgent + ' -> ' + url + " : " + line]);
return preventErrorAlert;
};
CloudCommander.Util.jsload('http://google-analytics.com/ga.js');
})();