ExperimentContext object into supported Action triggers.
Supported triggers
Experiment context is available for the following Auth0 Actions:post_logintrigger.pre_user_registrationtrigger.post_user_registrationtrigger.
The event.experiment object
In supported triggers, Experiment Center adds anexperiment field to the event object:
event.experiment is null (not undefined).
config object contains the full merged configuration
Theconfig object contains every parameter defined on the feature flag, merged with the assigned variation’s overrides. You never need to look up baseline values or write fallback logic. If the parameter exists on the feature flag, it exists in config.
Null-safety pattern
Check for an active experiment before reading any properties:Example: post_login, conditional MFA policy
This example reads a boolean parameter and applies a different MFA policy depending on the variation.ec.config.require_mfa.value is true for users in the treatment variation and false (the baseline) for users in the control variation. No fallback logic needed.
Example: post_login, set a custom claim based on variation
This example stamps the experiment assignment into the user’s ID token as a custom claim. Some analytics pipelines read token claims instead of tenant logs.Example: pre_user_registration, variation-based metadata
This example uses a registration-flow experiment to setuser_metadata based on which variant the registering user lands in.
Example: post_user_registration, trigger downstream enrollment
This example fires a webhook after registration based on the variation assigned to the new user.Use is_control
The parameteris_control is true when the user is in the control group (they received the baseline, no overrides applied). Use it when you need to track which users saw the unmodified experience, or when you want to skip optional processing for control users.
config parameter values directly. They are more explicit and readable.