Add experiment properties to feature flag exposure tracking #875
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 adds support for optional experiment tracking parameters to feature flag variants in the Mixpanel Android SDK. The changes ensure that experiment-related fields (
experiment_id,is_experiment_active, andis_qa_tester) are parsed from API responses, stored in theMixpanelFlagVariantclass, and included in tracking event properties. A new test verifies that these fields are correctly handled end-to-end.Feature flag experiment tracking enhancements:
experimentID,isExperimentActive,isQATester) to theMixpanelFlagVariantclass, updated constructors to initialize them, and documented their purpose. [1] [2] [3] [4] [5]MPConstants.Flagsfor the new experiment tracking fields.Parsing and serialization improvements:
JsonUtils.parseFlagsResponseto extract the new experiment tracking fields from the API response and pass them to theMixpanelFlagVariantconstructor.createFlagsResponseJsonto include the optional experiment parameters when present.Tracking event property updates:
_performTrackingDelegateCallinFeatureFlagManagerto include the new experiment parameters in tracking event properties if available.Testing:
FeatureFlagManagerTestto verify that all optional experiment parameters are included in tracking event properties when present.