diff --git a/web/app/(commonLayout)/apps/NewAppDialog.tsx b/web/app/(commonLayout)/apps/NewAppDialog.tsx index 3215e92ead..912bcd98dd 100644 --- a/web/app/(commonLayout)/apps/NewAppDialog.tsx +++ b/web/app/(commonLayout)/apps/NewAppDialog.tsx @@ -212,7 +212,7 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => { )} - {isAppsFull && } + {isAppsFull && } } diff --git a/web/app/components/base/ga/index.tsx b/web/app/components/base/ga/index.tsx index 379e98c538..1f894c457d 100644 --- a/web/app/components/base/ga/index.tsx +++ b/web/app/components/base/ga/index.tsx @@ -1,5 +1,7 @@ -import React, { FC } from 'react' +import type { FC } from 'react' +import React from 'react' import Script from 'next/script' +import { IS_CE_EDITION } from '@/config' export enum GaType { admin = 'admin', @@ -11,27 +13,34 @@ const gaIdMaps = { [GaType.webapp]: 'G-2MFWXK7WYT', } -export interface IGAProps { +export type IGAProps = { gaType: GaType } - const GA: FC = ({ - gaType + gaType, }) => { + if (IS_CE_EDITION) + return null + return ( - + + + + ) } export default React.memo(GA) diff --git a/web/app/components/billing/apps-full-in-dialog/index.tsx b/web/app/components/billing/apps-full-in-dialog/index.tsx index 361a0ed6c7..dfbb3e56bb 100644 --- a/web/app/components/billing/apps-full-in-dialog/index.tsx +++ b/web/app/components/billing/apps-full-in-dialog/index.tsx @@ -8,7 +8,9 @@ import AppsInfo from '../usage-info/apps-info' import s from './style.module.css' import GridMask from '@/app/components/base/grid-mask' -const AppsFull: FC = () => { +const AppsFull: FC<{ loc: string }> = ({ + loc, +}) => { const { t } = useTranslation() return ( @@ -20,7 +22,7 @@ const AppsFull: FC = () => {
{t('billing.apps.fullTipLine2')}
- +
diff --git a/web/app/components/billing/apps-full/index.tsx b/web/app/components/billing/apps-full/index.tsx index ea73fd5c13..f37ba9af7f 100644 --- a/web/app/components/billing/apps-full/index.tsx +++ b/web/app/components/billing/apps-full/index.tsx @@ -18,7 +18,7 @@ const AppsFull: FC = () => {
{t('billing.apps.fullTipLine2')}
- +
diff --git a/web/app/components/billing/billing-page/index.tsx b/web/app/components/billing/billing-page/index.tsx index 62b2a4880f..880800274f 100644 --- a/web/app/components/billing/billing-page/index.tsx +++ b/web/app/components/billing/billing-page/index.tsx @@ -26,7 +26,7 @@ const Billing: FC = () => { return (
- + {enableBilling && isCurrentWorkspaceManager && billingUrl && (
diff --git a/web/app/components/billing/plan/index.tsx b/web/app/components/billing/plan/index.tsx index 9c4fb2609a..6228c4a3e1 100644 --- a/web/app/components/billing/plan/index.tsx +++ b/web/app/components/billing/plan/index.tsx @@ -29,7 +29,7 @@ const typeStyle = { } type Props = { - loc?: string + loc: string } const PlanComp: FC = ({ @@ -69,7 +69,7 @@ const PlanComp: FC = ({ )}
@@ -84,7 +84,7 @@ const PlanComp: FC = ({ isFull size='lg' isPlain={type !== Plan.sandbox} - gaEventName='click_header_upgrade_btn' + loc={loc} /> )}
diff --git a/web/app/components/billing/pricing/plan-item.tsx b/web/app/components/billing/pricing/plan-item.tsx index f0fc5fb503..7778879b02 100644 --- a/web/app/components/billing/pricing/plan-item.tsx +++ b/web/app/components/billing/pricing/plan-item.tsx @@ -141,8 +141,18 @@ const PlanItem: FC = ({ 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) diff --git a/web/app/components/billing/upgrade-btn/index.tsx b/web/app/components/billing/upgrade-btn/index.tsx index 5fa435d2b0..cc382eb9b9 100644 --- a/web/app/components/billing/upgrade-btn/index.tsx +++ b/web/app/components/billing/upgrade-btn/index.tsx @@ -15,7 +15,7 @@ type Props = { isPlain?: boolean isShort?: boolean onClick?: () => void - gaEventName?: string + loc?: string } const PlainBtn = ({ className, onClick }: { className?: string; onClick: () => void }) => { @@ -40,18 +40,27 @@ const UpgradeBtn: FC = ({ isShort = false, size = 'md', onClick: _onClick, - gaEventName, + loc, }) => { const { t } = useTranslation() const { setShowPricingModal } = useModalContext() - const onClick = () => { - if (gaEventName) - (window as any).dataLayer.push({ event: gaEventName }) + const handleClick = () => { if (_onClick) _onClick() else (setShowPricingModal as any)() } + const onClick = () => { + if (loc && (window as any).gtag) { + (window as any).gtag('event', 'click_upgrade_btn', { + loc, + event_callback: handleClick, + }) + } + else { + handleClick() + } + } if (isPlain) return diff --git a/web/app/components/billing/vector-space-full/index.tsx b/web/app/components/billing/vector-space-full/index.tsx index 91bf08a68d..1ba564ec1c 100644 --- a/web/app/components/billing/vector-space-full/index.tsx +++ b/web/app/components/billing/vector-space-full/index.tsx @@ -22,7 +22,7 @@ const VectorSpaceFull: FC = () => {
{t('billing.vectorSpace.fullTip')}
{t('billing.vectorSpace.fullSolution')}
- + diff --git a/web/app/components/datasets/create/embedding-process/index.tsx b/web/app/components/datasets/create/embedding-process/index.tsx index 18208c828b..e985698d32 100644 --- a/web/app/components/datasets/create/embedding-process/index.tsx +++ b/web/app/components/datasets/create/embedding-process/index.tsx @@ -206,7 +206,7 @@ const EmbeddingProcess: FC = ({ datasetId, batchId, documents = [], index
{t('billing.plansCommon.documentProcessingPriorityUpgrade')}
- + ) } diff --git a/web/app/components/explore/create-app-modal/index.tsx b/web/app/components/explore/create-app-modal/index.tsx index bb23c1ab81..9a3ca3aae7 100644 --- a/web/app/components/explore/create-app-modal/index.tsx +++ b/web/app/components/explore/create-app-modal/index.tsx @@ -68,7 +68,7 @@ const CreateAppModal = ({ className='h-10 px-3 text-sm font-normal bg-gray-100 rounded-lg grow' /> - {isAppsFull && } + {isAppsFull && }
diff --git a/web/app/components/header/account-setting/members-page/index.tsx b/web/app/components/header/account-setting/members-page/index.tsx index 9c87fdb432..ee31edd2cf 100644 --- a/web/app/components/header/account-setting/members-page/index.tsx +++ b/web/app/components/header/account-setting/members-page/index.tsx @@ -71,7 +71,7 @@ const MembersPage = () => {
{isMemberFull && ( - + )}