Adding new analytics events
parent
0f7f49f6e6
commit
438320ad4c
|
@ -141,7 +141,7 @@ module.controller("ProjectProfileController", ProjectProfileController)
|
|||
## Project Profile Directive
|
||||
#############################################################################
|
||||
|
||||
ProjectProfileDirective = ($repo, $confirm, $loading, $navurls, $location, projectService, currentUserService) ->
|
||||
ProjectProfileDirective = ($repo, $confirm, $loading, $navurls, $location, projectService, currentUserService, $analytics) ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
$ctrl = $el.controller()
|
||||
|
||||
|
@ -155,9 +155,24 @@ ProjectProfileDirective = ($repo, $confirm, $loading, $navurls, $location, proje
|
|||
.target(submitButton)
|
||||
.start()
|
||||
|
||||
privacyChanged = $scope.project.isAttributeModified("is_private")
|
||||
promise = $repo.save($scope.project)
|
||||
promise.then ->
|
||||
currentLoading.finish()
|
||||
if privacyChanged && $scope.project.is_private
|
||||
$analytics.trackEvent(
|
||||
"project-privacy-changed",
|
||||
"from-public-to-private",
|
||||
"Change project privacy from public to private",
|
||||
1
|
||||
)
|
||||
else if privacyChanged && !$scope.project.is_private
|
||||
$analytics.trackEvent(
|
||||
"project-privacy-changed",
|
||||
"from-private-to-public",
|
||||
"Change project privacy from private to public",
|
||||
1
|
||||
)
|
||||
$confirm.notify("success")
|
||||
newUrl = $navurls.resolve("project-admin-project-profile-details", {
|
||||
project: $scope.project.slug
|
||||
|
@ -182,7 +197,8 @@ ProjectProfileDirective = ($repo, $confirm, $loading, $navurls, $location, proje
|
|||
return {link:link}
|
||||
|
||||
module.directive("tgProjectProfile", ["$tgRepo", "$tgConfirm", "$tgLoading", "$tgNavUrls", "$tgLocation",
|
||||
"tgProjectService", "tgCurrentUserService", ProjectProfileDirective])
|
||||
"tgProjectService", "tgCurrentUserService", "$tgAnalytics",
|
||||
ProjectProfileDirective])
|
||||
|
||||
|
||||
#############################################################################
|
||||
|
@ -295,7 +311,7 @@ module.directive("tgProjectModules", ["$tgRepo", "$tgConfirm", "$tgLoading", "tg
|
|||
## Project Export Directive
|
||||
#############################################################################
|
||||
|
||||
ProjectExportDirective = ($window, $rs, $confirm, $translate) ->
|
||||
ProjectExportDirective = ($window, $rs, $confirm, $translate, $analytics) ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
buttonsEl = $el.find(".admin-project-export-buttons")
|
||||
showButtons = -> buttonsEl.removeClass("hidden")
|
||||
|
@ -354,6 +370,7 @@ ProjectExportDirective = ($window, $rs, $confirm, $translate) ->
|
|||
event.preventDefault()
|
||||
|
||||
onSuccess = (result) =>
|
||||
$analytics.trackEvent("exporter", "export-project", "Exported project", 1)
|
||||
if result.status == 202 # Async mode
|
||||
showExportResultAsyncMode()
|
||||
else #result.status == 200 # Sync mode
|
||||
|
@ -380,7 +397,7 @@ ProjectExportDirective = ($window, $rs, $confirm, $translate) ->
|
|||
return {link:link}
|
||||
|
||||
module.directive("tgProjectExport", ["$window", "$tgResources", "$tgConfirm", "$translate",
|
||||
ProjectExportDirective])
|
||||
"$tgAnalytics", ProjectExportDirective])
|
||||
|
||||
|
||||
#############################################################################
|
||||
|
|
|
@ -235,7 +235,7 @@ module.directive("tgWebhook", ["$tgResources", "$tgRepo", "$tgConfirm", "$tgLoad
|
|||
## New webhook Directive
|
||||
#############################################################################
|
||||
|
||||
NewWebhookDirective = ($rs, $repo, $confirm, $loading) ->
|
||||
NewWebhookDirective = ($rs, $repo, $confirm, $loading, $analytics) ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
webhook = $scope.$eval($attrs.tgWebhook)
|
||||
formDOMNode = $el.find(".new-webhook-form")
|
||||
|
@ -266,6 +266,7 @@ NewWebhookDirective = ($rs, $repo, $confirm, $loading) ->
|
|||
$scope.newValue.project = $scope.project.id
|
||||
promise = $repo.create("webhooks", $scope.newValue)
|
||||
promise.then =>
|
||||
$analytics.trackEvent("webhooks", "create", "Create new webhook", 1)
|
||||
$scope.$emit("webhooks:reload")
|
||||
initializeNewValue()
|
||||
|
||||
|
@ -295,7 +296,7 @@ NewWebhookDirective = ($rs, $repo, $confirm, $loading) ->
|
|||
|
||||
return {link:link}
|
||||
|
||||
module.directive("tgNewWebhook", ["$tgResources", "$tgRepo", "$tgConfirm", "$tgLoading", NewWebhookDirective])
|
||||
module.directive("tgNewWebhook", ["$tgResources", "$tgRepo", "$tgConfirm", "$tgLoading", "$tgAnalytics", NewWebhookDirective])
|
||||
|
||||
|
||||
#############################################################################
|
||||
|
@ -464,7 +465,7 @@ module.directive("tgSelectInputText", SelectInputText)
|
|||
## GithubWebhooks Directive
|
||||
#############################################################################
|
||||
|
||||
GithubWebhooksDirective = ($repo, $confirm, $loading) ->
|
||||
GithubWebhooksDirective = ($repo, $confirm, $loading, $analytics) ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
form = $el.find("form").checksley({"onlyOneErrorElement": true})
|
||||
submit = debounce 2000, (event) =>
|
||||
|
@ -478,6 +479,7 @@ GithubWebhooksDirective = ($repo, $confirm, $loading) ->
|
|||
|
||||
promise = $repo.saveAttribute($scope.github, "github")
|
||||
promise.then ->
|
||||
$analytics.trackEvent("github-webhook", "created-or-changed", "Create or changed github webhook", 1)
|
||||
currentLoading.finish()
|
||||
$confirm.notify("success")
|
||||
|
||||
|
@ -493,14 +495,14 @@ GithubWebhooksDirective = ($repo, $confirm, $loading) ->
|
|||
|
||||
return {link:link}
|
||||
|
||||
module.directive("tgGithubWebhooks", ["$tgRepo", "$tgConfirm", "$tgLoading", GithubWebhooksDirective])
|
||||
module.directive("tgGithubWebhooks", ["$tgRepo", "$tgConfirm", "$tgLoading", "$tgAnalytics", GithubWebhooksDirective])
|
||||
|
||||
|
||||
#############################################################################
|
||||
## GitlabWebhooks Directive
|
||||
#############################################################################
|
||||
|
||||
GitlabWebhooksDirective = ($repo, $confirm, $loading) ->
|
||||
GitlabWebhooksDirective = ($repo, $confirm, $loading, $analytics) ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
form = $el.find("form").checksley({"onlyOneErrorElement": true})
|
||||
submit = debounce 2000, (event) =>
|
||||
|
@ -514,6 +516,7 @@ GitlabWebhooksDirective = ($repo, $confirm, $loading) ->
|
|||
|
||||
promise = $repo.saveAttribute($scope.gitlab, "gitlab")
|
||||
promise.then ->
|
||||
$analytics.trackEvent("gitlab-webhook", "created-or-changed", "Create or changed gitlab webhook", 1)
|
||||
currentLoading.finish()
|
||||
$confirm.notify("success")
|
||||
$scope.$emit("project:modules:reload")
|
||||
|
@ -530,14 +533,14 @@ GitlabWebhooksDirective = ($repo, $confirm, $loading) ->
|
|||
|
||||
return {link:link}
|
||||
|
||||
module.directive("tgGitlabWebhooks", ["$tgRepo", "$tgConfirm", "$tgLoading", GitlabWebhooksDirective])
|
||||
module.directive("tgGitlabWebhooks", ["$tgRepo", "$tgConfirm", "$tgLoading", "$tgAnalytics", GitlabWebhooksDirective])
|
||||
|
||||
|
||||
#############################################################################
|
||||
## BitbucketWebhooks Directive
|
||||
#############################################################################
|
||||
|
||||
BitbucketWebhooksDirective = ($repo, $confirm, $loading) ->
|
||||
BitbucketWebhooksDirective = ($repo, $confirm, $loading, $analytics) ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
form = $el.find("form").checksley({"onlyOneErrorElement": true})
|
||||
submit = debounce 2000, (event) =>
|
||||
|
@ -551,6 +554,7 @@ BitbucketWebhooksDirective = ($repo, $confirm, $loading) ->
|
|||
|
||||
promise = $repo.saveAttribute($scope.bitbucket, "bitbucket")
|
||||
promise.then ->
|
||||
$analytics.trackEvent("bitbucket-webhook", "created-or-changed", "Create or changed bitbucket webhook", 1)
|
||||
currentLoading.finish()
|
||||
$confirm.notify("success")
|
||||
$scope.$emit("project:modules:reload")
|
||||
|
@ -567,7 +571,7 @@ BitbucketWebhooksDirective = ($repo, $confirm, $loading) ->
|
|||
|
||||
return {link:link}
|
||||
|
||||
module.directive("tgBitbucketWebhooks", ["$tgRepo", "$tgConfirm", "$tgLoading", BitbucketWebhooksDirective])
|
||||
module.directive("tgBitbucketWebhooks", ["$tgRepo", "$tgConfirm", "$tgLoading", "$tgAnalytics", BitbucketWebhooksDirective])
|
||||
|
||||
|
||||
#############################################################################
|
||||
|
@ -636,4 +640,37 @@ class GogsController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Filt
|
|||
@.loadProject()
|
||||
return @.loadModules()
|
||||
|
||||
GogsWebhooksDirective = ($repo, $confirm, $loading, $analytics) ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
form = $el.find("form").checksley({"onlyOneErrorElement": true})
|
||||
submit = debounce 2000, (event) =>
|
||||
event.preventDefault()
|
||||
|
||||
return if not form.validate()
|
||||
|
||||
currentLoading = $loading()
|
||||
.target(submitButton)
|
||||
.start()
|
||||
|
||||
promise = $repo.saveAttribute($scope.gogs, "gogs")
|
||||
promise.then ->
|
||||
$analytics.trackEvent("gogs-webhook", "create-or-change", "Create or change gogs webhook", 1)
|
||||
currentLoading.finish()
|
||||
$confirm.notify("success")
|
||||
$scope.$emit("project:modules:reload")
|
||||
|
||||
promise.then null, (data) ->
|
||||
currentLoading.finish()
|
||||
form.setErrors(data)
|
||||
if data._error_message
|
||||
$confirm.notify("error", data._error_message)
|
||||
|
||||
submitButton = $el.find(".submit-button")
|
||||
|
||||
$el.on "submit", "form", submit
|
||||
$el.on "click", ".submit-button", submit
|
||||
|
||||
return {link:link}
|
||||
|
||||
module.controller("GogsController", GogsController)
|
||||
module.directive("tgGogsWebhooks", ["$tgRepo", "$tgConfirm", "$tgLoading", "$tgAnalytics", GogsWebhooksDirective])
|
||||
|
|
|
@ -270,7 +270,7 @@ module.directive("tgPublicRegisterMessage", ["$tgConfig", "$tgNavUrls", "$routeP
|
|||
"$tgTemplate", PublicRegisterMessageDirective])
|
||||
|
||||
|
||||
LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls, $events, $translate, $window) ->
|
||||
LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls, $events, $translate, $window, $analytics) ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
form = new checksley.Form($el.find("form.login-form"))
|
||||
|
||||
|
@ -284,6 +284,7 @@ LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls, $
|
|||
|
||||
onSuccess = (response) ->
|
||||
$events.setupConnection()
|
||||
$analytics.trackEvent("auth", "login", "user login", 1)
|
||||
|
||||
if $scope.nextUrl.indexOf('http') == 0
|
||||
$window.location.href = $scope.nextUrl
|
||||
|
@ -326,7 +327,7 @@ LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls, $
|
|||
return {link:link}
|
||||
|
||||
module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgConfig", "$routeParams",
|
||||
"$tgNavUrls", "$tgEvents", "$translate", "$window", LoginDirective])
|
||||
"$tgNavUrls", "$tgEvents", "$translate", "$window", "$tgAnalytics", LoginDirective])
|
||||
|
||||
|
||||
#############################################################################
|
||||
|
|
|
@ -86,6 +86,7 @@ class AnalyticsService extends taiga.Service
|
|||
})
|
||||
|
||||
trackEvent: (category, action, label, value) ->
|
||||
console.log("TRACK EVENT: ", category, action, label, value)
|
||||
return if not @.initialized
|
||||
return if not @win.ga
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ module = angular.module("taigaProject")
|
|||
## Delete Project Lightbox Directive
|
||||
#############################################################################
|
||||
|
||||
DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, $confirm, lightboxService, tgLoader, currentUserService) ->
|
||||
DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, $confirm, lightboxService, tgLoader, currentUserService, $analytics) ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
projectToDelete = null
|
||||
$scope.$on "deletelightbox:new", (ctx, project)->
|
||||
|
@ -50,6 +50,7 @@ DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, $confir
|
|||
promise = $repo.remove(projectToDelete)
|
||||
|
||||
promise.then (data) ->
|
||||
$analytics.trackEvent("projects", "delete", "Delete project", 1)
|
||||
tgLoader.pageLoaded()
|
||||
$rootscope.$broadcast("projects:reload")
|
||||
$location.path($navUrls.resolve("home"))
|
||||
|
@ -72,4 +73,5 @@ DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, $confir
|
|||
return {link:link}
|
||||
|
||||
module.directive("tgLbDeleteProject", ["$tgRepo", "$rootScope", "$tgAuth", "$tgLocation", "$tgNavUrls",
|
||||
"$tgConfirm", "lightboxService", "tgLoader", "tgCurrentUserService", DeleteProjectDirective])
|
||||
"$tgConfirm", "lightboxService", "tgLoader", "tgCurrentUserService",
|
||||
"$tgAnalytics", DeleteProjectDirective])
|
||||
|
|
|
@ -26,10 +26,11 @@ class CreateEpicController
|
|||
@.$inject = [
|
||||
"$tgConfirm"
|
||||
"tgProjectService",
|
||||
"tgEpicsService"
|
||||
"tgEpicsService",
|
||||
"$tgAnalytics"
|
||||
]
|
||||
|
||||
constructor: (@confirm, @projectService, @epicsService) ->
|
||||
constructor: (@confirm, @projectService, @epicsService, @analytics) ->
|
||||
# NOTE: To use Checksley setFormErrors() and validateForm()
|
||||
# are defined in the directive.
|
||||
|
||||
|
@ -53,6 +54,7 @@ class CreateEpicController
|
|||
|
||||
@epicsService.createEpic(@.newEpic, @.attachments)
|
||||
.then (response) => # On success
|
||||
@analytics.trackEvent("epic", "create", "create epic", 1)
|
||||
@.onCreateEpic()
|
||||
@.loading = false
|
||||
.catch (response) => # On error
|
||||
|
|
|
@ -23,10 +23,11 @@ class CreatetProjectFormController
|
|||
"tgProjectsService",
|
||||
"$projectUrl",
|
||||
"$location",
|
||||
"$tgNavUrls"
|
||||
"$tgNavUrls",
|
||||
"$tgAnalytics"
|
||||
]
|
||||
|
||||
constructor: (@currentUserService, @projectsService, @projectUrl, @location, @navUrls) ->
|
||||
constructor: (@currentUserService, @projectsService, @projectUrl, @location, @navUrls, @analytics) ->
|
||||
@.projectForm = {
|
||||
is_private: false
|
||||
}
|
||||
|
@ -46,6 +47,7 @@ class CreatetProjectFormController
|
|||
@.formSubmitLoading = true
|
||||
|
||||
@projectsService.create(@.projectForm).then (project) =>
|
||||
@analytics.trackEvent("project", "create", "project creation", {slug: project.get('slug'), id: project.get('id')})
|
||||
@location.url(@projectUrl.get(project))
|
||||
|
||||
onCancelForm: () ->
|
||||
|
|
|
@ -22,12 +22,15 @@ class ImportTaigaController
|
|||
'$tgConfirm',
|
||||
'$tgResources',
|
||||
'tgImportProjectService',
|
||||
'$translate'
|
||||
'$translate',
|
||||
'$tgAnalytics',
|
||||
]
|
||||
|
||||
constructor: (@confirm, @rs, @importProjectService, @translate) ->
|
||||
constructor: (@confirm, @rs, @importProjectService, @translate, @analytics) ->
|
||||
|
||||
importTaiga: (files) ->
|
||||
@analytics.trackEvent("import", "taiga", "Start import from taiga", 1)
|
||||
|
||||
file = files[0]
|
||||
|
||||
loader = @confirm.loader(@translate.instant('PROJECT.IMPORT.IN_PROGRESS.TITLE'), @translate.instant('PROJECT.IMPORT.IN_PROGRESS.DESCRIPTION'), true)
|
||||
|
|
|
@ -29,9 +29,12 @@ class ImportProjectController
|
|||
'$tgNavUrls',
|
||||
'$tgConfig',
|
||||
'$tgConfirm',
|
||||
'$tgAnalytics',
|
||||
]
|
||||
|
||||
constructor: (@trelloService, @jiraService, @githubService, @asanaService, @location, @window, @routeParams, @tgNavUrls, @config, @confirm) ->
|
||||
constructor: (@trelloService, @jiraService, @githubService, @asanaService,
|
||||
@location, @window, @routeParams, @tgNavUrls, @config, @confirm,
|
||||
@analytics) ->
|
||||
|
||||
start: ->
|
||||
@.token = null
|
||||
|
@ -39,6 +42,9 @@ class ImportProjectController
|
|||
|
||||
locationSearch = @location.search()
|
||||
|
||||
if @.from
|
||||
@analytics.trackEvent("import", @.from, "Start import from "+@.from, 1)
|
||||
|
||||
if @.from == "asana"
|
||||
asanaOauthToken = locationSearch.code
|
||||
if locationSearch.code
|
||||
|
|
Loading…
Reference in New Issue