mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Use the cursor:editor:update event to track user activity
It is strictly a superset of the change event we were using
before: if there's a change, there will be always a cursor
update, but there can be cursor updates (like when the user
presses the arrow keys) that don't change the document.
This is coherent with what we do to track user activity at
dfb9943521/public/coffee/ide/connection/ConnectionManager.coffee (L49-L50)
This commit is contained in:
parent
e42d1f9b13
commit
7d0d18ea5e
3 changed files with 13 additions and 13 deletions
|
@ -176,6 +176,8 @@ define [
|
|||
$scope.$broadcast('ide:loaded')
|
||||
_loaded = true
|
||||
|
||||
$scope.$on 'cursor:editor:update', event_tracking.editingSessionHeartbeat
|
||||
|
||||
DARK_THEMES = [
|
||||
"ambiance", "chaos", "clouds_midnight", "cobalt", "idle_fingers",
|
||||
"merbivore", "merbivore_soft", "mono_industrial", "monokai",
|
||||
|
|
|
@ -301,8 +301,6 @@ define [
|
|||
onChange = () ->
|
||||
updateCount++
|
||||
|
||||
event_tracking.editingSessionHeartbeat()
|
||||
|
||||
if updateCount == 100
|
||||
event_tracking.send 'editor-interaction', 'multi-doc-update'
|
||||
scope.$emit "#{scope.name}:change"
|
||||
|
|
|
@ -37,6 +37,16 @@ define [
|
|||
|
||||
localStorage CACHE_KEY, curCache
|
||||
|
||||
_sendEditingSessionHeartbeat = (segmentation) ->
|
||||
$http({
|
||||
url: "/editingSession/#{window.project_id}",
|
||||
method: "PUT",
|
||||
data: segmentation,
|
||||
headers: {
|
||||
"X-CSRF-Token": window.csrfToken
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
send: (category, action, label, value)->
|
||||
ga('send', 'event', category, action, label, value)
|
||||
|
@ -45,7 +55,7 @@ define [
|
|||
editingSessionHeartbeat: (segmentation = {}) ->
|
||||
return unless nextHeartbeat <= new Date()
|
||||
|
||||
@_sendEditingSessionHeartbeat(segmentation)
|
||||
_sendEditingSessionHeartbeat(segmentation)
|
||||
|
||||
heartbeatsSent++
|
||||
|
||||
|
@ -60,16 +70,6 @@ define [
|
|||
|
||||
nextHeartbeat = moment().add(backoffSecs, 'seconds').toDate()
|
||||
|
||||
_sendEditingSessionHeartbeat: (segmentation) ->
|
||||
$http({
|
||||
url: "/editingSession/#{window.project_id}",
|
||||
method: "PUT",
|
||||
data: segmentation,
|
||||
headers: {
|
||||
"X-CSRF-Token": window.csrfToken
|
||||
}
|
||||
})
|
||||
|
||||
sendMB: (key, segmentation = {}) ->
|
||||
$http {
|
||||
url: "/event/#{key}",
|
||||
|
|
Loading…
Reference in a new issue