integration-ruby

Configure PostHog Ruby SDK for event capture, user identification, and error tracking.

58|5|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/PostHog/skills --skill integration-ruby
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: integration-ruby
Source: https://github.com/PostHog/skills/tree/main/skills/posthog/integration/skills/ruby
Command: npx skills add https://github.com/PostHog/skills --skill integration-ruby

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

PostHog integration for Ruby provides a straightforward way to add analytics to Ruby applications using the PostHog Ruby SDK, enabling event tracking, user identification, and error capture.

Core Features & Use Cases

  • Instance-based initialization with PostHog::Client.new(api_key: ..., host: ...) to manage the client lifecycle
  • Capture events with posthog.capture to record user actions and properties
  • Identify users with posthog.identify to link events to a user profile
  • Error tracking via posthog.capture_exception for robust diagnostics
  • Guidance for typical server-side Ruby apps (CLI tools, background workers, services)

Quick Start

Configure your environment with your PostHog project token and run a minimal Ruby script to start sending events.

Frequently Asked Questions about integration-ruby

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I capture server-side analytics events in a Ruby application?

Server-side analytics in Ruby are captured using the PostHog Ruby SDK by initializing a client instance and calling posthog.capture to record user actions along with associated event properties.

Can I track user identities in Ruby background jobs and CLI tools?

User identification in Ruby background jobs and CLI tools is supported by calling posthog.identify, which links captured events to a specific user profile within your analytics platform.

How does error tracking work with the Ruby PostHog SDK?

Error tracking with the Ruby PostHog SDK works by calling posthog.capture_exception, which sends exception details and diagnostic context directly to your PostHog project for robust monitoring.

What environment variables do I need to set up PostHog in a Ruby service?

Setting up PostHog in a Ruby service requires environment variables for your project token and host, which are passed to PostHog::Client.new during instance-based initialization to manage the client lifecycle.

How do I properly shut down the PostHog client in a Ruby application?

Proper client shutdown in a Ruby application ensures that all queued analytics events are flushed before the process exits, preventing data loss when using the PostHog Ruby SDK in services or background workers.