Skip to content

Feature Flags: variant_key returns the value instead of a variant identifier #251

Description

@amitayk

remote_flags.getVariant() returns value instead of variant identifier

When using remote_flags.getVariant() from the Mixpanel Node.js SDK, the returned data is confusing and seems to lose the variant identifier.

const variant = await mixpanel.remote_flags.getVariant(
  'onboarding_cta_icon',
  null,
  { distinct_id: userId }
);

console.log(variant);

Output:

{
  "variant_key": "🚀",
  "variant_value": "🚀",
  "experiment_id": "7b21d4f1-9c3a-4a2e-9c19-2c4f1a8c91aa",
  "is_experiment_active": true
}

Problem

Both variant_key and variant_value contain the same value "🚀".

This makes it impossible to know which variant the user was assigned to, for example:

  • control
  • variant_a
  • variant_b
  • treatment

Expected behavior

  • variant_key should be a stable variant identifier (control, variant_1, etc.)
  • variant_value should contain the actual payload/value (string, boolean, JSON, etc.)

Is this the intended behavior or a bug in the SDK?

Environment

  • SDK: mixpanel (Node.js)
  • Version: 0.19.1
  • Feature type: Remote Flags / Experiments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions