Changing a bit the analytics api
parent
d29051e763
commit
1e7b00a553
|
@ -343,7 +343,6 @@ RegisterDirective = ($auth, $confirm, $location, $navUrls, $config, $routeParams
|
||||||
|
|
||||||
onSuccessSubmit = (response) ->
|
onSuccessSubmit = (response) ->
|
||||||
$analytics.trackEvent("auth", "register", "user registration", 1)
|
$analytics.trackEvent("auth", "register", "user registration", 1)
|
||||||
$analytics.addEcStep("register", null, null)
|
|
||||||
|
|
||||||
if $scope.nextUrl.indexOf('http') == 0
|
if $scope.nextUrl.indexOf('http') == 0
|
||||||
$window.location.href = $scope.nextUrl
|
$window.location.href = $scope.nextUrl
|
||||||
|
@ -534,7 +533,6 @@ InvitationDirective = ($auth, $confirm, $location, $config, $params, $navUrls, $
|
||||||
onSuccessSubmitRegister = (response) ->
|
onSuccessSubmitRegister = (response) ->
|
||||||
$analytics.trackEvent("auth", "invitationAccept", "invitation accept with new user", 1)
|
$analytics.trackEvent("auth", "invitationAccept", "invitation accept with new user", 1)
|
||||||
$analytics.trackEvent("auth", "register", "user registration", 1)
|
$analytics.trackEvent("auth", "register", "user registration", 1)
|
||||||
$analytics.addEcStep("register", null, null)
|
|
||||||
|
|
||||||
$location.path($navUrls.resolve("project", {project: $scope.invitation.project_slug}))
|
$location.path($navUrls.resolve("project", {project: $scope.invitation.project_slug}))
|
||||||
$confirm.notify("success", "You've successfully joined this project",
|
$confirm.notify("success", "You've successfully joined this project",
|
||||||
|
|
|
@ -85,7 +85,7 @@ class AnalyticsService extends taiga.Service
|
||||||
|
|
||||||
@win.ga("send", "event", category, action, label, value)
|
@win.ga("send", "event", category, action, label, value)
|
||||||
|
|
||||||
addEcStep: (step) ->
|
ecStep: (step) ->
|
||||||
return if not @.initialized
|
return if not @.initialized
|
||||||
return if not @win.ga
|
return if not @win.ga
|
||||||
|
|
||||||
|
@ -100,21 +100,11 @@ class AnalyticsService extends taiga.Service
|
||||||
else if step == "plan-changed"
|
else if step == "plan-changed"
|
||||||
stepId = 5
|
stepId = 5
|
||||||
|
|
||||||
@win.ga('ec:setAction','checkout', {
|
|
||||||
'step': stepId,
|
|
||||||
})
|
|
||||||
@.trackEvent("ecommerce", "add-step", step, stepId)
|
|
||||||
|
|
||||||
addEcImpression: (plan, page, position) ->
|
ecViewPlan: (plan) ->
|
||||||
return if not @.initialized
|
return if not @.initialized
|
||||||
return if not @win.ga
|
return if not @win.ga
|
||||||
|
|
||||||
@win.ga('ec:addImpression', {
|
|
||||||
'id': plan.plan_id,
|
|
||||||
'name': plan.name,
|
|
||||||
'list': page,
|
|
||||||
'position': position,
|
|
||||||
})
|
|
||||||
@win.ga('ec:addProduct', {
|
@win.ga('ec:addProduct', {
|
||||||
'id': plan.plan_id,
|
'id': plan.plan_id,
|
||||||
'name': plan.name,
|
'name': plan.name,
|
||||||
|
@ -123,6 +113,35 @@ class AnalyticsService extends taiga.Service
|
||||||
'position': 1,
|
'position': 1,
|
||||||
})
|
})
|
||||||
@win.ga('ec:setAction','detail')
|
@win.ga('ec:setAction','detail')
|
||||||
|
@.trackEvent("ecommerce", "view-product-detail", plan.name, plan.plan_id)
|
||||||
|
|
||||||
|
ecClickPlan: (plan) ->
|
||||||
|
return if not @.initialized
|
||||||
|
return if not @win.ga
|
||||||
|
|
||||||
|
@win.ga('ec:addProduct', {
|
||||||
|
'id': plan.plan_id,
|
||||||
|
'name': plan.name,
|
||||||
|
'category': "plans",
|
||||||
|
'quantity': 1,
|
||||||
|
'position': 1,
|
||||||
|
})
|
||||||
|
@win.ga('ec:setAction','click')
|
||||||
|
@.trackEvent("ecommerce", "click-product", plan.name, plan.plan_id)
|
||||||
|
|
||||||
|
ecListPlans: ([plans], page) ->
|
||||||
|
return if not @.initialized
|
||||||
|
return if not @win.ga
|
||||||
|
|
||||||
|
position = 1
|
||||||
|
for plan in plans
|
||||||
|
@win.ga('ec:addImpression', {
|
||||||
|
'id': plan.plan_id,
|
||||||
|
'name': plan.name,
|
||||||
|
'list': page,
|
||||||
|
'position': position,
|
||||||
|
})
|
||||||
|
position++
|
||||||
@.trackEvent("ecommerce", "add-impression", plan.name, plan.plan_id)
|
@.trackEvent("ecommerce", "add-impression", plan.name, plan.plan_id)
|
||||||
|
|
||||||
addEcClickProduct: (plan) ->
|
addEcClickProduct: (plan) ->
|
||||||
|
@ -139,7 +158,7 @@ class AnalyticsService extends taiga.Service
|
||||||
@win.ga('ec:setAction','click')
|
@win.ga('ec:setAction','click')
|
||||||
@.trackEvent("ecommerce", "add-click", plan.name, plan.plan_id)
|
@.trackEvent("ecommerce", "add-click", plan.name, plan.plan_id)
|
||||||
|
|
||||||
addEcProduct: (plan_id, plan_name, plan_price) ->
|
ecAddToCart: (plan_id, plan_name, plan_price) ->
|
||||||
return if not @.initialized
|
return if not @.initialized
|
||||||
return if not @win.ga
|
return if not @win.ga
|
||||||
|
|
||||||
|
@ -153,6 +172,11 @@ class AnalyticsService extends taiga.Service
|
||||||
})
|
})
|
||||||
@win.ga('ec:setAction','add')
|
@win.ga('ec:setAction','add')
|
||||||
@win.ga('send', 'event', 'add-to-cart', 'Collect Payment Info')
|
@win.ga('send', 'event', 'add-to-cart', 'Collect Payment Info')
|
||||||
|
|
||||||
|
ecConfirmChange: (plan_id, plan_name, plan_price) ->
|
||||||
|
return if not @.initialized
|
||||||
|
return if not @win.ga
|
||||||
|
|
||||||
@win.ga('ec:addProduct', {
|
@win.ga('ec:addProduct', {
|
||||||
'id': plan_id,
|
'id': plan_id,
|
||||||
'name': plan_name,
|
'name': plan_name,
|
||||||
|
@ -163,10 +187,12 @@ class AnalyticsService extends taiga.Service
|
||||||
})
|
})
|
||||||
@.addEcStep("confirm-plan")
|
@.addEcStep("confirm-plan")
|
||||||
|
|
||||||
addEcPurchase: (plan_id, plan_name, plan_price) ->
|
ecPurchase: (plan_id, plan_name, plan_price) ->
|
||||||
return if not @.initialized
|
return if not @.initialized
|
||||||
return if not @win.ga
|
return if not @win.ga
|
||||||
|
|
||||||
|
@.addEcStep("plan-changed")
|
||||||
|
|
||||||
@win.ga('ec:addProduct', {
|
@win.ga('ec:addProduct', {
|
||||||
'id': plan_id,
|
'id': plan_id,
|
||||||
'name': plan_name,
|
'name': plan_name,
|
||||||
|
@ -181,10 +207,4 @@ class AnalyticsService extends taiga.Service
|
||||||
})
|
})
|
||||||
@win.ga('send', 'event', 'checkout', 'Plan checkout')
|
@win.ga('send', 'event', 'checkout', 'Plan checkout')
|
||||||
|
|
||||||
setEcAction: (action, page) ->
|
|
||||||
@win.ga('ec:setAction', action, {
|
|
||||||
'list': page
|
|
||||||
})
|
|
||||||
@.trackEvent("ecommerce", "set-action", (action+page), 0)
|
|
||||||
|
|
||||||
module.service("$tgAnalytics", AnalyticsService)
|
module.service("$tgAnalytics", AnalyticsService)
|
||||||
|
|
Loading…
Reference in New Issue