File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " gitbook " : patch
3+ ---
4+
5+ Fix missing geo data in site insights because of incorrect proxying of events.
Original file line number Diff line number Diff line change 11import type { headers as nextHeaders } from 'next/headers' ;
2- import { GITBOOK_API_URL , GITBOOK_DISABLE_TRACKING } from './env' ;
2+ import { GITBOOK_API_PUBLIC_URL , GITBOOK_DISABLE_TRACKING } from './env' ;
33
44/**
55 * Return true if events should be tracked on the site.
@@ -36,7 +36,9 @@ export async function serveProxyAnalyticsEvent(req: Request) {
3636 headers : { 'content-type' : 'text/plain' } ,
3737 } ) ;
3838 }
39- const url = new URL ( `${ GITBOOK_API_URL } /v1/orgs/${ org } /sites/${ site } /insights/events` ) ;
39+
40+ // We make the request to the public API URL to ensure the request is properly enriched by the router..
41+ const url = new URL ( `${ GITBOOK_API_PUBLIC_URL } /v1/orgs/${ org } /sites/${ site } /insights/events` ) ;
4042 return await fetch ( url . toString ( ) , {
4143 method : 'POST' ,
4244 headers : {
You can’t perform that action at this time.
0 commit comments