File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,15 +93,18 @@ function cleanReferrer(referrer: string): string {
9393 */
9494export async function trackClickEvent ( event : H3Event , link : Link ) : Promise < void > {
9595 try {
96- const ip = anonymizeIP ( getClientIP ( event ) ) ;
96+ const rawIp = getClientIP ( event ) ;
9797 const userAgent = getHeader ( event , "user-agent" ) ?? "" ;
9898 const referrer = cleanReferrer ( getHeader ( event , "referer" ) ?? "" ) ;
9999
100100 // Parse User-Agent
101101 const ua = UAParser ( userAgent ) ;
102102
103- // Query GeoIP
104- const geo : GeoLocation | null = await geoip . lookup ( ip ) ;
103+ // Query GeoIP with original IP for accuracy
104+ const geo : GeoLocation | null = await geoip . lookup ( rawIp ) ;
105+
106+ // Anonymize IP for storage (privacy)
107+ const ip = anonymizeIP ( rawIp ) ;
105108
106109 // Extract query parameters
107110 const queryParams : Record < string , string > = { } ;
You can’t perform that action at this time.
0 commit comments