Adding analytics ECommerce steps

stable
Jesús Espino 2017-09-07 15:12:55 +02:00
parent e4dd9598fc
commit 9d4be7e69f
2 changed files with 23 additions and 0 deletions

View File

@ -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

View File

@ -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)