I recently had to turn off posthog on my app, it was collecting so much information that wasn't needed that it was making my app unusably slow. I'm sure i'm missing some knob, but the fact that after an hour long claude code session i couldn't figure out how to fix it means posthog has gotten too fiddly.
If you are on react/next.js, defer the client side initialization until after your app has painted. PostHog (especially with their session recording feature) likes to initialize a little before the rest of your app loads through either their context provider or instrumentation.ts (if you are on next.js). It's generally insignificant except if you are building a B2C web app where the extra 100ms makes a difference in retention.
On the server side, queue all analytics call and run them after the main request completes (on next.js it would be within an after() function on the server side).
You can paste this comment into Claude and it should handle the refactor just fine.
Note with the changes in analytics scheduling, you will lose out on real time analytics in favor of better time to first load. So keep the trade-off in mind.