feat: use gtag instead gtm (#1695)

This commit is contained in:
Joel 2023-12-05 15:05:05 +08:00 • committed by GitHub
commit 2e588ae221
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)