-
Notifications
You must be signed in to change notification settings - Fork 4k
Proxy analytics events #3570
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
Proxy analytics events #3570
Conversation
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
d12b786
to
03b3a8c
Compare
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
This PR implements proxying of analytics events through the middleware instead of sending them directly to the GitBook API. The middleware now handles forwarding insights events to maintain better control over analytics traffic routing.
- Adds middleware route handler for analytics events at
/~gitbook/__evt
endpoint - Updates InsightsProvider to send events through the middleware proxy instead of directly to the API
- Replaces API host parameter with base path parameter to support the new routing approach
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
packages/gitbook/src/middleware.ts | Adds analytics event forwarding handler and imports GITBOOK_API_URL |
packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx | Removes unused API URL import and updates InsightsProvider props |
packages/gitbook/src/components/Insights/visitorId.ts | Updates session endpoint path |
packages/gitbook/src/components/Insights/InsightsProvider.tsx | Refactors to use basePath instead of apiHost and updates event sending logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Middleware now handles forwarding insights events instead of going through the api directly.