PostHog Basics
Why analytics matters and the kinds of data PostHog tracks

Pixl presents
You think people love your app. Do they, though? PostHog shows what they actually click, and what they ignore.You think people love your app. Do they, though? PostHog shows what they actually click, and what they ignore.

You built an app. People are signing up. But are they actually USING it? Which features do they love? Where do they get stuck? Analytics is how you find out.
Why Analytics Matters#
Like the What Is Analytics? lesson said, analytics swaps guessing for knowing. This chapter shows how PostHog pulls that off.
What Is PostHog?#

PostHog is an analytics platform for developers. It tracks what people do in your app and helps you make sense of their behavior.
Here's what makes PostHog stand out.
- Open source. You can see exactly what it does
- Privacy-friendly. It can be self-hosted, so the data stays in your control
- Developer-focused. Built for engineers rather than marketers
- Feature-rich. Analytics, session recordings, feature flags, and more
Types of Analytics#
PostHog helps you understand your users a few different ways.
Event Tracking#
An "event" is something a user does. Clicking a button, viewing a page, finishing a purchase. You decide which events you want to track.
// Track when someone clicks "Start Trial"
posthog.capture('start_trial_clicked', {
plan: 'pro',
source: 'pricing_page'
})Now you can see things like this.
- How many people click "Start Trial"
- Which plans are the most popular
- Which pages lead to the most trials
Page Views#
Track which pages people visit and how long they hang around. Good news, PostHog's JavaScript library captures page views (and page leaves) automatically once it's set up, even in single-page apps. If you ever need to send one by hand, it looks like this.
// Manual page view (usually not needed, it's automatic)
posthog.capture('$pageview')When I shared my free A2P checker in two Facebook groups, it pulled 744 page views in 5 days. Page view numbers are how you'd even know something like that happened. They help you figure out a few things.
- Which pages are the most popular
- Where people land on your site
- Which pages have high "bounce rates" (people leaving right away)
User Identification#
Connect anonymous visitors to known users once they log in.
// When user logs in
posthog.identify(user.id, {
email: user.email,
name: user.name,
plan: user.plan
})Now you can follow someone's whole journey, from their very first visit all the way to becoming a paying customer.
This lesson ends with a short activity.
