1 | (function webpackUniversalModuleDefinition(root, factory) {
|
2 | if(typeof exports === 'object' && typeof module === 'object')
|
3 | module.exports = factory();
|
4 | else if(typeof define === 'function' && define.amd)
|
5 | define([], factory);
|
6 | else {
|
7 | var a = factory();
|
8 | for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
9 | }
|
10 | })(this, function() {
|
11 | return (function(modules) {
|
12 |
|
13 | var installedModules = {};
|
14 |
|
15 |
|
16 | function __webpack_require__(moduleId) {
|
17 |
|
18 |
|
19 | if(installedModules[moduleId])
|
20 | return installedModules[moduleId].exports;
|
21 |
|
22 |
|
23 | var module = installedModules[moduleId] = {
|
24 | exports: {},
|
25 | id: moduleId,
|
26 | loaded: false
|
27 | };
|
28 |
|
29 |
|
30 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31 |
|
32 |
|
33 | module.loaded = true;
|
34 |
|
35 |
|
36 | return module.exports;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 | __webpack_require__.m = modules;
|
42 |
|
43 |
|
44 | __webpack_require__.c = installedModules;
|
45 |
|
46 |
|
47 | __webpack_require__.p = "";
|
48 |
|
49 |
|
50 | return __webpack_require__(0);
|
51 | })
|
52 |
|
53 | ([
|
54 |
|
55 | function(module, exports, __webpack_require__) {
|
56 |
|
57 | 'use strict';
|
58 |
|
59 | module.exports = __webpack_require__(9);
|
60 |
|
61 | },
|
62 | ,
|
63 | ,
|
64 | ,
|
65 | ,
|
66 | ,
|
67 | ,
|
68 | ,
|
69 | ,
|
70 |
|
71 | function(module, exports, __webpack_require__) {
|
72 |
|
73 | 'use strict';
|
74 |
|
75 | var _require = __webpack_require__(10),
|
76 | filterEcommEvents = _require.filterEcommEvents,
|
77 | isEcommEvent = _require.isEcommEvent;
|
78 |
|
79 | function GoogleAnalytics(events) {
|
80 | if (typeof window === 'undefined') {
|
81 | return;
|
82 | }
|
83 | if (typeof window.ga !== 'function') {
|
84 | throw new Error('window.ga is not defined, Have you forgotten to include Google Analytics?');
|
85 | }
|
86 | events.forEach(function (event) {
|
87 | if (isEcommEvent(event)) {
|
88 | var trackerId = event.customTrackerId ? event.customTrackerId + '.' : '';
|
89 | var callEvent = function callEvent(type) {
|
90 | return {
|
91 | addItem: function addItem() {
|
92 | return window.ga(trackerId + 'ecommerce:addItem', filterEcommEvents(event));
|
93 | },
|
94 | addTransaction: function addTransaction() {
|
95 | return window.ga(trackerId + 'ecommerce:addTransaction', filterEcommEvents(event));
|
96 | },
|
97 | ecommClear: function ecommClear() {
|
98 | return window.ga(trackerId + 'ecommerce:clear');
|
99 | },
|
100 | ecommSend: function ecommSend() {
|
101 | return window.ga(trackerId + 'ecommerce:send');
|
102 | }
|
103 | }[type]();
|
104 | };
|
105 |
|
106 | callEvent(event.hitType);
|
107 | } else {
|
108 | if (event.hitType === 'pageview') {
|
109 | window.ga('set', 'page', event.page);
|
110 | }
|
111 | window.ga('send', event);
|
112 | }
|
113 | });
|
114 | }
|
115 |
|
116 | module.exports = { GoogleAnalytics: GoogleAnalytics };
|
117 |
|
118 | },
|
119 |
|
120 | function(module, exports, __webpack_require__) {
|
121 |
|
122 | 'use strict';
|
123 |
|
124 | var _require = __webpack_require__(11),
|
125 | ensure = _require.ensure;
|
126 |
|
127 | var _require2 = __webpack_require__(12),
|
128 | filterEcommEvents = _require2.filterEcommEvents,
|
129 | isEcommEvent = _require2.isEcommEvent;
|
130 |
|
131 | module.exports = {
|
132 | ensure: ensure,
|
133 | filterEcommEvents: filterEcommEvents,
|
134 | isEcommEvent: isEcommEvent
|
135 | };
|
136 |
|
137 | },
|
138 |
|
139 | function(module, exports) {
|
140 |
|
141 | "use strict";
|
142 |
|
143 | var ensure = function ensure(isValid, eventDef) {
|
144 | return function () {
|
145 | var event = eventDef.apply(undefined, arguments);
|
146 | return isValid(event) ? event : null;
|
147 | };
|
148 | };
|
149 |
|
150 | module.exports = { ensure: ensure };
|
151 |
|
152 | },
|
153 |
|
154 | function(module, exports) {
|
155 |
|
156 | 'use strict';
|
157 |
|
158 | var filterEcommEvents = function filterEcommEvents(obj) {
|
159 | var newObj = {};
|
160 | Object.keys(obj).forEach(function (key) {
|
161 | if (key !== 'hitType' && key !== 'customTrackerId') {
|
162 | newObj[key] = obj[key];
|
163 | }
|
164 | });
|
165 | return newObj;
|
166 | };
|
167 |
|
168 | var isEcommEvent = function isEcommEvent(event) {
|
169 | return ['addTransaction', 'addItem', 'ecommSend', 'ecommClear'].indexOf(event.hitType) > -1;
|
170 | };
|
171 |
|
172 | module.exports = {
|
173 | filterEcommEvents: filterEcommEvents,
|
174 | isEcommEvent: isEcommEvent
|
175 | };
|
176 |
|
177 | }
|
178 | ])
|
179 | });
|
180 | ; |
\ | No newline at end of file |