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

This commit is contained in:
Joel 2023-12-11 16:36:58 +08:00 committed by GitHub
parent d5695b3170
commit dfd3f507fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 16 deletions

View File

@ -141,18 +141,8 @@ 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: () => {
// Adb Block additional tracking block the gtag, so we need to redirect directly
window.location.href = res.url
},
})
}
else {
window.location.href = res.url
}
}
finally {
setLoading(false)

View File

@ -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)