[backport] Fixing analytics checkout process
parent
c1725f6268
commit
631d2a3e39
|
@ -86,6 +86,9 @@ class AnalyticsService extends taiga.Service
|
||||||
@win.ga("send", "event", category, action, label, value)
|
@win.ga("send", "event", category, action, label, value)
|
||||||
|
|
||||||
addEcStep: (step, currentPlan, selectedPlan) ->
|
addEcStep: (step, currentPlan, selectedPlan) ->
|
||||||
|
return if not @.initialized
|
||||||
|
return if not @win.ga
|
||||||
|
|
||||||
option = {
|
option = {
|
||||||
"currentPlan": currentPlan,
|
"currentPlan": currentPlan,
|
||||||
"selectedPlan": selectedPlan,
|
"selectedPlan": selectedPlan,
|
||||||
|
@ -109,6 +112,9 @@ class AnalyticsService extends taiga.Service
|
||||||
@.trackEvent("ecommerce", "add-step", step, stepId)
|
@.trackEvent("ecommerce", "add-step", step, stepId)
|
||||||
|
|
||||||
addEcImpression: (plan, page, position) ->
|
addEcImpression: (plan, page, position) ->
|
||||||
|
return if not @.initialized
|
||||||
|
return if not @win.ga
|
||||||
|
|
||||||
@win.ga('ec:addImpression', {
|
@win.ga('ec:addImpression', {
|
||||||
'id': plan.plan_id,
|
'id': plan.plan_id,
|
||||||
'name': plan.name,
|
'name': plan.name,
|
||||||
|
@ -117,18 +123,36 @@ class AnalyticsService extends taiga.Service
|
||||||
})
|
})
|
||||||
@.trackEvent("ecommerce", "add-impression", plan.name, plan.plan_id)
|
@.trackEvent("ecommerce", "add-impression", plan.name, plan.plan_id)
|
||||||
|
|
||||||
addEcProduct: (plan) ->
|
addEcProduct: (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.plan_id,
|
'id': plan.plan_id,
|
||||||
'name': plan.name,
|
'name': plan.name,
|
||||||
|
'price': plan.price,
|
||||||
|
'category': "plans",
|
||||||
|
'quantity': 1,
|
||||||
'position': 1,
|
'position': 1,
|
||||||
})
|
})
|
||||||
@.trackEvent("ecommerce", "add-product", plan.name, plan.plan_id)
|
@win.ga('send', 'event', 'checkout', 'Collect Payment Info')
|
||||||
|
|
||||||
setEcAction: (action, page) ->
|
addEcPurchase: (plan_id, plan_name, plan_price) ->
|
||||||
@win.ga('ec:setAction', action, {
|
return if not @.initialized
|
||||||
'list': page
|
return if not @win.ga
|
||||||
|
|
||||||
|
@win.ga('ec:addProduct', {
|
||||||
|
'id': plan_id,
|
||||||
|
'name': plan_name,
|
||||||
|
'price': plan_price,
|
||||||
|
'category': "plans",
|
||||||
|
'quantity': 1,
|
||||||
|
'position': 1,
|
||||||
})
|
})
|
||||||
@.trackEvent("ecommerce", "set-action", (action+page), 0)
|
@win.ga('ec:setAction','purchase', {
|
||||||
|
'id': response.data.data.subscriptionId,
|
||||||
|
'revenue': plan_price,
|
||||||
|
})
|
||||||
|
@win.ga('send', 'event', 'checkout', 'Plan checkout')
|
||||||
|
|
||||||
module.service("$tgAnalytics", AnalyticsService)
|
module.service("$tgAnalytics", AnalyticsService)
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue