Unverified Commit dfd3f507 authored by Joel's avatar Joel Committed by GitHub

fix: ad block disabled tracking would block ga then can not pay (#1741)

parent d5695b31
......@@ -141,19 +141,9 @@ const PlanItem: FC<Props> = ({
setLoading(true)
try {
const res = await fetchSubscriptionUrls(plan, isYear ? 'year' : 'month')
if ((window as any).gtag) {
(window as any).gtag('event', 'click_pay_btn', {
plan,
interval: isYear ? 'year' : 'month',
event_callback: () => {
window.location.href = res.url
},
})
}
else {
// Adb Block additional tracking block the gtag, so we need to redirect directly
window.location.href = res.url
}
}
finally {
setLoading(false)
}
......
......@@ -51,15 +51,12 @@ const UpgradeBtn: FC<Props> = ({
(setShowPricingModal as any)()
}
const onClick = () => {
handleClick()
if (loc && (window as any).gtag) {
(window as any).gtag('event', 'click_upgrade_btn', {
loc,
event_callback: handleClick,
})
}
else {
handleClick()
}
}
if (isPlain)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment