Add analytics on search pages

stable
Jesús Espino 2017-10-04 14:30:33 +02:00
parent 9199247e5d
commit b1229d5bd0
3 changed files with 10 additions and 4 deletions

View File

@ -177,7 +177,7 @@ module.directive("tgSearchBox", SearchBoxDirective)
## Search Directive ## Search Directive
############################################################################# #############################################################################
SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) -> SearchDirective = ($log, $compile, $templatecache, $routeparams, $location, $analytics) ->
linkTable = ($scope, $el, $attrs, $ctrl) -> linkTable = ($scope, $el, $attrs, $ctrl) ->
applyAutoTab = true applyAutoTab = true
activeSectionName = "userstories" activeSectionName = "userstories"
@ -261,6 +261,7 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) ->
$scope.$watch "searchTerm", (searchTerm) -> $scope.$watch "searchTerm", (searchTerm) ->
$location.search("text", searchTerm) if searchTerm != undefined $location.search("text", searchTerm) if searchTerm != undefined
$analytics.trackPage($location.url(), "Search")
$el.on "click", ".search-filter li > a", (event) -> $el.on "click", ".search-filter li > a", (event) ->
event.preventDefault() event.preventDefault()
@ -288,5 +289,5 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) ->
return {link:link} return {link:link}
module.directive("tgSearch", ["$log", "$compile", "$templateCache", "$routeParams", "$tgLocation", module.directive("tgSearch", ["$log", "$compile", "$templateCache", "$routeParams", "$tgLocation", "$tgAnalytics",
SearchDirective]) SearchDirective])

View File

@ -22,11 +22,13 @@ class DiscoverSearchController
'$routeParams', '$routeParams',
'tgDiscoverProjectsService', 'tgDiscoverProjectsService',
'$route', '$route',
'$tgLocation',
'$tgAnalytics',
'tgAppMetaService', 'tgAppMetaService',
'$translate' '$translate'
] ]
constructor: (@routeParams, @discoverProjectsService, @route, @appMetaService, @translate) -> constructor: (@routeParams, @discoverProjectsService, @route, @location, @analytics, @appMetaService, @translate) ->
@.page = 1 @.page = 1
taiga.defineImmutableProperty @, "searchResult", () => return @discoverProjectsService.searchResult taiga.defineImmutableProperty @, "searchResult", () => return @discoverProjectsService.searchResult
@ -43,6 +45,7 @@ class DiscoverSearchController
title = @translate.instant("DISCOVER.SEARCH.PAGE_TITLE") title = @translate.instant("DISCOVER.SEARCH.PAGE_TITLE")
description = @translate.instant("DISCOVER.SEARCH.PAGE_DESCRIPTION") description = @translate.instant("DISCOVER.SEARCH.PAGE_DESCRIPTION")
@appMetaService.setAll(title, description) @appMetaService.setAll(title, description)
@analytics.trackPage(@location.url(), "Discover Search")
fetch: () -> fetch: () ->
@.page = 1 @.page = 1
@ -105,6 +108,7 @@ class DiscoverSearchController
filter: @.filter, filter: @.filter,
text: @.q text: @.q
}) })
@analytics.trackPage(@location.url(), "Discover Search")
@.fetchByGlobalSearch() @.fetchByGlobalSearch()
@ -114,6 +118,7 @@ class DiscoverSearchController
@route.updateParams({ @route.updateParams({
order_by: orderBy order_by: orderBy
}) })
@analytics.trackPage(@location.url(), "Discover Search")
@.fetchByOrderBy() @.fetchByOrderBy()

View File

@ -716,7 +716,7 @@ gulp.task("express", function() {
res.sendFile("index.html", {root: __dirname + "/dist/"}); res.sendFile("index.html", {root: __dirname + "/dist/"});
}); });
app.listen(9001); app.listen(9002);
}); });
//Rerun the task when a file changes //Rerun the task when a file changes