Skip to main content

Overview

This guide covers using Mixpanel’s Feature Flags through the OpenFeature standard with the Mixpanel Web 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 (Web) guide.

Prerequisites

Installation

Quick Start

Usage

Flag Types and Evaluation Methods

Evaluation Context

Context must be set globally via OpenFeature.setContext():
Per-evaluation context (the optional third argument to evaluation methods) is not supported by this provider. Context must be set globally via OpenFeature.setContext(), which triggers a re-fetch of flag values from Mixpanel.

Runtime Properties

Pass custom_properties in the evaluation context for runtime targeting:
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

React Integration

User Identity

This provider does not call mixpanel.identify(). Manage identity through Mixpanel directly:

Error Handling

To avoid PROVIDER_NOT_READY, use setProviderAndWait:

Troubleshooting

Flags Always Return Default Values

  1. Feature flags not enabled: Ensure Mixpanel was initialized with flags enabled:
  2. Provider not ready: Use setProviderAndWait to ensure initialization.
  3. Network issues: Check the browser console for failed requests.
  4. Flag not configured: Verify the flag exists and is enabled.

Flags Not Updating After Context Change

Update context and the provider will re-fetch flags: