Skip to content

Commit 46a491e

Browse files
committed
ga improvements
1 parent 006ac7e commit 46a491e

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

javascripts/common.js

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ var extData = {
1717
API : true,
1818
CM : true,
1919
Timestamp : true,
20-
GA : false
20+
GA : true
21+
alertExc : true
2122
},
2223

23-
chromeVersion : undefined
24+
chromeVersion : undefined,
25+
26+
webnotereg : undefined
2427
}
2528

2629
extData.webnotereg = new RegExp(extData.webnoteregstr,"m")
@@ -434,6 +437,9 @@ function exceptionCaught(e,src,line) {
434437
console.log(e.stack);
435438

436439
_gaq.push(beacon);
440+
441+
if (extData.debugFlags.gerneral && extData.debugFlags.alertExc)
442+
alert(beacon.join(","));
437443
}
438444

439445
window.onerror = function(msg,src,line) {
@@ -451,6 +457,17 @@ function getChromeVersion() {
451457
return v;
452458
}
453459

460+
function scheduleGA(ms) {
461+
setTimeout(function() {
462+
var ga = document.createElement('script');ga.type = 'text/javascript';ga.async = true;
463+
if (extData.debugFlags.general && extData.debugFlags.GA)
464+
ga.src = 'https://ssl.google-analytics.com/u/ga_debug.js';
465+
else
466+
ga.src = 'https://ssl.google-analytics.com/ga.js';
467+
var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga, s);
468+
},ms == undefined?100:ms);
469+
}
470+
454471
extData.chromeVersion = getChromeVersion();
455472

456473
var _gaq = _gaq || [];
@@ -475,16 +492,11 @@ get_manifest(function(mf) {
475492

476493
_gaq.push(['_setCustomVar',
477494
3, // This custom var is set to slot #1. Required parameter.
478-
'Chrome Version (session)', // The name acts as a kind of category for the user activity. Required parameter.
479-
extData.chromeVersion, // This value of the custom variable. Required parameter.
495+
'Chrome String', // The name acts as a kind of category for the user activity. Required parameter.
496+
navigator.appVersion, // This value of the custom variable. Required parameter.
480497
2 // Sets the scope to session-level. Optional parameter.
481498
]);
482-
483-
_gaq.push(['_setCustomVar',
484-
4, // This custom var is set to slot #1. Required parameter.
485-
'Chrome Version (page)', // The name acts as a kind of category for the user activity. Required parameter.
486-
extData.chromeVersion, // This value of the custom variable. Required parameter.
487-
3 // Sets the scope to session-level. Optional parameter.
488-
]);
489499

500+
_gaq.push(["_setVar",navigator.appVersion.replace(/\./g,",").replace(/ /g,"_")]);
501+
490502
_gaq.push(['_trackPageview']);

0 commit comments

Comments
 (0)