We aim to be significantly cheaper than our competitors. In addition to our ridiculously cheap pricing, below are tips to reduce your product analytics costs:
Use anonymous events
PostHog captures two types of events: anonymous and identified. Under our current pricing, anonymous events can be up to 4x cheaper than identified ones (due to the cost of processing them), so it's recommended you only capture identified events when needed.
See our docs on anonymous vs identified events for more information on the differences between them and how to capture them.
Configure autocapture
Autocapture is a powerful feature that captures many events automatically. It can also capture more than you need. To reduce which events are captured, you can set an allow or ignore list.
Alternatively, you can disable autocapture completely.
Only call identify()
once per session
It's only necessary to identify a user once per session. To prevent sending unnecessary events, check posthog._isIdentified()
before calling identify()
:
if (!posthog._isIdentified()) {posthog.identify('distinct_id') // Replace 'distinct_id' with your user's unique identifier}
Only call group()
once per session
In client-side SDKs, it's only necessary to call group()
once per session. Prevent calling it multiple times to send fewer events and reduce costs.
Disable pageview or pageleave events
PostHog automatically captures pageviews and pageleaves. This is great for analytics, but it may capture more events than you need. An alternative is disabling these events and capturing them manually for the pages you need instead.
To disable automatically capturing these events, set capture_pageviews
and capture_pageleave
to false
in the configuration options when initializing PostHog:
posthog.init('<ph_project_api_key>',{api_host: 'https://us.i.posthog.com',capture_pageviews: false,capture_pageleave: false,})
To manually capture these events, call posthog.capture('$pageview')
and posthog.capture('$pageleave')
.
Note: Disabling pageview and pageleave events may prevent other PostHog features from working, like bounce rate.