Track events that were done in analytics manager

This commit is contained in:
James Allen 2014-07-24 16:51:04 +01:00
parent 6e6b20d3af
commit 4809c5ceee
3 changed files with 18 additions and 7 deletions

View file

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

View file

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

View file

@ -2,7 +2,7 @@ define [
"base"
"libs/latex-log-parser"
], (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
$scope.$on "project:joined", () ->
return if !autoCompile
@ -93,9 +93,17 @@ define [
return path
compileCount = 0
$scope.recompile = (options = {}) ->
return if $scope.pdf.compiling
$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()
@ -163,7 +171,6 @@ define [
$scope.switchToFlatLayout() if pdfLayout == "flat"
else
$scope.switchToSideBySideLayout()
]
App.factory "synctex", ["ide", "$http", "$q", (ide, $http, $q) ->
synctex =