mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 14:49:01 +02:00
Merge pull request #29557 from overleaf/rh-compile-timeout-event-fix
Send paywall-click events when navigation suppressed GitOrigin-RevId: b36dcb590d4d30a47a30f95febb4cf479c38f377
This commit is contained in:
@@ -4,7 +4,8 @@ export function startFreeTrial(
|
||||
source: string,
|
||||
variant?: string,
|
||||
segmentation?: eventTracking.Segmentation,
|
||||
extraSearchParams?: Record<string, string>
|
||||
extraSearchParams?: Record<string, string>,
|
||||
shouldNavigate: boolean = true
|
||||
) {
|
||||
const eventSegmentation: Record<string, string> = {
|
||||
'paywall-type': source,
|
||||
@@ -17,12 +18,16 @@ export function startFreeTrial(
|
||||
eventTracking.send('subscription-funnel', 'upgraded-free-trial', source)
|
||||
eventTracking.sendMB('paywall-click', eventSegmentation)
|
||||
|
||||
const searchParams = new URLSearchParams({
|
||||
itm_campaign: source,
|
||||
...extraSearchParams,
|
||||
})
|
||||
if (shouldNavigate) {
|
||||
const searchParams = new URLSearchParams({
|
||||
itm_campaign: source,
|
||||
...extraSearchParams,
|
||||
})
|
||||
|
||||
window.open(`/user/subscription/choose-your-plan?${searchParams.toString()}`)
|
||||
window.open(
|
||||
`/user/subscription/choose-your-plan?${searchParams.toString()}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export function upgradePlan(source: string) {
|
||||
|
||||
@@ -42,14 +42,22 @@ export default function StartFreeTrialButton({
|
||||
(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
||||
event.preventDefault()
|
||||
|
||||
let shouldNavigate = true
|
||||
|
||||
if (handleClick) {
|
||||
handleClick(event)
|
||||
if (event.isPropagationStopped()) {
|
||||
return
|
||||
shouldNavigate = false
|
||||
}
|
||||
}
|
||||
|
||||
startFreeTrial(source, variant, segmentation, extraSearchParams)
|
||||
startFreeTrial(
|
||||
source,
|
||||
variant,
|
||||
segmentation,
|
||||
extraSearchParams,
|
||||
shouldNavigate
|
||||
)
|
||||
},
|
||||
[handleClick, source, variant, segmentation, extraSearchParams]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user