Python product analytics installation
- 1
Install the package
RequiredInstall the PostHog Python library using pip:
Terminal - 2
Initialize PostHog
RequiredInitialize the PostHog client with your project API key and host from your project settings:
PythonDjango integrationIf you're using Django, check out our Django integration for automatic request tracking.
- 3
Send events
Capture custom events by calling the
capturemethod with an event name and properties:PythonBy default, for backwards compatibility reasons, events are sent with person profile processing enabled. This means a person profile will be created for each user who triggers an event.
If you want to disable person profile processing for certain events, send the event with the following property:
Python