overleaf/services/web/public/coffee/analytics/AnalyticsManager.coffee

17 lines
603 B
CoffeeScript
Raw Normal View History

2014-02-12 05:23:40 -05:00
define () ->
class AnalyticsManager
constructor: (@ide) ->
@ide.editor.on "update:doc", () =>
@updateCount ||= 0
@updateCount++
if @updateCount == 100
mixpanel?.track("Updated doc multiple times in one session", project_id: @ide.project.id)
@ide.pdfManager.on "compile:pdf", () =>
@compileCount ||= 0
@compileCount++
if @compileCount == 1
mixpanel?.track("Compiled project at least once in one session", project_id: @ide.project.id)
if @compileCount == 3
mixpanel?.track("Compiled project multiple times in one session", project_id: @ide.project.id)