Skip to main content
The Ruby SDK makes it easy to track events from Ruby applications.

Installation

The Ruby SDK can be installed via RubyGems.org. You may add the SDK to your Gemfile if you’re using Bundler, or install it directly:
To initialize the Ruby SDK in your application, create a new Analytics instance:

API

Identify

The identify method sends an identify event. Unlike the Browser SDK, it does not persist the user ID and traits locally, so user IDs must be explicitly added to other events. This is because server side events are usually servicing many different users at once. Example usage:
Method parameters:

Track

The track method sends a track event. Example usage:
Method parameters:

Page

The page method sends a page event. Example usage:
Method parameters:

Screen

The screen method sends a screen event. Example usage:
Method parameters:

Group

The group method sends a group event. Example usage:
Method parameters:

Flush

The Ruby SDK buffers events locally before sending them to Hightouch’s servers. This minimizes the number of requests made by the SDK and makes the tracking non-blocking. To force the local buffer to be sent to Hightouch immediately call the flush method. flush should be called when shutting down your Ruby app to make sure no events are lost. Example usage:
Last modified on September 21, 2023