Merge pull request #279 from sharelatex/pr-track-trial-start

Track trial start and subscription
This commit is contained in:
Paulo Jorge Reis 2016-07-14 10:14:49 +01:00 committed by GitHub
commit 0b21f8f4f1
3 changed files with 18 additions and 2 deletions

View file

@ -348,6 +348,9 @@ define [
$scope.startFreeTrial = (source) ->
ga?('send', 'event', 'subscription-funnel', 'compile-timeout', source)
event_tracking.sendCountly "subscription-start-trial", { source }
window.open("/user/subscription/new?planCode=student_free_trial_7_days")
$scope.startedFreeTrial = true

View file

@ -1,11 +1,13 @@
define [
"base"
], (App) ->
App.controller "FreeTrialModalController", ($scope, abTestManager, sixpack)->
App.controller "FreeTrialModalController", ($scope, abTestManager, sixpack, event_tracking)->
$scope.buttonClass = "btn-primary"
$scope.startFreeTrial = (source, couponCode) ->
event_tracking.sendCountly "subscription-start-trial", { source }
w = window.open()
sixpack.convert "track-changes-discount", ->
sixpack.participate 'in-editor-free-trial-plan', ['student', 'collaborator'], (planName, rawResponse)->

View file

@ -2,7 +2,7 @@ define [
"base"
], (App)->
App.controller "NewSubscriptionController", ($scope, MultiCurrencyPricing, abTestManager, $http, sixpack)->
App.controller "NewSubscriptionController", ($scope, MultiCurrencyPricing, abTestManager, $http, sixpack, event_tracking)->
throw new Error("Recurly API Library Missing.") if typeof recurly is "undefined"
$scope.currencyCode = MultiCurrencyPricing.currencyCode
@ -51,6 +51,8 @@ define [
.done()
pricing.on "change", =>
event_tracking.sendCountly "subscription-form", { plan : pricing.items.plan.code }
$scope.planName = pricing.items.plan.name
$scope.price = pricing.price
$scope.trialLength = pricing.items.plan.trial?.length
@ -122,9 +124,18 @@ define [
country: $scope.data.country
state: $scope.data.state
postal_code: $scope.data.postal_code
event_tracking.sendCountly "subscription-form-submitted", {
currencyCode : postData.subscriptionDetails.currencyCode,
plan_code : postData.subscriptionDetails.plan_code,
coupon_code : postData.subscriptionDetails.coupon_code,
isPaypal : postData.subscriptionDetails.isPaypal
}
$http.post("/user/subscription/create", postData)
.success (data, status, headers)->
sixpack.convert "in-editor-free-trial-plan", pricing.items.plan.code, (err)->
event_tracking.sendCountly "subscription-submission-success"
window.location.href = "/user/subscription/thank-you"
.error (data, status, headers)->
$scope.processing = false