From b1229d5bd030538a458ea9587a38fbea69c88cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Wed, 4 Oct 2017 14:30:33 +0200 Subject: [PATCH] Add analytics on search pages --- app/coffee/modules/search.coffee | 5 +++-- .../discover-search/discover-search.controller.coffee | 7 ++++++- gulpfile.js | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/coffee/modules/search.coffee b/app/coffee/modules/search.coffee index 760ea40b..e1e09b8c 100644 --- a/app/coffee/modules/search.coffee +++ b/app/coffee/modules/search.coffee @@ -177,7 +177,7 @@ module.directive("tgSearchBox", SearchBoxDirective) ## Search Directive ############################################################################# -SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) -> +SearchDirective = ($log, $compile, $templatecache, $routeparams, $location, $analytics) -> linkTable = ($scope, $el, $attrs, $ctrl) -> applyAutoTab = true activeSectionName = "userstories" @@ -261,6 +261,7 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) -> $scope.$watch "searchTerm", (searchTerm) -> $location.search("text", searchTerm) if searchTerm != undefined + $analytics.trackPage($location.url(), "Search") $el.on "click", ".search-filter li > a", (event) -> event.preventDefault() @@ -288,5 +289,5 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) -> return {link:link} -module.directive("tgSearch", ["$log", "$compile", "$templateCache", "$routeParams", "$tgLocation", +module.directive("tgSearch", ["$log", "$compile", "$templateCache", "$routeParams", "$tgLocation", "$tgAnalytics", SearchDirective]) diff --git a/app/modules/discover/discover-search/discover-search.controller.coffee b/app/modules/discover/discover-search/discover-search.controller.coffee index 0f1aa4ac..b4205742 100644 --- a/app/modules/discover/discover-search/discover-search.controller.coffee +++ b/app/modules/discover/discover-search/discover-search.controller.coffee @@ -22,11 +22,13 @@ class DiscoverSearchController '$routeParams', 'tgDiscoverProjectsService', '$route', + '$tgLocation', + '$tgAnalytics', 'tgAppMetaService', '$translate' ] - constructor: (@routeParams, @discoverProjectsService, @route, @appMetaService, @translate) -> + constructor: (@routeParams, @discoverProjectsService, @route, @location, @analytics, @appMetaService, @translate) -> @.page = 1 taiga.defineImmutableProperty @, "searchResult", () => return @discoverProjectsService.searchResult @@ -43,6 +45,7 @@ class DiscoverSearchController title = @translate.instant("DISCOVER.SEARCH.PAGE_TITLE") description = @translate.instant("DISCOVER.SEARCH.PAGE_DESCRIPTION") @appMetaService.setAll(title, description) + @analytics.trackPage(@location.url(), "Discover Search") fetch: () -> @.page = 1 @@ -105,6 +108,7 @@ class DiscoverSearchController filter: @.filter, text: @.q }) + @analytics.trackPage(@location.url(), "Discover Search") @.fetchByGlobalSearch() @@ -114,6 +118,7 @@ class DiscoverSearchController @route.updateParams({ order_by: orderBy }) + @analytics.trackPage(@location.url(), "Discover Search") @.fetchByOrderBy() diff --git a/gulpfile.js b/gulpfile.js index 0e7d374a..f28862f6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -716,7 +716,7 @@ gulp.task("express", function() { res.sendFile("index.html", {root: __dirname + "/dist/"}); }); - app.listen(9001); + app.listen(9002); }); //Rerun the task when a file changes