5
5
'extensions' ,
6
6
'vm' ,
7
7
'events' ,
8
+ 'libs/events/event_bus' ,
9
+ 'libs/events/events' ,
8
10
'models/session' ,
9
11
'models/error' ,
10
12
'text!templates/layout.html' ,
@@ -13,14 +15,19 @@ define([
13
15
'views/footer/footer' ,
14
16
'views/feedback/feedback' ,
15
17
'views/notifications/main'
16
- ] , function ( $ , _ , Backbone , extensions , Vm , Events , Session , ErrorModel , layoutTemplate , AccountMenu , HeaderView , FooterView , FeedbackView , Notifications ) {
18
+ ] , function ( $ , _ , Backbone , extensions , Vm , Eventsa , EventBus , Events , Session , ErrorModel , layoutTemplate , AccountMenu , HeaderView , FooterView , FeedbackView , Notifications ) {
17
19
var AppView = Backbone . View . extend ( {
18
20
el : 'body' ,
19
21
initialize : function ( ) {
20
22
// log all 500 error codes with the server. We may also log others - this is done in libs/form/form.js
21
23
// when no UI elements are found for handling a valid server error condition.
24
+ EventBus . on ( 'all' , function ( event ) {
25
+ _gaq . push ( [ '_trackEvent' , 'app' , event ] )
26
+ _gaq . push ( [ '_trackEvent' , 'Videos' , 'Stop' , 'Gone With the Wind' ] ) ;
27
+ } ) ;
28
+ EventBus . trigger ( Events . NEW_USER ) ;
22
29
$ ( "body" ) . ajaxError ( function ( ev , res , req ) {
23
- if ( res . status >= 500 && res . status <= 600 ) {
30
+ if ( res . status >= 500 && res . status <= 600 ) {
24
31
var responseJSON = xhr . responseText ;
25
32
try {
26
33
responseJSON = JSON . parse ( xhr . responseText ) ;
@@ -29,15 +36,15 @@ define([
29
36
var error = new ErrorModel ( ) ;
30
37
error . save ( {
31
38
"page" : window . location . href ,
32
- "context" : req . type + ' ' + req . url ,
33
- "code" : res . status ,
34
- "error" : "Internal API error" ,
35
- "payload" : {
36
- sent : req . data ,
37
- received : responseJSON
38
- }
39
+ "context" : req . type + ' ' + req . url ,
40
+ "code" : res . status ,
41
+ "error" : "Internal API error" ,
42
+ "payload" : {
43
+ sent : req . data ,
44
+ received : responseJSON
45
+ }
39
46
} , { } ) ;
40
- }
47
+ }
41
48
console . log ( arguments ) ;
42
49
} ) ;
43
50
0 commit comments