diff --git a/services/web/app/views/layout.jade b/services/web/app/views/layout.jade
index 82b230c976..14e4aa6107 100644
--- a/services/web/app/views/layout.jade
+++ b/services/web/app/views/layout.jade
@@ -48,17 +48,50 @@ 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)
+ // Countly Analytics
+ if (settings.analytics && settings.analytics.countly && settings.analytics.countly.token)
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
- 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.sendCountly "ide-open-view-#{ newView }" if newView?
+
+ $scope.$watch "ui.chatOpen", (isOpen) ->
+ event_tracking.sendCountly "ide-open-chat" if isOpen
+
+ $scope.$watch "ui.leftMenuShown", (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 4d0adef4fa..36eaa5d555 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.sendCountly "ide-open-hotkeys-modal"
+
$modal.open {
templateUrl: "hotkeysModalTemplate"
controller: "HotkeysModalController"
diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee
index 715dbb9161..6ca950671f 100644
--- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee
+++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee
@@ -16,8 +16,12 @@ define [
$scope.wikiEnabled = window.wikiEnabled;
# log hints tracking
+ $scope.trackLogHintsLearnMore = () ->
+ 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
$scope.trackLogHintsNegativeFeedback = (hintId) -> trackLogHintsFeedback false, hintId
@@ -247,7 +251,10 @@ define [
return path
$scope.recompile = (options = {}) ->
+ event_tracking.sendCountly "editor-recompile", options
+
return if $scope.pdf.compiling
+
$scope.pdf.compiling = true
ide.$scope.$broadcast("flush-changes")
@@ -267,6 +274,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 {
@@ -280,6 +290,7 @@ define [
$scope.toggleLogs = () ->
$scope.shouldShowLogs = !$scope.shouldShowLogs
+ event_tracking.sendCountly "ide-open-logs" if $scope.shouldShowLogs
$scope.showPdf = () ->
$scope.pdf.view = "pdf"
@@ -287,6 +298,7 @@ define [
$scope.toggleRawLog = () ->
$scope.pdf.showRawLog = !$scope.pdf.showRawLog
+ event_tracking.sendCountly "logs-view-raw" if $scope.pdf.showRawLog
$scope.openClearCacheModal = () ->
modalInstance = $modal.open(
@@ -439,8 +451,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.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 4e6bbcea3d..14dfe92f56 100644
--- a/services/web/public/coffee/ide/settings/services/settings.coffee
+++ b/services/web/public/coffee/ide/settings/services/settings.coffee
@@ -1,19 +1,43 @@
define [
"base"
], (App) ->
- App.factory "settings", ["ide", (ide) ->
+ 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.sendCountly "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.sendCountly "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.sendCountly "project-admin-setting-changed", { changedSetting, changedSettingVal }
+ # End of tracking code.
+
data._csrf = window.csrfToken
ide.$http.post "/project/#{ide.project_id}/settings/admin", data
+
}
]
\ No newline at end of file
diff --git a/services/web/public/coffee/ide/share/controllers/ShareController.coffee b/services/web/public/coffee/ide/share/controllers/ShareController.coffee
index d76bd07965..fc74862528 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.sendCountly "ide-open-share-modal"
+
$modal.open(
templateUrl: "shareProjectModalTemplate"
controller: "ShareProjectModalController"
diff --git a/services/web/public/coffee/main/event.coffee b/services/web/public/coffee/main/event.coffee
index a0f7a4cedb..58e43f3b9f 100644
--- a/services/web/public/coffee/main/event.coffee
+++ b/services/web/public/coffee/main/event.coffee
@@ -6,10 +6,23 @@ 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)->