Ruby error tracking installation
- 1
Install the gem
RequiredAdd the PostHog Ruby gem to your Gemfile:
Gemfile - 2
Configure PostHog
RequiredInitialize the PostHog client with your API key and host:
Ruby - 3
Send events
RecommendedOnce installed, you can manually send events to test your integration:
Ruby - 4
Manually capture exceptions
RequiredUsing Ruby on Rails? The
posthog-railsgem provides automatic exception capture for controllers and background jobs. Select "Ruby on Rails" from the SDK list for setup instructions.To capture exceptions in your Ruby application, use the
capture_exceptionmethod:RubyThe
capture_exceptionmethod accepts the following parameters:Param Type Description exceptionExceptionThe exception object to capture (required) distinct_idStringThe distinct ID of the user (optional) propertiesHashAdditional properties to attach to the exception event (optional)

