Integration of PostHog API for Godot 4.X Made on top of @WolfgangSenff's PostHogPlugin
Put posthog/
folder inside res://addons/
Once the plugin is added, your project will get a new global setting, Posthog API Key
Set it to your API Key and then you'll be able to send your events as follows:
var _ev := PostHogEvent.new()
_ev.event_name = "Your event name"
_ev.distinct_id = "an unique identifier"
_ev.properties = { "some_key": "a value", "another_key": "value" }
PostHog.send_event(_ev)
A timestamp
is optional, will be set to the server one if none is sent.
An example of a custom event send to their analytics dashboard: