-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
mag-analytics.js
35 lines (29 loc) · 955 Bytes
/
mag-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
31
32
33
34
35
(function (root, factory) {
'use strict'; // eslint-disable-line semi
var name = 'MagnificentAnalytics'
if (typeof define === 'function' && define.amd) {
define(['google-analytics-js'], function (gaTrack) {
return (root[name] = factory(root, false, gaTrack))
})
} else if (typeof exports === 'object') {
module.exports = factory(root, require('detect-node'), require('google-analytics-js'))
} else {
root[name] = factory(root, false, root.gaTrack)
}
}(this, function (root, detectNode, gaTrack) {
'use strict'; // eslint-disable-line semi
var MagnificentAnalytics = function () {}
var options = root.MAGNIFICENT_OPTIONS || {}
MagnificentAnalytics.track = function (file) {
if (detectNode) {
return false
}
if (!options.noTrack) {
if (gaTrack) {
gaTrack('UA-64799312-1', 'andrz.me/magnificent.js', file)
return true
}
}
}
return MagnificentAnalytics
}))