Skip to content

feat: add customFields property to Experiment#125

Open
vazarkevych wants to merge 1 commit into
growthbook:mainfrom
vazarkevych:feat/experiment-custom-fields
Open

feat: add customFields property to Experiment#125
vazarkevych wants to merge 1 commit into
growthbook:mainfrom
vazarkevych:feat/experiment-custom-fields

Conversation

@vazarkevych

Copy link
Copy Markdown
Collaborator

Summary

Adds support for Custom Fields in Experiments, allowing developers to access
custom metadata defined in the GrowthBook UI through the Python SDK.

What Changed

  • Added customFields property to the Experiment class (defaults to {})
  • Parsed customFields from the API response during Experiment construction
  • Serialized customFields in to_dict() when non-empty
  • Added unit tests covering all scenarios

Why

GrowthBook UI allows defining Custom Fields for experiments (e.g. team
ownership, ticket links, metric type). The API returns these under a flat
customFields object, but the Python SDK previously dropped the field during
parsing, making it inaccessible to developers even when the API returned it.

Test plan

  • test_custom_fields_parsed_from_api_dict — parses string and numeric values from the API dict
  • test_custom_fields_default_when_absent — defaults to {} and is omitted from to_dict() when empty
  • test_custom_fields_public_init — works via the public constructor

All 545 tests in tests/test_growthbook.py pass.

@vazarkevych vazarkevych requested a review from madhuchavva June 25, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant