mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-03 08:51:55 -05:00
41e2d1bba7
[web] Implement plans page and interstitial payment page view events for plans redesign test GitOrigin-RevId: 023338acffe149db93b37d94cf06e8102ffcff8f
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { sendMB } from '@/infrastructure/event-tracking'
|
|
import { getSplitTestVariant } from '@/utils/splitTestUtils'
|
|
import getMeta from '@/utils/meta'
|
|
|
|
export function sendPlansViewEvent() {
|
|
document.addEventListener(
|
|
'DOMContentLoaded',
|
|
function () {
|
|
const currency = getMeta('ol-recommendedCurrency')
|
|
const countryCode = getMeta('ol-countryCode')
|
|
const geoPricingLATAMTestVariant = getSplitTestVariant(
|
|
'geo-pricing-latam-v2'
|
|
)
|
|
|
|
const websiteRedesignPlansTestVariant = getMeta(
|
|
'ol-websiteRedesignPlansVariant'
|
|
)
|
|
|
|
const device = window.matchMedia('(max-width: 767px)').matches
|
|
? 'mobile'
|
|
: 'desktop'
|
|
|
|
const plansPageViewSegmentation = {
|
|
currency,
|
|
countryCode,
|
|
device,
|
|
'geo-pricing-latam-v2': geoPricingLATAMTestVariant,
|
|
'website-redesign-plans': websiteRedesignPlansTestVariant,
|
|
}
|
|
|
|
const isPlansPage = window.location.href.includes(
|
|
'user/subscription/plans'
|
|
)
|
|
const isInterstitialPaymentPage = window.location.href.includes(
|
|
'user/subscription/choose-your-plan'
|
|
)
|
|
|
|
if (isPlansPage) {
|
|
sendMB('plans-page-view', plansPageViewSegmentation)
|
|
} else if (isInterstitialPaymentPage) {
|
|
sendMB('paywall-plans-page-view', plansPageViewSegmentation)
|
|
}
|
|
},
|
|
{ once: true }
|
|
)
|
|
}
|