PostHog and Sentry: 2 tools you need
PostHog and Sentry Are 2 Tools You Need To use
Transcript (auto, from the TikTok video): As I continue this quest to build one of the best web applications or applications in general when it comes to travelling and going around the globe, you can see people's globes, you can see people's digital passports and see how compatible you are with the people who are travelling. This journey has been great. I've learned a lot in terms of using post-hoc, which has been a great tool for tracking and being able to see people's sessions and analysing where there's bugs and how people interact with the tool. And also using sentries. Those are the two main things that I would say you should have as a part of a tool, whether it's a web application, and I'm also looking to move onto the App Store and also onto the Android Google Play Store as well. So keep an eye out for that. That's where we are on our journey. Those are the two tools I massively recommend if you are starting out building your own application because those would just save you tons of hours of work when it comes to knowing how you're using gauges with a tool and if there are any errors with it as well. Thank you.
How to build it
This page gives you the two tools to put in your app from the start: PostHog to see how people use it, and Sentry to catch its errors.
The stack
PostHog: tracks how people use your app. You can watch their sessions, see where bugs are and see how people interact with it.
Sentry: tells you when something in the app throws an error, so you find out about problems without waiting for a user to report them.
Where they apply: both suit a web application, and the same two tools are the recommendation when you plan to move onto the App Store and Google Play.
Why both: together they save hours of guessing how people use the tool and whether anything is breaking.
How to set it up
Create a free PostHog account and a new project for your app.
Add the PostHog snippet or SDK to your app, following PostHog's install guide for your framework.
Turn on session recordings in PostHog so you can watch real visits.
Create a Sentry account and a project for your app's platform.
Add the Sentry SDK to your app with the project's DSN, following Sentry's install guide.
Deploy to your host, such as Vercel, then open the app and click through it so events and a test error arrive in both dashboards.
Check PostHog sessions for where people get stuck and Sentry for new errors, and fix what you find.
Watch out: add both tools early in the build, not after launch, because their value is knowing how people use the app and where it breaks while you are still learning.
Prompt to build your own
You are helping me add usage tracking and error monitoring to my app. My app is <describe the app in one line> and it is built with <framework, for example Next.js or React Native>. I host it on <host, for example Vercel>, and I have free accounts on PostHog and Sentry.
Please do the following:
1. Add PostHog to the app using its official SDK, with session recordings switched on.
2. Add Sentry to the app using its official SDK, so unhandled errors are reported.
3. Read the keys from environment variables, never hard-code them, and show me where to set them locally and on <host>.
4. Add one deliberate test error and one custom PostHog event so I can confirm both tools receive data.
5. Tell me how to remove the test error once it works.
Constraints: use only these two tools, keep the code changes as small as possible, and do not collect personal data beyond what PostHog collects by default. Return the exact files to change with the code for each, then a short checklist for confirming data appears in both dashboards.