Skip to content

Add before_send hook support #144

Description

@marandaneto

Summary

Add a before_send hook that can mutate or drop assembled events before enqueue.

Why

sdk-specs marks before-send-hook as applicable to both client and server SDKs. It is the standard privacy/filtering interception point across SDKs.

Current status

No config option or hook implementation was found for mutating/dropping events after assembly and before enqueue.

Suggested scope

  • Add configuration for one or more before_send callbacks.
  • Run the hook after the event has been assembled/enriched but before it is sent to PostHog.Sender.
  • Allow callbacks to return a modified event or nil to drop.
  • Catch/log hook exceptions without crashing caller code.
  • Ensure all public event-producing helpers use the hook consistently.
  • Add tests for mutate, drop, and exception paths.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions