-
Notifications
You must be signed in to change notification settings - Fork 0
DBP-84: 導入 PostHog 進行網站統計 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "pan93412/dbp-84-\u5C0E\u5165-posthog-\u9032\u884C\u7DB2\u7AD9\u7D71\u8A08"
Conversation
pan93412
commented
Oct 6, 2025
- feat: add PostHog client
- feat: add PostHog analyze
- feat(chat): instrument LLM usage
- feat(chat): make system prompt cachable
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Integrates PostHog analytics platform for website statistics and user behavior tracking, including instrumentation of LLM chat usage and implementation of prompt caching optimization.
- Added PostHog client configuration for both browser and server environments
- Implemented user identification and session management for analytics tracking
- Instrumented chat API to track LLM usage with user attribution and introduced prompt caching
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
package.json | Added PostHog dependencies (@posthog/ai, posthog-js, posthog-node) |
next.config.ts | Configured PostHog proxy rewrites and trailing slash handling |
instrumentation-client.ts | Initialized PostHog client with API configuration |
lib/posthog.rsc.ts | Created server-side PostHog client factory |
providers/posthog-identifier.tsx | Component for user identification in PostHog |
app/login/_components/posthog-resetter.tsx | Component to reset PostHog session on login page |
app/login/page.tsx | Integrated PostHog session reset |
app/(app)/layout.tsx | Added PostHog identifier to authenticated app layout |
lib/auth.rsc.ts | Refactored auth function to return user info instead of boolean |
app/api/chat/route.ts | Added LLM usage tracking and prompt caching with GraphQL fragment refactoring |
gql/ files | Auto-generated GraphQL code updates from fragment changes |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.