Filter Bot Events

Filter Bot Events

Filters out events from known bot user agents. This transformation will drop the event if a bot is detected.

Configuration

OptionDescription
User Agent Property
Type: string
Required: True

The property that contains the user agent string (e.g. $raw_user_agent, $useragent)

Custom Bot Patterns
Type: string
Required: False

Additional bot patterns to detect, separated by commas (e.g. mybot,customcrawler)

Custom IP Prefixes
Type: string
Required: False

Additional IPv4 or IPv6 prefixes in CIDR notation to block, separated by commas (e.g. 198.51.100.14/24,2001:db8::/48)

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": "Filter Bot Events",
"inputs": {
"userAgent": {
"value": ""
}
},
"enabled": true,
"template_id": "template-bot-detection"
}'