mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 04:15:25 -05:00
39cb74286d
GitOrigin-RevId: 755fd2f8a1be48ab6520aaab34ca2ea5d070302d
44 lines
1 KiB
JavaScript
44 lines
1 KiB
JavaScript
import * as eventTracking from '../infrastructure/event-tracking'
|
|
|
|
function startFreeTrial(source, version, $scope) {
|
|
eventTracking.send('subscription-funnel', 'upgraded-free-trial', source)
|
|
eventTracking.sendMB('paywall-click', { 'paywall-type': source })
|
|
|
|
const searchParams = new URLSearchParams({
|
|
itm_campaign: source,
|
|
})
|
|
|
|
if (version) {
|
|
searchParams.set('itm_content', version)
|
|
}
|
|
|
|
if ($scope) {
|
|
$scope.startedFreeTrial = true
|
|
}
|
|
|
|
window.open(`/user/subscription/choose-your-plan?${searchParams.toString()}`)
|
|
}
|
|
|
|
function upgradePlan(source, $scope) {
|
|
const w = window.open()
|
|
const go = function () {
|
|
if (typeof ga === 'function') {
|
|
ga('send', 'event', 'subscription-funnel', 'upgraded-plan', source)
|
|
}
|
|
const url = '/user/subscription'
|
|
|
|
if ($scope) {
|
|
$scope.startedFreeTrial = true
|
|
}
|
|
|
|
w.location = url
|
|
}
|
|
|
|
go()
|
|
}
|
|
|
|
function paywallPrompt(source) {
|
|
eventTracking.sendMB('paywall-prompt', { 'paywall-type': source })
|
|
}
|
|
|
|
export { startFreeTrial, upgradePlan, paywallPrompt }
|