@@ -8,6 +8,7 @@ var XRegExp = require('xregexp').XRegExp;
8
8
9
9
var SaveConfirmView = require ( './save-confirm-view' ) ;
10
10
var BuildView = require ( './build-view' ) ;
11
+ var GoogleAnalytics = require ( './GoogleAnalytics' ) ;
11
12
var tools = require ( './tools' ) ;
12
13
13
14
module . exports = {
@@ -76,9 +77,11 @@ module.exports = {
76
77
atom . commands . add ( 'atom-workspace' , 'build:error-match-first' , this . errorMatchFirst . bind ( this ) ) ;
77
78
atom . commands . add ( 'atom-workspace' , 'build:stop' , this . stop . bind ( this ) ) ;
78
79
atom . commands . add ( 'atom-workspace' , 'build:confirm' , function ( ) {
80
+ GoogleAnalytics . sendEvent ( 'build' , 'confirmed' ) ;
79
81
document . activeElement . click ( ) ;
80
82
} ) ;
81
83
atom . commands . add ( 'atom-workspace' , 'build:no-confirm' , function ( ) {
84
+ GoogleAnalytics . sendEvent ( 'build' , 'not confirmed' ) ;
82
85
this . saveConfirmView . cancel ( ) ;
83
86
} . bind ( this ) ) ;
84
87
@@ -90,9 +93,12 @@ module.exports = {
90
93
}
91
94
} ) ;
92
95
} ) ;
96
+
97
+ GoogleAnalytics . sendEvent ( 'core' , 'activated' ) ;
93
98
} ,
94
99
95
100
deactivate : function ( ) {
101
+ GoogleAnalytics . sendEvent ( 'core' , 'deactivated' ) ;
96
102
if ( this . child ) {
97
103
this . child . kill ( 'SIGKILL' ) ;
98
104
}
@@ -124,6 +130,7 @@ module.exports = {
124
130
if ( ! tool . isEligable ( path ) ) {
125
131
return ;
126
132
}
133
+ GoogleAnalytics . sendEvent ( 'build' , 'tool selected' , tool . niceName ) ;
127
134
cmd = _ . defaults ( tool . settings ( path ) , cmd ) ;
128
135
return true ;
129
136
} ) ;
@@ -174,6 +181,7 @@ module.exports = {
174
181
175
182
} ,
176
183
errorMatch : function ( ) {
184
+ GoogleAnalytics . sendEvent ( 'errorMatch' , 'match' ) ;
177
185
if ( ! this . cmd . errorMatch ) {
178
186
return ;
179
187
}
@@ -190,6 +198,7 @@ module.exports = {
190
198
} ,
191
199
192
200
errorMatchFirst : function ( ) {
201
+ GoogleAnalytics . sendEvent ( 'errorMatch' , 'first' ) ;
193
202
if ( ! this . cmd . errorMatch ) {
194
203
return ;
195
204
}
@@ -214,6 +223,8 @@ module.exports = {
214
223
return ;
215
224
}
216
225
226
+ GoogleAnalytics . sendEvent ( 'build' , 'triggered' ) ;
227
+
217
228
if ( ! this . cmd . exec ) {
218
229
return ;
219
230
}
@@ -253,9 +264,12 @@ module.exports = {
253
264
this . child . on ( 'close' , function ( exitCode ) {
254
265
this . buildView . buildFinished ( 0 === exitCode ) ;
255
266
if ( 0 === exitCode ) {
267
+ GoogleAnalytics . sendEvent ( 'build' , 'succeeded' ) ;
256
268
this . finishedTimer = setTimeout ( function ( ) {
257
269
this . buildView . detach ( ) ;
258
270
} . bind ( this ) , 1000 ) ;
271
+ } else {
272
+ GoogleAnalytics . sendEvent ( 'build' , 'failed' ) ;
259
273
}
260
274
this . child = null ;
261
275
} . bind ( this ) ) ;
0 commit comments