From af93ac4413bbfbd488b3e7897d353a879931ab60 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Mon, 11 Jul 2016 14:27:07 +0100 Subject: [PATCH] Track suggestions usage. --- services/web/app/views/contact-us-modal.jade | 2 +- services/web/public/coffee/main/contact-us.coffee | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/services/web/app/views/contact-us-modal.jade b/services/web/app/views/contact-us-modal.jade index 33780592ce..1b6c8078de 100644 --- a/services/web/app/views/contact-us-modal.jade +++ b/services/web/app/views/contact-us-modal.jade @@ -21,7 +21,7 @@ script(type='text/ng-template', id='supportModalTemplate') p.contact-suggestion-label #{translate("kb_suggestions_enquiry")} ul.contact-suggestion-list li(ng-repeat="suggestion in suggestions") - a.contact-suggestion-list-item(ng-href="{{ suggestion.url }}", target="_blank") + a.contact-suggestion-list-item(ng-href="{{ suggestion.url }}", ng-click="clickSuggestionLink(suggestion.url);" target="_blank") span(ng-bind-html="suggestion.name") i.fa.fa-angle-right label.desc(ng-show="'#{getUserEmail()}'.length < 1") diff --git a/services/web/public/coffee/main/contact-us.coffee b/services/web/public/coffee/main/contact-us.coffee index c8f0306c3c..2868fca3c8 100644 --- a/services/web/public/coffee/main/contact-us.coffee +++ b/services/web/public/coffee/main/contact-us.coffee @@ -10,7 +10,7 @@ define [ controller: "SupportModalController" ) - App.controller 'SupportModalController', ($scope, $modalInstance, algoliaSearch) -> + App.controller 'SupportModalController', ($scope, $modalInstance, algoliaSearch, event_tracking) -> $scope.form = {} $scope.sent = false $scope.sending = false @@ -24,6 +24,8 @@ define [ url :"/learn/kb/#{page_underscored}" name : hit._highlightResult.pageName.value + event_tracking.sendCountly "contact-form-suggestions-shown" if results.hits.length + $scope.$applyAsync () -> $scope.suggestions = suggestions @@ -57,6 +59,9 @@ define [ else $scope.suggestions = []; + $scope.clickSuggestionLink = (url) -> + event_tracking.sendCountly "contact-form-suggestions-clicked", { url } + $scope.close = () -> $modalInstance.close()