From 7dd1906eaf746a68fd478bb59ab84ef0d9589df4 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Mon, 4 Jul 2016 16:51:31 +0100 Subject: [PATCH 01/14] Initial Countly integration. --- services/web/app/views/layout.jade | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/services/web/app/views/layout.jade b/services/web/app/views/layout.jade index 82b230c976..3ab9e23a64 100644 --- a/services/web/app/views/layout.jade +++ b/services/web/app/views/layout.jade @@ -59,6 +59,27 @@ html(itemscope, itemtype='http://schema.org/Product') email: "#{session.user.email}", }) // End Heap Analytics + + // Countly Analytics + if (settings.analytics && settings.analytics.countly && settings.analytics.countly.token) + script(type="text/javascript"). + var Countly = Countly || {}; + Countly.q = Countly.q || []; + Countly.app_key = "#{settings.analytics.countly.token}"; + Countly.url = "https://try.count.ly"; + Countly.q.push(['track_sessions']); + Countly.q.push(['track_pageview']); + + (function() { + var cly = document.createElement('script'); cly.type = 'text/javascript'; + cly.async = true; + //enter url of script here + cly.src = 'https://cdnjs.cloudflare.com/ajax/libs/countly-sdk-web/16.6.0/countly.min.js'; + cly.onload = function(){Countly.init()}; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(cly, s); + })(); + + // End countly Analytics script(type="text/javascript"). window.csrfToken = "#{csrfToken}"; From a40cbdd84e68c2ce4bb2e800ba3c4aa1c5c3add3 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 5 Jul 2016 14:32:56 +0100 Subject: [PATCH 02/14] Track share modal opening. --- .../coffee/ide/share/controllers/ShareController.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/share/controllers/ShareController.coffee b/services/web/public/coffee/ide/share/controllers/ShareController.coffee index d76bd07965..b3813b27b2 100644 --- a/services/web/public/coffee/ide/share/controllers/ShareController.coffee +++ b/services/web/public/coffee/ide/share/controllers/ShareController.coffee @@ -1,8 +1,10 @@ define [ "base" ], (App) -> - App.controller "ShareController", ["$scope", "$modal", ($scope, $modal) -> + App.controller "ShareController", ["$scope", "$modal", "event_tracking", ($scope, $modal, event_tracking) -> $scope.openShareProjectModal = () -> + event_tracking.send('share-modal-opened') + $modal.open( templateUrl: "shareProjectModalTemplate" controller: "ShareProjectModalController" From 71b8f86e8972ed5b25492cb41e70d7b05070916f Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 5 Jul 2016 15:07:16 +0100 Subject: [PATCH 03/14] Track editor macro views. --- services/web/public/coffee/ide.coffee | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide.coffee b/services/web/public/coffee/ide.coffee index ceebadac46..d5bb4a3f51 100644 --- a/services/web/public/coffee/ide.coffee +++ b/services/web/public/coffee/ide.coffee @@ -42,7 +42,7 @@ define [ ReferencesManager ) -> - App.controller "IdeController", ($scope, $timeout, ide, localStorage) -> + App.controller "IdeController", ($scope, $timeout, ide, localStorage, event_tracking) -> # Don't freak out if we're already in an apply callback $scope.$originalApply = $scope.$apply $scope.$apply = (fn = () ->) -> @@ -69,6 +69,16 @@ define [ $scope.chat = {} + # Tracking code. + $scope.$watch "ui.view", (newView, oldView) -> + event_tracking.send "ide-open-view-#{ newView }" if newView? + + $scope.$watch "ui.chatOpen", (isOpen) -> + event_tracking.send "ide-open-chat" if isOpen + + $scope.$watch "ui.leftMenuShown", (isOpen) -> + event_tracking.send "ide-open-left-menu" if isOpen + # End of tracking code. window._ide = ide From 304529754d185c60f7b5491916ae9208575e4703 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 5 Jul 2016 15:16:55 +0100 Subject: [PATCH 04/14] Track editor modals. --- .../coffee/ide/hotkeys/controllers/HotkeysController.coffee | 4 +++- .../coffee/ide/share/controllers/ShareController.coffee | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee b/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee index 4d0adef4fa..762721a329 100644 --- a/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee +++ b/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee @@ -2,8 +2,10 @@ define [ "base" "ace/ace" ], (App) -> - App.controller "HotkeysController", ($scope, $modal) -> + App.controller "HotkeysController", ($scope, $modal, event_tracking) -> $scope.openHotkeysModal = -> + event_tracking.send 'ide-open-hotkeys-modal' + $modal.open { templateUrl: "hotkeysModalTemplate" controller: "HotkeysModalController" diff --git a/services/web/public/coffee/ide/share/controllers/ShareController.coffee b/services/web/public/coffee/ide/share/controllers/ShareController.coffee index b3813b27b2..5a12cbb245 100644 --- a/services/web/public/coffee/ide/share/controllers/ShareController.coffee +++ b/services/web/public/coffee/ide/share/controllers/ShareController.coffee @@ -3,7 +3,7 @@ define [ ], (App) -> App.controller "ShareController", ["$scope", "$modal", "event_tracking", ($scope, $modal, event_tracking) -> $scope.openShareProjectModal = () -> - event_tracking.send('share-modal-opened') + event_tracking.send 'ide-open-share-modal' $modal.open( templateUrl: "shareProjectModalTemplate" From 96f6603bd35e50f9f0728251b3a75db1c058c354 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 5 Jul 2016 15:37:13 +0100 Subject: [PATCH 05/14] Track settings changes. --- .../ide/settings/services/settings.coffee | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/settings/services/settings.coffee b/services/web/public/coffee/ide/settings/services/settings.coffee index 4e6bbcea3d..0c4b52dd89 100644 --- a/services/web/public/coffee/ide/settings/services/settings.coffee +++ b/services/web/public/coffee/ide/settings/services/settings.coffee @@ -1,19 +1,37 @@ define [ "base" ], (App) -> - App.factory "settings", ["ide", (ide) -> + App.factory "settings", ["ide", "event_tracking", (ide, event_tracking) -> return { saveSettings: (data) -> + for key in Object.keys(data) + changedSetting = key + changedSettingVal = data[key] + event_tracking.send "setting-changed", { changedSetting, changedSettingVal } + data._csrf = window.csrfToken ide.$http.post "/user/settings", data + saveProjectSettings: (data) -> + for key in Object.keys(data) + changedSetting = key + changedSettingVal = data[key] + event_tracking.send "project-setting-changed", { changedSetting, changedSettingVal} + data._csrf = window.csrfToken ide.$http.post "/project/#{ide.project_id}/settings", data + saveProjectAdminSettings: (data) -> + for key in Object.keys(data) + changedSetting = key + changedSettingVal = data[key] + event_tracking.send "project-admin-setting-changed", { changedSetting, changedSettingVal } + data._csrf = window.csrfToken ide.$http.post "/project/#{ide.project_id}/settings/admin", data + } ] \ No newline at end of file From d5efe81a464cd766fc3d72b73bcc4e5d4d34cd15 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 5 Jul 2016 16:02:46 +0100 Subject: [PATCH 06/14] Track recompiles. --- services/web/app/views/project/editor/editor.jade | 2 +- .../coffee/ide/pdf/controllers/PdfController.coffee | 6 ++++++ .../coffee/ide/settings/services/settings.coffee | 12 +++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/services/web/app/views/project/editor/editor.jade b/services/web/app/views/project/editor/editor.jade index d6c0876f96..ea5efff304 100644 --- a/services/web/app/views/project/editor/editor.jade +++ b/services/web/app/views/project/editor/editor.jade @@ -35,7 +35,7 @@ div.full-size( resize-on="layout:main:resize,layout:pdf:resize", annotations="pdf.logEntryAnnotations[editor.open_doc_id]", read-only="!permissions.write", - on-ctrl-enter="recompile" + on-ctrl-enter="recompileViaKey" ) .ui-layout-east diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index 715dbb9161..5f283145d1 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -247,7 +247,10 @@ define [ return path $scope.recompile = (options = {}) -> + event_tracking.send "editor-recompile", options + return if $scope.pdf.compiling + $scope.pdf.compiling = true ide.$scope.$broadcast("flush-changes") @@ -267,6 +270,9 @@ define [ # This needs to be public. ide.$scope.recompile = $scope.recompile + # This method is a simply wrapper and exists only for tracking purposes. + ide.$scope.recompileViaKey = () -> + $scope.recompile { keyShortcut: true } $scope.clearCache = () -> $http { diff --git a/services/web/public/coffee/ide/settings/services/settings.coffee b/services/web/public/coffee/ide/settings/services/settings.coffee index 0c4b52dd89..409d571d33 100644 --- a/services/web/public/coffee/ide/settings/services/settings.coffee +++ b/services/web/public/coffee/ide/settings/services/settings.coffee @@ -4,31 +4,37 @@ define [ App.factory "settings", ["ide", "event_tracking", (ide, event_tracking) -> return { saveSettings: (data) -> + # Tracking code. for key in Object.keys(data) changedSetting = key changedSettingVal = data[key] event_tracking.send "setting-changed", { changedSetting, changedSettingVal } - + # End of tracking code. + data._csrf = window.csrfToken ide.$http.post "/user/settings", data saveProjectSettings: (data) -> + # Tracking code. for key in Object.keys(data) changedSetting = key changedSettingVal = data[key] event_tracking.send "project-setting-changed", { changedSetting, changedSettingVal} - + # End of tracking code. + data._csrf = window.csrfToken ide.$http.post "/project/#{ide.project_id}/settings", data saveProjectAdminSettings: (data) -> + # Tracking code. for key in Object.keys(data) changedSetting = key changedSettingVal = data[key] event_tracking.send "project-admin-setting-changed", { changedSetting, changedSettingVal } - + # End of tracking code. + data._csrf = window.csrfToken ide.$http.post "/project/#{ide.project_id}/settings/admin", data From 909f7c15b55b0dfa6574af8f39f8bb2a886e2bcc Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 5 Jul 2016 16:27:14 +0100 Subject: [PATCH 07/14] Track log-related actions. --- services/web/app/views/project/editor/pdf.jade | 6 +++++- .../coffee/ide/pdf/controllers/PdfController.coffee | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index 3bc459f290..1f135d665f 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -119,7 +119,11 @@ div.full-size.pdf(ng-controller="PdfController") ng-bind-html="wikiEnabled ? entry.humanReadableHint : stripHTMLFromString(entry.humanReadableHint)") .card-hint-actions.clearfix .card-hint-ext-link(ng-if="wikiEnabled") - a(ng-href="{{ entry.extraInfoURL }}", target="_blank") + a( + ng-href="{{ entry.extraInfoURL }}", + ng-click="trackLogHintsLearnMore()" + target="_blank" + ) i.fa.fa-external-link | #{translate("log_hint_extra_info")} .card-hint-feedback( diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index 5f283145d1..036e726f40 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -16,8 +16,11 @@ define [ $scope.wikiEnabled = window.wikiEnabled; # log hints tracking + $scope.trackLogHintsLearnMore = () -> + event_tracking.send 'logs-hints-learn-more' + trackLogHintsFeedback = (isPositive, hintId) -> - event_tracking.send 'log-hints', (if isPositive then 'feedback-positive' else 'feedback-negative'), hintId + event_tracking.send 'log-hints-feedback', { isPositive, hintId } $scope.trackLogHintsPositiveFeedback = (hintId) -> trackLogHintsFeedback true, hintId $scope.trackLogHintsNegativeFeedback = (hintId) -> trackLogHintsFeedback false, hintId @@ -286,6 +289,7 @@ define [ $scope.toggleLogs = () -> $scope.shouldShowLogs = !$scope.shouldShowLogs + event_tracking.send "ide-open-logs" if $scope.shouldShowLogs $scope.showPdf = () -> $scope.pdf.view = "pdf" @@ -293,6 +297,7 @@ define [ $scope.toggleRawLog = () -> $scope.pdf.showRawLog = !$scope.pdf.showRawLog + event_tracking.send "logs-view-raw" if $scope.pdf.showRawLog $scope.openClearCacheModal = () -> modalInstance = $modal.open( @@ -445,8 +450,9 @@ define [ ide.editorManager.openDoc(doc, gotoLine: line) ] - App.controller "PdfLogEntryController", ["$scope", "ide", ($scope, ide) -> + App.controller "PdfLogEntryController", ["$scope", "ide", "event_tracking", ($scope, ide, event_tracking) -> $scope.openInEditor = (entry) -> + event_tracking.send 'logs-jump-to-location' entity = ide.fileTreeManager.findEntityByPath(entry.file) return if !entity? or entity.type != "doc" if entry.line? From c9b1faa1a1c3a2a40aa473a694d449bd745fbbc4 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Wed, 6 Jul 2016 11:59:33 +0100 Subject: [PATCH 08/14] Add user info to correlate with events. --- services/web/app/views/layout.jade | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/web/app/views/layout.jade b/services/web/app/views/layout.jade index 3ab9e23a64..3a5b227fac 100644 --- a/services/web/app/views/layout.jade +++ b/services/web/app/views/layout.jade @@ -67,6 +67,7 @@ html(itemscope, itemtype='http://schema.org/Product') Countly.q = Countly.q || []; Countly.app_key = "#{settings.analytics.countly.token}"; Countly.url = "https://try.count.ly"; + Countly.q.push(['track_sessions']); Countly.q.push(['track_pageview']); @@ -79,6 +80,15 @@ html(itemscope, itemtype='http://schema.org/Product') var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(cly, s); })(); + if (session && session.user) + script(type="text/javascript"). + Countly.q.push(['user_details', { + handle: "#{session.user._id}", + email: "#{session.user.email}", + }]); + + + // End countly Analytics script(type="text/javascript"). From 7e1c1f7414d208d92885928fb23ba518d6c023d9 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Wed, 6 Jul 2016 12:12:22 +0100 Subject: [PATCH 09/14] Remove heap integration. --- services/web/app/views/layout.jade | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/services/web/app/views/layout.jade b/services/web/app/views/layout.jade index 3a5b227fac..76b6df7f78 100644 --- a/services/web/app/views/layout.jade +++ b/services/web/app/views/layout.jade @@ -48,31 +48,19 @@ html(itemscope, itemtype='http://schema.org/Product') script(type='text/javascript'). window.ga = function() { console.log("Sending to GA", arguments) }; - // Heap Analytics - if (settings.analytics && settings.analytics.heap && session && session.user) - script(type="text/javascript"). - window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var n=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(n?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(a,o);for(var r=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["clearEventProperties","identify","setEventProperties","track","unsetEventProperty"],c=0;c Date: Wed, 6 Jul 2016 12:12:54 +0100 Subject: [PATCH 10/14] Track user log in and sign up. --- services/web/app/views/layout.jade | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/web/app/views/layout.jade b/services/web/app/views/layout.jade index 76b6df7f78..3995a3c39f 100644 --- a/services/web/app/views/layout.jade +++ b/services/web/app/views/layout.jade @@ -74,6 +74,18 @@ html(itemscope, itemtype='http://schema.org/Product') handle: '#{session.user._id}', email: '#{session.user.email}', }]); + + if (justRegistered) + script(type="text/javascript"). + Countly.q.push(['add_event',{ + key: 'user-registered' + }); + + if (justLoggedIn) + script(type="text/javascript"). + Countly.q.push(['add_event',{ + key: 'user-logged-in' + }); // End countly Analytics script(type="text/javascript"). From b841d41b685ef1fac6a93d0127face2e5f66973d Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Wed, 6 Jul 2016 12:26:21 +0100 Subject: [PATCH 11/14] Actually send the data to Countly. --- services/web/public/coffee/main/event.coffee | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/services/web/public/coffee/main/event.coffee b/services/web/public/coffee/main/event.coffee index a0f7a4cedb..2acd79a116 100644 --- a/services/web/public/coffee/main/event.coffee +++ b/services/web/public/coffee/main/event.coffee @@ -6,10 +6,24 @@ define [ return { send: (category, action, label, value)-> ga('send', 'event', category, action, label, value) - event_name = "#{action}-#{category}" - window?.heap?.track?(event_name, {label, value}) + + sendCountly: (key, segmentation) -> + eventData = { key } + eventData.segmentation = segmentation if segmentation? + + Countly.q.push(['add_event', eventData]); } + # App.directive "countlyTrack", () -> + # return { + # restrict: "A" + # scope: false, + # link: (scope, el, attrs) -> + # eventKey = attrs.countlyTrack + # if (eventKey?) + # el.on "click", () -> + # console.log eventKey + # } #header $('.navbar a').on "click", (e)-> From 0dd3a70b4bfa09c370e90bb8800feb2c01b657fe Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Wed, 6 Jul 2016 12:32:33 +0100 Subject: [PATCH 12/14] Use Countly tracking method where appropriate. --- services/web/public/coffee/ide.coffee | 6 +++--- .../ide/hotkeys/controllers/HotkeysController.coffee | 2 +- .../coffee/ide/pdf/controllers/PdfController.coffee | 12 ++++++------ .../coffee/ide/settings/services/settings.coffee | 6 +++--- .../ide/share/controllers/ShareController.coffee | 2 +- services/web/public/coffee/main/event.coffee | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/services/web/public/coffee/ide.coffee b/services/web/public/coffee/ide.coffee index d5bb4a3f51..ed56f04c32 100644 --- a/services/web/public/coffee/ide.coffee +++ b/services/web/public/coffee/ide.coffee @@ -71,13 +71,13 @@ define [ # Tracking code. $scope.$watch "ui.view", (newView, oldView) -> - event_tracking.send "ide-open-view-#{ newView }" if newView? + event_tracking.sendCountly "ide-open-view-#{ newView }" if newView? $scope.$watch "ui.chatOpen", (isOpen) -> - event_tracking.send "ide-open-chat" if isOpen + event_tracking.sendCountly "ide-open-chat" if isOpen $scope.$watch "ui.leftMenuShown", (isOpen) -> - event_tracking.send "ide-open-left-menu" if isOpen + event_tracking.sendCountly "ide-open-left-menu" if isOpen # End of tracking code. window._ide = ide diff --git a/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee b/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee index 762721a329..36eaa5d555 100644 --- a/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee +++ b/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee @@ -4,7 +4,7 @@ define [ ], (App) -> App.controller "HotkeysController", ($scope, $modal, event_tracking) -> $scope.openHotkeysModal = -> - event_tracking.send 'ide-open-hotkeys-modal' + event_tracking.sendCountly "ide-open-hotkeys-modal" $modal.open { templateUrl: "hotkeysModalTemplate" diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index 036e726f40..afd61983c9 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -17,10 +17,10 @@ define [ # log hints tracking $scope.trackLogHintsLearnMore = () -> - event_tracking.send 'logs-hints-learn-more' + event_tracking.sendCountly "logs-hints-learn-more" trackLogHintsFeedback = (isPositive, hintId) -> - event_tracking.send 'log-hints-feedback', { isPositive, hintId } + event_tracking.sendCountly "log-hints-feedback", { isPositive, hintId } $scope.trackLogHintsPositiveFeedback = (hintId) -> trackLogHintsFeedback true, hintId $scope.trackLogHintsNegativeFeedback = (hintId) -> trackLogHintsFeedback false, hintId @@ -250,7 +250,7 @@ define [ return path $scope.recompile = (options = {}) -> - event_tracking.send "editor-recompile", options + event_tracking.sendCountly "editor-recompile", options return if $scope.pdf.compiling @@ -289,7 +289,7 @@ define [ $scope.toggleLogs = () -> $scope.shouldShowLogs = !$scope.shouldShowLogs - event_tracking.send "ide-open-logs" if $scope.shouldShowLogs + event_tracking.sendCountly "ide-open-logs" if $scope.shouldShowLogs $scope.showPdf = () -> $scope.pdf.view = "pdf" @@ -297,7 +297,7 @@ define [ $scope.toggleRawLog = () -> $scope.pdf.showRawLog = !$scope.pdf.showRawLog - event_tracking.send "logs-view-raw" if $scope.pdf.showRawLog + event_tracking.sendCountly "logs-view-raw" if $scope.pdf.showRawLog $scope.openClearCacheModal = () -> modalInstance = $modal.open( @@ -452,7 +452,7 @@ define [ App.controller "PdfLogEntryController", ["$scope", "ide", "event_tracking", ($scope, ide, event_tracking) -> $scope.openInEditor = (entry) -> - event_tracking.send 'logs-jump-to-location' + event_tracking.sendCountly 'logs-jump-to-location' entity = ide.fileTreeManager.findEntityByPath(entry.file) return if !entity? or entity.type != "doc" if entry.line? diff --git a/services/web/public/coffee/ide/settings/services/settings.coffee b/services/web/public/coffee/ide/settings/services/settings.coffee index 409d571d33..14dfe92f56 100644 --- a/services/web/public/coffee/ide/settings/services/settings.coffee +++ b/services/web/public/coffee/ide/settings/services/settings.coffee @@ -8,7 +8,7 @@ define [ for key in Object.keys(data) changedSetting = key changedSettingVal = data[key] - event_tracking.send "setting-changed", { changedSetting, changedSettingVal } + event_tracking.sendCountly "setting-changed", { changedSetting, changedSettingVal } # End of tracking code. data._csrf = window.csrfToken @@ -20,7 +20,7 @@ define [ for key in Object.keys(data) changedSetting = key changedSettingVal = data[key] - event_tracking.send "project-setting-changed", { changedSetting, changedSettingVal} + event_tracking.sendCountly "project-setting-changed", { changedSetting, changedSettingVal} # End of tracking code. data._csrf = window.csrfToken @@ -32,7 +32,7 @@ define [ for key in Object.keys(data) changedSetting = key changedSettingVal = data[key] - event_tracking.send "project-admin-setting-changed", { changedSetting, changedSettingVal } + event_tracking.sendCountly "project-admin-setting-changed", { changedSetting, changedSettingVal } # End of tracking code. data._csrf = window.csrfToken diff --git a/services/web/public/coffee/ide/share/controllers/ShareController.coffee b/services/web/public/coffee/ide/share/controllers/ShareController.coffee index 5a12cbb245..fc74862528 100644 --- a/services/web/public/coffee/ide/share/controllers/ShareController.coffee +++ b/services/web/public/coffee/ide/share/controllers/ShareController.coffee @@ -3,7 +3,7 @@ define [ ], (App) -> App.controller "ShareController", ["$scope", "$modal", "event_tracking", ($scope, $modal, event_tracking) -> $scope.openShareProjectModal = () -> - event_tracking.send 'ide-open-share-modal' + event_tracking.sendCountly "ide-open-share-modal" $modal.open( templateUrl: "shareProjectModalTemplate" diff --git a/services/web/public/coffee/main/event.coffee b/services/web/public/coffee/main/event.coffee index 2acd79a116..c8fee3601c 100644 --- a/services/web/public/coffee/main/event.coffee +++ b/services/web/public/coffee/main/event.coffee @@ -11,7 +11,7 @@ define [ eventData = { key } eventData.segmentation = segmentation if segmentation? - Countly.q.push(['add_event', eventData]); + Countly.q.push([ "add_event", eventData ]); } # App.directive "countlyTrack", () -> From 8e2475afdc07f47408c4082bd203dba4f76d93b6 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Wed, 6 Jul 2016 14:24:50 +0100 Subject: [PATCH 13/14] Track hints feedback in both GA and Countly; clean-up. --- services/web/app/views/layout.jade | 8 +++++--- .../coffee/ide/pdf/controllers/PdfController.coffee | 1 + services/web/public/coffee/main/event.coffee | 5 ++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/services/web/app/views/layout.jade b/services/web/app/views/layout.jade index 3995a3c39f..4b38d67bd8 100644 --- a/services/web/app/views/layout.jade +++ b/services/web/app/views/layout.jade @@ -71,21 +71,23 @@ html(itemscope, itemtype='http://schema.org/Product') if (session && session.user) script(type="text/javascript"). Countly.q.push(['user_details', { - handle: '#{session.user._id}', email: '#{session.user.email}', + custom: { + handle: '#{session.user._id}', + } }]); if (justRegistered) script(type="text/javascript"). Countly.q.push(['add_event',{ key: 'user-registered' - }); + }]); if (justLoggedIn) script(type="text/javascript"). Countly.q.push(['add_event',{ key: 'user-logged-in' - }); + }]); // End countly Analytics script(type="text/javascript"). diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index afd61983c9..6ca950671f 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -20,6 +20,7 @@ define [ event_tracking.sendCountly "logs-hints-learn-more" trackLogHintsFeedback = (isPositive, hintId) -> + event_tracking.send 'log-hints', (if isPositive then 'feedback-positive' else 'feedback-negative'), hintId event_tracking.sendCountly "log-hints-feedback", { isPositive, hintId } $scope.trackLogHintsPositiveFeedback = (hintId) -> trackLogHintsFeedback true, hintId diff --git a/services/web/public/coffee/main/event.coffee b/services/web/public/coffee/main/event.coffee index c8fee3601c..58e43f3b9f 100644 --- a/services/web/public/coffee/main/event.coffee +++ b/services/web/public/coffee/main/event.coffee @@ -9,9 +9,8 @@ define [ sendCountly: (key, segmentation) -> eventData = { key } - eventData.segmentation = segmentation if segmentation? - - Countly.q.push([ "add_event", eventData ]); + eventData.segmentation = segmentation if segmentation? + Countly?.q.push([ "add_event", eventData ]); } # App.directive "countlyTrack", () -> From 7a3d3d3ffd8a0b62fa73a669b453b94fd58b74bc Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Wed, 6 Jul 2016 14:44:28 +0100 Subject: [PATCH 14/14] Make Countly track by internal ids. --- services/web/app/views/layout.jade | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/web/app/views/layout.jade b/services/web/app/views/layout.jade index 4b38d67bd8..14e4aa6107 100644 --- a/services/web/app/views/layout.jade +++ b/services/web/app/views/layout.jade @@ -70,10 +70,12 @@ html(itemscope, itemtype='http://schema.org/Product') if (session && session.user) script(type="text/javascript"). + Countly.q.push(['change_id', '#{session.user._id}', true ]); + Countly.q.push(['user_details', { email: '#{session.user.email}', custom: { - handle: '#{session.user._id}', + userId: '#{session.user._id}', } }]); @@ -85,6 +87,7 @@ html(itemscope, itemtype='http://schema.org/Product') if (justLoggedIn) script(type="text/javascript"). + Countly.q.push(['add_event',{ key: 'user-logged-in' }]);