Skip to content

fix(analytics): remove posthog analytics and fix md reporting - #4121

Open
manika-signoz wants to merge 5 commits into
mainfrom
fix/analytics-md
Open

fix(analytics): remove posthog analytics and fix md reporting#4121
manika-signoz wants to merge 5 commits into
mainfrom
fix/analytics-md

Conversation

@manika-signoz

@manika-signoz manika-signoz commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Pull Request


📄 Summary

Why does this change exist?
What problem does it solve, and why is this the right approach?

Fixes .md page analytics which were incorrect and most dropped and posthog removal and page-leave data logged which posthog had and now goes to existing setup.

Screenshots / Screen Recordings (if applicable)

NA, event verification manually done.

Issues closed by this PR

Closes https://github.com/SigNoz/growth-pod/issues/1254


✅ Change Type

Select all that apply

  • ✨ Feature
  • 🐛 Bug fix
  • ♻️ Refactor
  • 🛠️ Infra / Tooling
  • 🧪 Test-only

🧪 Testing Strategy

How was this change validated?

  • Tests added/updated: Added
  • Manual verification: Done on staging and checked on staging
  • Edge cases covered -
    1. md page in browser triggers Website Page View
    2. content negotiation header prefers md works as before
    3. curl fetches a .md page triggers Bot Page Request with custom_prefers_markdown: true (this was false before)
    4. curl fetches a normal HTML page triggers Bot Page Request with custom_prefers_markdown: false
    5. normal browser browsing triggers via PageViewTracker, no regression
    6. browser reads a page, scrolls, and navigates away triggers a Website Page Leave with the time on page (23.5s), scroll depth (70%), and the same session id as the page view.
    7. headless browsers trigger as Bot Page View with no page-leave tracking

⚠️ Risk & Impact Assessment

What could break? How do we recover?

  • Blast radius: website analytics
  • Potential regressions:
    • Website Page View counts will rise slightly because .md views are now counted
    • Known caveat: a .md URL that 404s still logs a page view (the middleware runs before the response status is known) so browser-UA crawler sweeping invented .md paths would inflate server-side views.
    • Website Page Leave is a new event
  • Rollback plan: revert the PR

📋 Checklist

  • Tests added or explicitly not required
  • Manually tested
  • Breaking changes documented
  • Backward compatibility considered

👀 Notes for Reviewers


@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
signoz-web Ready Ready Preview Sep 4, 2026 12:58pm UTC
signoz-web (staging) Ready Ready Preview Sep 4, 2026 12:58pm UTC

Request Review

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Claude finished @manika-signoz's task in 2m 51s —— View job


Frontend PR Review — analytics: remove PostHog + fix .md reporting

Reviewed with the signoz-website-frontend-pr-review skill against contributing/site-code.md. Scope: proxy.ts, utils/logEvent.ts, utils/userClient.ts, hooks/useLogEvent.ts, components/Analytics/PageViewTracker.tsx, deletions (PostHog + /log route), and new tests.

  • Read project conventions
  • Review analytics changes
  • Review deletions (PostHog, /log route)
  • Review new tests
  • Post inline findings + summary

Overall this is a clean, well-tested change. The PostHog removal is complete (no lingering references outside the intentional legacy-migration keys in userClient.ts), the tunnel-only send path is simpler, and coverage for the new server-side .md page view, session migration, and keepalive transport is solid.

Code findings

Medium

  • pageLocation keeps the .md suffix (proxy.ts:174, inline) — server logs /docs/introduction.md while the client tracker logs /docs/introduction, so the same page splits into two rows in pageLocation breakdowns and won't line up in funnels keyed on the canonical path. pageTypePath (already computed one line above with .md stripped) is a drop-in fix; custom_content_type still distinguishes markdown fetches. If the split is intentional, worth a note in the PR.

Low

  • transport: 'fetch' | 'beacon' is now a slight misnomer (utils/logEvent.ts:38-47) — with sendBeacon gone, 'beacon' only toggles keepalive. Not blocking; a keepalive?: boolean option would read more truthfully, but the current shape keeps the call sites unchanged and is fine to leave.

Residual risks / testing gaps (no action required)

  • 404 .md inflation — already documented in the PR: a browser-UA client sweeping invented .md paths logs a Website Page View because the middleware runs before the response status is known. Acceptable given the acknowledged blast radius; flagging so it's not a surprise in the data.
  • custom_content_type: 'text/markdown' is hardcoded but safe here — the only other markdownRewritePath branch (apiRefYamlRewrite) requires isBot === true, and this block is gated on !isBot, so it can never mislabel an OpenAPI-spec fetch.
  • I did not run yarn build / yarn lint (review-only); the added Vitest/node tests cover the changed logic well, but a CI build confirmation before merge is worth it given the DO NOT MERGE label.

Nothing here is blocking correctness — the pageLocation item is the one worth a decision before merge.
· fix/analytics-md

Comment thread proxy.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant