Skip to main content

Overview

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

Prerequisites

  • Enterprise subscription plan with Feature Flags enabled
  • Node.js 10 or higher
  • Project Token from your Mixpanel Project Settings

Installation

Quick Start

Initialization

Targeting by Mixpanel cohorts and sticky variants are not supported in Local Evaluation mode.

Remote Evaluation

Using an Existing Mixpanel Instance

Usage

Flag Types and Evaluation Methods

Mixpanel Flag TypeVariant ValuesOpenFeature Method
Feature Gatetrue / falsegetBooleanValue()
Experimentboolean, string, number, or JSON objectgetBooleanValue(), getStringValue(), getNumberValue(), or getObjectValue()
Dynamic ConfigJSON objectgetObjectValue()

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 Underlying Mixpanel Instance

Shutdown

Error Handling

Error CodeWhen
PROVIDER_NOT_READYFlags evaluated before the local provider has finished loading definitions
FLAG_NOT_FOUNDThe requested flag does not exist in Mixpanel
TYPE_MISMATCHThe flag value type does not match the requested type

Troubleshooting

Flags Always Return Default Values

  1. Provider not ready: Use setProviderAndWait() to ensure flags are ready before evaluation.
  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 getObjectValue() for JSON objects.