diff --git a/pages/[...slug].tsx b/pages/[...slug].tsx index 23567df4..eaf34bdc 100644 --- a/pages/[...slug].tsx +++ b/pages/[...slug].tsx @@ -235,6 +235,7 @@ export const Home: NextPage = () => { href={CHECKOUT_URL} target="_blank" rel="noopener noreferrer" + onClick={() => analytics.track("ShopLink Clicked")} > 「购买次数」 diff --git a/pages/index.tsx b/pages/index.tsx index 2d78713b..8baa9b84 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -17,7 +17,7 @@ function Home(): React.ReactElement { setAnalytics(response); // @ts-ignore window.analytics = response; - window.analytics?.identify("'hello world' from segmentio analytics"); + window.analytics?.page(); } catch (err) { console.error(err); setAnalytics(undefined); diff --git a/pages/shop.tsx b/pages/shop.tsx index 2ffdc5ee..582f4e5a 100644 --- a/pages/shop.tsx +++ b/pages/shop.tsx @@ -1,7 +1,10 @@ +import { useAnalytics } from "~/components/context/analytics"; import SquigglyLines from "../components/SquigglyLines"; import { CHECKOUT_URL, RATE_LIMIT_COUNT } from "../utils/constants"; export default () => { + const { analytics } = useAnalytics(); + return (

@@ -11,6 +14,7 @@ export default () => { analytics.track("ShopLink Clicked")} > 点击购买