Browse Source

Track events that were done in analytics manager

James Allen 12 years ago
parent
commit
4809c5ceee

+ 1 - 0
services/web/public/coffee/ide.coffee

@@ -22,6 +22,7 @@ define [
 	"directives/scroll"
 	"directives/scroll"
 	"directives/onEnter"
 	"directives/onEnter"
 	"filters/formatDate"
 	"filters/formatDate"
+	"main/event-tracking"
 ], (
 ], (
 	App
 	App
 	FileTreeManager
 	FileTreeManager

+ 8 - 5
services/web/public/coffee/ide/editor/directives/aceEditor.coffee

@@ -18,7 +18,7 @@ define [
 			url = ace.config._moduleUrl(args...) + "?fingerprint=#{window.aceFingerprint}"
 			url = ace.config._moduleUrl(args...) + "?fingerprint=#{window.aceFingerprint}"
 			return url
 			return url
 
 
-	App.directive "aceEditor", ["$timeout", "$compile", "$rootScope", ($timeout, $compile, $rootScope) ->
+	App.directive "aceEditor", ($timeout, $compile, $rootScope, event_tracking) ->
 		monkeyPatchSearch($rootScope, $compile)
 		monkeyPatchSearch($rootScope, $compile)
 
 
 		return  {
 		return  {
@@ -142,7 +142,11 @@ define [
 					session.setMode("ace/mode/latex")
 					session.setMode("ace/mode/latex")
 					session.setAnnotations scope.annotations
 					session.setAnnotations scope.annotations
 
 
-				emitChange = () ->
+				updateCount = 0
+				onChange = () ->
+					updateCount++
+					if updateCount == 100
+						event_tracking.send 'editor-interaction', 'multi-doc-update'
 					scope.$emit "#{scope.name}:change"
 					scope.$emit "#{scope.name}:change"
 
 
 				attachToAce = (sharejs_doc) ->
 				attachToAce = (sharejs_doc) ->
@@ -152,7 +156,7 @@ define [
 					session = editor.getSession()
 					session = editor.getSession()
 
 
 					doc = session.getDocument()
 					doc = session.getDocument()
-					doc.on "change", emitChange
+					doc.on "change", onChange
 
 
 					sharejs_doc.on "remoteop.recordForUndo", () =>
 					sharejs_doc.on "remoteop.recordForUndo", () =>
 						undoManager.nextUpdateIsRemote = true
 						undoManager.nextUpdateIsRemote = true
@@ -167,7 +171,7 @@ define [
 
 
 					session = editor.getSession()
 					session = editor.getSession()
 					doc = session.getDocument()
 					doc = session.getDocument()
-					doc.off "change", emitChange
+					doc.off "change", onChange
 
 
 			template: """
 			template: """
 				<div class="ace-editor-wrapper">
 				<div class="ace-editor-wrapper">
@@ -239,7 +243,6 @@ define [
 				</div>
 				</div>
 			"""
 			"""
 		}
 		}
-	]
 
 
 	monkeyPatchSearch = ($rootScope, $compile) ->
 	monkeyPatchSearch = ($rootScope, $compile) ->
 		SearchBox = ace.require("ace/ext/searchbox").SearchBox
 		SearchBox = ace.require("ace/ext/searchbox").SearchBox

+ 9 - 2
services/web/public/coffee/ide/pdf/controllers/PdfController.coffee

@@ -2,7 +2,7 @@ define [
 	"base"
 	"base"
 	"libs/latex-log-parser"
 	"libs/latex-log-parser"
 ], (App, LogParser) ->
 ], (App, LogParser) ->
-	App.controller "PdfController", ["$scope", "$http", "ide", "$modal", "synctex", ($scope, $http, ide, $modal, synctex) ->
+	App.controller "PdfController", ($scope, $http, ide, $modal, synctex, event_tracking) ->
 		autoCompile = true
 		autoCompile = true
 		$scope.$on "project:joined", () ->
 		$scope.$on "project:joined", () ->
 			return if !autoCompile
 			return if !autoCompile
@@ -93,9 +93,17 @@ define [
 
 
 			return path
 			return path
 
 
+		compileCount = 0
 		$scope.recompile = (options = {}) ->
 		$scope.recompile = (options = {}) ->
 			return if $scope.pdf.compiling
 			return if $scope.pdf.compiling
 			$scope.pdf.compiling = true
 			$scope.pdf.compiling = true
+			
+			if !options.isAutoCompile
+				compileCount++
+				if compileCount == 1
+					event_tracking.send('editor-interaction', 'single-compile')
+				else if compileCount == 3
+					event_tracking.send('editor-interaction', 'multi-compile')
 
 
 			options.rootDocOverride_id = getRootDocOverride_id()
 			options.rootDocOverride_id = getRootDocOverride_id()
 
 
@@ -163,7 +171,6 @@ define [
 			$scope.switchToFlatLayout() if pdfLayout == "flat"
 			$scope.switchToFlatLayout() if pdfLayout == "flat"
 		else
 		else
 			$scope.switchToSideBySideLayout()
 			$scope.switchToSideBySideLayout()
-	]
 
 
 	App.factory "synctex", ["ide", "$http", "$q", (ide, $http, $q) ->
 	App.factory "synctex", ["ide", "$http", "$q", (ide, $http, $q) ->
 		synctex =
 		synctex =