Event volume directly affects your PostHog bill and tells you how active your users are. If you're unsure whether you're tracking too many events or need to understand your ingestion rate, you need a quick way to see total events over a period.
Calculate Event Volume Through the PostHog UI
The simplest approach is to use PostHog's built-in insights and events tools.
Open the Events table in PostHog
Navigate to Data Management > Events or go directly to Insights. You'll see a table listing all events from your project with timestamps and event names.
// No code needed for UI — just navigate to Data Management > Events
// Filter by date range to see volume over timeUse the Events Insight to aggregate volume by time
Create a new Insight and select Events as the chart type. Choose the event you want to measure (or leave it blank for all events), then group by Time (daily, hourly, weekly). This shows your ingestion rate visually.
// PostHog Insight query (conceptual)
// Chart type: Events
// Series: All events (or specific event name)
// Group by: Day / Hour / Week
// Filter by date range as neededAdd filters to narrow volume calculation
Use the Filters panel to exclude internal traffic, test events, or specific event names. For example, filter by event != '$pageview' to exclude pageview clutter, or by team to isolate production events.
// Filter example in PostHog Insights
// event != '$pageview'
// properties.environment = 'production'
// timestamp >= 2024-01-01Query Event Volume Programmatically via API
For automated monitoring or integration into your dashboards, use PostHog's API to fetch event counts.
Authenticate and set up your API request
You'll need your PostHog API Key (find it in Project Settings > API Keys). Use it to authenticate HTTP requests to the PostHog API.
const posthogApiKey = process.env.POSTHOG_API_KEY;
const projectId = 'your-project-id';
const posthogUrl = 'https://us.posthog.com';
const headers = {
'Authorization': `Bearer ${posthogApiKey}`,
'Content-Type': 'application/json'
};Query the /events endpoint for volume data
Call the Events API endpoint to retrieve a count of events within a date range. You can filter by event name, properties, and timestamp.
const fetch = require('node-fetch');
const getEventVolume = async (startDate, endDate) => {
const params = new URLSearchParams({
'select': 'count()',
'where': `timestamp >= '${startDate}' AND timestamp <= '${endDate}'`
});
const url = `${posthogUrl}/api/projects/${projectId}/events/?${params}`;
const response = await fetch(url, { headers });
const data = await response.json();
return data.count;
};
getEventVolume('2024-01-01', '2024-01-31').then(count => {
console.log(`Total events: ${count}`);
});Break down volume by event type
Instead of total volume, group by event to see which event types are driving your ingestion. This helps identify which features or tracking calls consume the most volume.
const getEventVolumeByType = async (startDate, endDate) => {
const params = new URLSearchParams({
'select': 'event, count() as volume',
'where': `timestamp >= '${startDate}' AND timestamp <= '${endDate}'`,
'group_by': 'event'
});
const url = `${posthogUrl}/api/projects/${projectId}/events/?${params}`;
const response = await fetch(url, { headers });
const data = await response.json();
return data;
};
getEventVolumeByType('2024-01-01', '2024-01-31').then(events => {
events.forEach(e => console.log(`${e.event}: ${e.volume}`));
});limit parameter to paginate results.Monitor Event Volume Over Time
Set up continuous monitoring to track ingestion trends and catch unexpected spikes.
Create a recurring check for volume anomalies
Use the API to compare current period volume against a baseline (e.g., previous week or month). If the current week's volume is significantly higher, alert yourself or your team.
const compareEventVolume = async () => {
const now = new Date();
const currentWeekStart = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
const previousWeekStart = new Date(now.getTime() - 14 * 24 * 60 * 60 * 1000);
const previousWeekEnd = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
const currentVolume = await getEventVolume(
currentWeekStart.toISOString().split('T')[0],
now.toISOString().split('T')[0]
);
const previousVolume = await getEventVolume(
previousWeekStart.toISOString().split('T')[0],
previousWeekEnd.toISOString().split('T')[0]
);
const percentChange = ((currentVolume - previousVolume) / previousVolume) * 100;
if (percentChange > 20) {
console.warn(`⚠️ Event volume up ${percentChange}% week-over-week`);
}
};
compareEventVolume();Export results to a monitoring tool
Send volume metrics to your favorite monitoring tool (e.g., Datadog, Grafana, or a Google Sheet). Run this check hourly or daily to track trends.
const sendVolumeMetric = async (metric, value) => {
const datadogUrl = 'https://api.datadoghq.com/api/v1/series';
const datadogApiKey = process.env.DATADOG_API_KEY;
const payload = {
series: [{
metric: `posthog.event_volume.${metric}`,
points: [[Math.floor(Date.now() / 1000), value]],
tags: ['service:product-analyst']
}]
};
await fetch(datadogUrl, {
method: 'POST',
headers: { 'DD-API-KEY': datadogApiKey },
body: JSON.stringify(payload)
});
};
await sendVolumeMetric('total', currentVolume);Common Pitfalls
- Forgetting to filter out internal traffic (team members, staging environments). This inflates your volume and skews cost calculations.
- Counting all events including PostHog's reserved events (
$pageview,$identify, etc.). If you only care about custom events, exclude these explicitly. - Querying too broad a date range via the API without pagination. Large ranges can timeout; break into smaller chunks and sum the results.
- Assuming event volume is constant day-to-day. Plan for peak hours and seasonal spikes when estimating PostHog usage.
Wrapping Up
You now have two paths to calculate event volume: the PostHog UI for quick checks, and the API for automation and monitoring. Event volume is critical for billing forecasting, debugging production issues, and understanding user activity. If you want to track event volume automatically across PostHog and other analytics tools, Product Analyst can help.