Amplitude
Send tracked database events to Amplitude for analytics
Configuration
To configure Amplitude as a destination for your tracked events, add the following to your pg_track_events.config.yaml
file:
Configuration Options
filter
: Event name glob filter (optional) Learn about filtering eventsapiKey
: Your Amplitude API key (required). Can be hardcoded directly in the YAML or reference an environment variable.endpoint
: (optional) Custom API endpoint URL for Amplitude. Defaults tohttps://api2.amplitude.com
.
Getting Your Amplitude API Key
To find your API key:
- Log in to your Amplitude account
- Go to Settings > Projects
- Select the project you want to use
- Copy your API Key from the project settings
User IDs (Distinct IDs)
The system automatically extracts a user ID from your event properties in the following order:
distinct_id
property- Common user ID fields (
user_id
,userid
,_user_id
) - For tables named
users
,user
, or_users
, it will look for anid
field
If no ID is found, the user ID will be null
. Note that while other APIs and pg_track_events may refer to this ID as Distinct ID, in Amplitude, this identifier is known as user_id
.
Event Format
Events sent to Amplitude include:
- User ID (from the distinct ID)
- Event type (from your configured event name)
- Timestamp (in milliseconds)
- Event properties (from your configured properties)
Note
After making configuration changes, restart the pg_track_events agent for them to take effect.