Skip to main content

Overview

This guide covers using Mixpanel’s Feature Flags through the OpenFeature standard with the Mixpanel Ruby OpenFeature provider. OpenFeature provides a vendor-agnostic API for feature flag evaluation, allowing you to switch between providers without changing your application code. For the native Mixpanel SDK approach, see the Feature Flags (Ruby) guide.

Prerequisites

  • Enterprise subscription plan with Feature Flags enabled
  • Ruby 3.1.0 or higher
  • Project Token from your Mixpanel Project Settings

Installation

Add to your Gemfile:
Then run:

Quick Start

Initialization

Downloads flag definitions and evaluates them locally with no per-evaluation network requests.
Targeting by Mixpanel cohorts and sticky variants are not supported in Local Evaluation mode.

Remote Evaluation

Sends each flag check to Mixpanel’s servers.

Using an Existing Tracker

Usage

Flag Types and Evaluation Methods

Evaluation Context

Unlike some providers, targetingKey is not used as a special bucketing key. It is passed as another context property. Mixpanel’s server-side configuration determines which properties are used for targeting and bucketing.

Full Resolution Details

Accessing the Mixpanel Tracker

Rails Integration

Shutdown

Error Handling

Troubleshooting

Flags Always Return Default Values

  1. Provider not ready: Flag definitions are fetched asynchronously. Allow time for the initial fetch.
  2. Invalid project token: Verify the token matches your Mixpanel project.
  3. Flag not configured: Verify the flag exists and is enabled.

Type Mismatch Errors

Verify the flag’s value type matches your evaluation method. Use fetch_object_value for JSON objects.