Skip to content

Conversation

@efahk
Copy link
Contributor

@efahk efahk commented Sep 19, 2025

Plumbs ExperimentID, isExperimentActive, and isQATester, optional properties that may be present in the /flags API response, through to the tracked $experiment_started event.

GitHub Copilot Summary

This pull request enhances feature flag support by adding optional experiment-related properties to the MixpanelFlagVariant model and ensuring these properties are correctly decoded, tracked, and tested. The changes improve the ability to track experiment metadata with feature flag usage, increasing flexibility for experimentation and analytics.

Feature flag model enhancements

  • Added optional fields experimentID, isExperimentActive, and isQATester to the MixpanelFlagVariant struct, allowing experiment metadata to be attached to flag variants.
  • Updated decoding logic in MixpanelFlagVariant to properly parse these optional fields from API responses, and extended the helper initializer to accept them.

Tracking and analytics improvements

  • Modified FeatureFlagManager to include experiment-related properties ($experiment_id, $is_experiment_active, $is_qa_tester) when tracking $experiment_started events, if available.

Testing improvements

  • Added unit tests to verify that experiment properties are correctly parsed from JSON responses, including cases with missing or partial fields.
  • Added a test to ensure that tracking events include the experiment properties when present.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for three optional experiment-related properties (experiment_id, is_experiment_active, is_qa_tester) from the /flags API response to be tracked in the $experiment_started event.

  • Extends MixpanelFlagVariant struct with three new optional properties for experiment tracking
  • Updates the tracking logic to include these properties in the $experiment_started event when present
  • Adds comprehensive tests for JSON parsing and event tracking with the new properties

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Sources/FeatureFlags.swift Adds optional experiment properties to MixpanelFlagVariant and includes them in tracking events
MixpanelDemo/MixpanelDemoTests/MixpanelFeatureFlagTests.swift Adds tests for parsing and tracking the new optional experiment properties

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@jaredmixpanel jaredmixpanel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jaredmixpanel jaredmixpanel merged commit 99223d3 into master Sep 24, 2025
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants