To capture product events, you can use the analytics object exported from the @repo/analytics package.Start by importing the analytics object for the relevant environment:
Copy
// For server-side codeimport { analytics } from '@repo/analytics/posthog/server';// For client-side codeimport { analytics } from '@repo/analytics/posthog/client';
Then, you can use the capture method to send events:
To automatically capture authentication and payment events, we’ve combined PostHog’s Node.js server-side library with Clerk and Stripe webhooks to wire it up as follows: