feat: use gtag instead gtm (#1695)

This commit is contained in:
Joel
2023-12-05 15:05:05 +08:00
committed by GitHub
parent b5dd948e56
commit 2e588ae221
12 changed files with 64 additions and 34 deletions

View File

@@ -141,8 +141,18 @@ const PlanItem: FC<Props> = ({
setLoading(true)
try {
const res = await fetchSubscriptionUrls(plan, isYear ? 'year' : 'month')
window.location.href = res.url
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 {
window.location.href = res.url
}
}
finally {
setLoading(false)