5 min read

How to Track Event Volume in PostHog

Event volume is your north star for data quality and user engagement. If you're not tracking how many events you're capturing, you can't tell if your analytics are working or if you've got a tracking bug. PostHog gives you multiple ways to monitor event volume—from the UI to the API.

Capture Events with PostHog SDK

Before you can track volume, you need to make sure events are actually being captured.

Initialize PostHog in your app

Add the PostHog SDK to your codebase. In a JavaScript app, install the package and initialize it with your project key and API host.

javascript
import posthog from 'posthog-js';

posthog.init('phc_your_project_key', {
  api_host: 'https://app.posthog.com',
  loaded: (ph) => {
    // PostHog is ready
  },
});

export default posthog;
Initialize PostHog with your project key from project settings

Capture events from key user actions

Use posthog.capture() to send events whenever users perform actions. Include properties that help you segment and understand the data later.

javascript
// Capture when user views a page
posthog.capture('page_viewed', {
  page_title: document.title,
  path: window.location.pathname,
});

// Capture when user clicks a button
button.addEventListener('click', () => {
  posthog.capture('button_clicked', {
    button_id: button.id,
    page: 'pricing',
  });
});

// Capture conversions
posthog.capture('signup_completed', {
  plan: 'pro',
  billing_cycle: 'annual',
});
Send events with properties for filtering and analysis
Watch out: Events captured client-side only show up if the SDK is initialized before the action happens. For critical events like signups, consider server-side tracking as a backup.

View Event Volume in PostHog

Once events are flowing in, check the Events page to see what's being captured and at what volume.

Navigate to the Events page

In PostHog, go to Data Management > Events. This shows a real-time feed of all events your project is capturing, including event name, count, and when they last occurred.

javascript
// Events appear automatically in PostHog after posthog.capture() is called
// No additional code needed—just view them in Data Management > Events
// Query recent events via console to verify they're being sent
posthog.capture('test_event', { timestamp: new Date().toISOString() });
Event data appears in PostHog automatically after capture

Create an Insight to track volume over time

Don't just look at a snapshot. Create an Insight to track event volume trends. Click Insights in the sidebar, then + New, select Trends, choose your event, and set the interval to day, week, or month. PostHog will graph event count over time.

javascript
// Query event volume via PostHog API
const projectId = 'YOUR_PROJECT_ID';
const apiKey = process.env.POSTHOG_API_KEY;

const response = await fetch(
  `https://app.posthog.com/api/projects/${projectId}/insights/`,
  {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${apiKey}`,
      'Content-Type': 'application/json',
    },
  }
);

const insights = await response.json();
console.log('Event insights:', insights.results);
Fetch insights via API to monitor event volume programmatically
Tip: If your event count drops suddenly, check the Data Management > Events page first. Often it's a SDK initialization issue, events being batched, or team filters hiding data.

Debug Event Volume Issues

Sometimes events stop flowing or the volume looks wrong. Here's how to diagnose.

Check if events are reaching PostHog

Open your browser's Network tab and filter for requests to app.posthog.com. You should see POST requests with event payloads. If you see none, the SDK isn't initialized correctly or events aren't being captured.

javascript
// Verify PostHog SDK is loaded
if (window.posthog) {
  console.log('PostHog is initialized');
  posthog.capture('health_check', { timestamp: Date.now() });
} else {
  console.error('PostHog SDK not found—check script loading');
}

// Check for errors in the SDK
console.log('PostHog config:', window.posthog?.config);
Verify SDK initialization in the browser console

Segment event volume by property filters

Go to Insights > Trends, select your event, and click Add filter. Use property filters like page, user_id, or custom properties to see which parts of your app generate volume.

javascript
// Capture events with rich properties for segmentation
posthog.capture('product_viewed', {
  product_id: 'prod_12345',
  product_category: 'analytics',
  price: 299,
  user_plan: 'free', // Essential for segmentation
  referrer_source: 'organic_search',
});

// Then in PostHog, filter insights by any of these properties
// to understand volume by segment
Include detailed properties so you can filter event volume by segment in PostHog
Tip: Check Project Settings > Data Management for event filters or sampling rules—these can reduce volume artificially. Also verify your SDK version matches PostHog's latest in case of bug fixes.

Common Pitfalls

  • Forgetting to initialize PostHog before capturing events—check the browser console for SDK load errors or failed script loading
  • Capturing too many custom events and hitting PostHog's usage limits (check your billing or plan caps)
  • Not including properties in events—raw event counts are useless without context for segmentation and debugging
  • Assuming client-side tracking is complete—cross-check with server-side logs if business-critical events go missing

Wrapping Up

Event volume is the canary in the coal mine. Now that you're tracking it in PostHog, watch for sudden drops, spikes, or missing segments—they usually mean something changed in your app or a tracking bug crept in. If you want to track event volume automatically across all your tools and correlate it with other metrics, Product Analyst can help.

Track these metrics automatically

Product Analyst connects to your stack and surfaces the insights that matter.

Try Product Analyst — Free