Downsampling

Downsampling

Keeps only a percentage of events to reduce volume. Stable sampling keeps the same distinct IDs as the percentage grows; random sampling decides per event.

Configuration

OptionDescription
Percentage of events to keep
Type: number
Required: True

A number between 0 and 100. 100 keeps every event, 0 drops every event.

Use random sampling
Type: boolean
Required: False

When off, sampling is stable per distinct ID, so raising the percentage only adds events. When on, each event is decided independently.

Events to sample
Type: string
Required: False

Comma-separated event names to sample. Leave empty to sample every event.

Using our REST API you can create this transformation like so:

Terminal
# Create a new destination
curl --location 'https://us.i.posthog.com/api/environments/:project_id/hog_functions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <POSTHOG_PERSONAL_API_KEY>' \
--data '{
"type": "transformation",
"name": "Downsampling",
"inputs": {
"percentage": {
"value": ""
}
},
"enabled": true,
"template_id": "template-downsampling"
}'