Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

829 B
Raw Blame
// Learn more about plugins at: https://posthog.com/docs/plugins/build/overview
import { PluginEvent } from '~/plugin-scaffold'

import { LegacyTransformationPluginMeta } from '../../types'

// Processes each event, optionally transforming it
export function processEvent(event: PluginEvent, { config }: LegacyTransformationPluginMeta) {
    // Some events (such as $identify) don't have properties
    if (event.properties && event.properties[config.property_key]) {
        if (!config.property_values || config.property_values == '') {
            return null
        }
        const values = config.property_values.split(',')
        if (values.indexOf(event.properties[config.property_key]) > -1) {
            return null
        }
    }
    // Return the event to be ingested, or return null to discard
    return event
}