getExperience
Learn how to read the experience that served the content.
This method gives you the experience the visitor was assigned to.
Signature
This method has the following signature:
public function getExperience(): ?ExperienceMetadataThis method returns the experience the visitor was assigned to, or null when none was assigned.
Example
Here is a basic example of how to use this method:
<?phpuse Croct\Plug\Croct;use Croct\Plug\FetchOptions;
$croct = Croct::fromDotenv();$options = FetchOptions::defaults()->withSchema();$metadata = $croct->fetchContent('home-banner', $options)->getMetadata();$experience = $metadata->getExperience();