feat(analytics): add Profound web traffic tracking#3835
feat(analytics): add Profound web traffic tracking#3835waleedlatif1 merged 6 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview The proxy middleware now wraps all returns with a Written by Cursor Bugbot for commit 86a85a3. Configure here. |
Greptile SummaryThis PR adds Profound analytics integration for tracking AI agent/crawler web traffic at the Next.js middleware layer. Requests are buffered in-process and flushed in batches to Profound's API every 10 seconds, gated entirely behind Key changes:
All three concerns raised in earlier review rounds (missing endpoint guard, Confidence Score: 5/5Safe to merge — all prior P1 concerns are resolved; the only remaining finding is a P2 referer-sanitization suggestion that does not block correctness All three previously flagged P1 issues (missing endpoint guard, undocumented status-200 limitation, undocumented data loss on failure) are fixed or documented. The single new finding (referer leaking stripped params) is P2 and does not affect analytics correctness or introduce a security vulnerability beyond what was already accepted for query params. apps/sim/lib/analytics/profound.ts — minor referer sanitization opportunity at line 112 Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant proxy as proxy.ts (middleware)
participant track as track()
participant profound as profound.ts
participant Timer as setInterval (10s)
participant API as Profound API
Browser->>proxy: HTTP request
proxy->>proxy: Auth/CSP/redirect logic
proxy->>track: track(request, response)
track->>profound: sendToProfound(request, statusCode)
profound->>profound: isProfoundEnabled()?
alt analytics enabled
profound->>profound: Strip SENSITIVE_PARAMS from query
profound->>profound: buffer.push(entry)
profound->>profound: ensureFlushTimer()
alt buffer.length >= MAX_BATCH_SIZE (500)
profound->>profound: flush() — async, fire-and-forget
end
end
track-->>proxy: response (unchanged)
proxy-->>Browser: response
loop Every 10 seconds
Timer->>profound: flush()
profound->>profound: entries = buffer.splice(0, 500)
profound->>API: POST /endpoint (x-api-key)
alt API success
API-->>profound: 2xx
else API failure
profound->>profound: entries dropped (intentional, no retry)
end
end
Reviews (4): Last reviewed commit: "chore(analytics): remove unnecessary que..." | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
…ith isProfoundEnabled
|
@greptile |
|
@cursor review |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Summary
isHosted— completely inert for self-hostersPROFOUND_API_KEYandPROFOUND_ENDPOINTare env varsType of Change
Testing
Tested manually
Checklist