2020-05-19 05:02:56 -04:00
|
|
|
import App from '../base'
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
export default App.controller('FreeTrialModalController', function(
|
|
|
|
$scope,
|
|
|
|
eventTracking
|
|
|
|
) {
|
|
|
|
$scope.buttonClass = 'btn-primary'
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
$scope.startFreeTrial = function(source, version) {
|
|
|
|
const plan = 'collaborator_free_trial_7_days'
|
2019-10-25 04:22:23 -04:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
const w = window.open()
|
|
|
|
const go = function() {
|
|
|
|
let url
|
|
|
|
if (typeof ga === 'function') {
|
|
|
|
ga(
|
|
|
|
'send',
|
|
|
|
'event',
|
|
|
|
'subscription-funnel',
|
|
|
|
'upgraded-free-trial',
|
|
|
|
source
|
|
|
|
)
|
|
|
|
}
|
|
|
|
url = `/user/subscription/new?planCode=${plan}&ssp=true`
|
|
|
|
url = `${url}&itm_campaign=${source}`
|
|
|
|
if (version) {
|
|
|
|
url = `${url}&itm_content=${version}`
|
|
|
|
}
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
$scope.startedFreeTrial = true
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
eventTracking.sendMB('subscription-start-trial', { source, plan })
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
w.location = url
|
2019-10-23 08:22:50 -04:00
|
|
|
}
|
2020-05-19 05:02:56 -04:00
|
|
|
|
|
|
|
go()
|
|
|
|
}
|
|
|
|
})
|