Constructor
Learn how to initialize experiment metadata directly.
The constructor initializes the experiment metadata.
You normally read it from the experience metadata instead, but you can construct it directly to provide fixed metadata in tests.
Signature
The constructor has the following signature:
public function __construct(string $experimentId, string $variantId)Example
Here is a basic example of how to initialize experiment metadata:
<?phpuse Croct\Plug\Content\ExperimentMetadata;
$metadata = new ExperimentMetadata( experimentId: 'banner-color-test', variantId: 'blue',);Parameters
The following list describes the supported parameters:
- experimentIdstring
The ID of the experiment running within the experience.
- variantIdstring
The ID of the variant assigned to the visitor.