diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index 242d4ad2..031443c1 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -343,6 +343,7 @@ RegisterDirective = ($auth, $confirm, $location, $navUrls, $config, $routeParams onSuccessSubmit = (response) -> $analytics.trackEvent("auth", "register", "user registration", 1) + $analytics.addEcStep("register", null, null) if $scope.nextUrl.indexOf('http') == 0 $window.location.href = $scope.nextUrl diff --git a/app/coffee/modules/common/analytics.coffee b/app/coffee/modules/common/analytics.coffee index 1511a58c..9c7226af 100644 --- a/app/coffee/modules/common/analytics.coffee +++ b/app/coffee/modules/common/analytics.coffee @@ -48,6 +48,7 @@ class AnalyticsService extends taiga.Service @win.ga("create", @.accountId, "auto") @win.ga("require", "displayfeatures") + @win.ga("require", "ec") if @.trackRoutes and (not @.ignoreFirstPageLoad) @win.ga("send", "pageview", @.getUrl()) @@ -84,6 +85,27 @@ class AnalyticsService extends taiga.Service @win.ga("send", "event", category, action, label, value) + addEcStep: (step, currentPlan, selectedPlan) -> + option = { + "currentPlan": currentPlan, + "selectedPlan": selectedPlan, + } + + if step == "register" + stepId = 1 + else if step == "change-plan" + stepId = 2 + else if step == "select-plan" + stepId = 3 + else if step == "confirm-plan" + stepId = 4 + else if step == "plan-changed" + stepId = 5 + + ga('ec:setAction','checkout', { + 'step': stepId, + 'Option': option + }) module.service("$tgAnalytics", AnalyticsService)