silverwolf-x's picture
|
download
raw
1.77 kB

With Segment Analytics

This example shows how to use Next.js along with Segment Analytics using segmentio/analytics-next. The main app layout includes a Client Component (analytics.tsx)[(https://github.com/vercel/next.js/blob/canary/examples/with-segment-analytics/components/analytics.tsx)] which loads Segment and also exports the analytics object which can be imported and used to call the Track API on user actions (Refer to contact.tsx).

Deploy your own

Deploy with Vercel

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example with-segment-analytics with-segment-analytics-app
yarn create next-app --example with-segment-analytics with-segment-analytics-app
pnpm create next-app --example with-segment-analytics with-segment-analytics-app

Deploy it to the cloud with Vercel (Documentation).

Xet Storage Details

Size:
1.77 kB
·
Xet hash:
c573de022b5a83932edf0ca5bb6a6f4cf2180aba2fa7dba308f4c1053489bb90

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.