-
Notifications
You must be signed in to change notification settings - Fork 0
/
google_analytics.js
30 lines (23 loc) · 976 Bytes
/
google_analytics.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Generated by CoffeeScript 1.6.2
(function() {
var GoogleAnalytics;
GoogleAnalytics = (function() {
function GoogleAnalytics(options) {
this.sampleRate = (options != null ? options.rate : void 0) || _ga_ajax_sample_rate || 10;
}
GoogleAnalytics.prototype.logTiming = function(category, url, timeSpent, label) {
return this.logCustomTiming(category, url, timeSpent, label);
};
GoogleAnalytics.prototype.logCustomTiming = function(category, url, timeSpent, label) {
return this.logToGA(category, url, timeSpent, label);
};
GoogleAnalytics.prototype.logToGA = function(category, url, timeSpent, label) {
if (window._gaq) {
return window._gaq.push(['_trackTiming', category, url, timeSpent, label, this.sampleRate]);
} else {
return console.log("WOULD HAVE LOGGED TO GOOGLE", category, url, timeSpend, label, this.sampleRate);
}
};
return GoogleAnalytics;
})();
}).call(this);