getAudienceId
Learn how to read the ID of the matched audience.
This method gives you the ID of the audience the visitor matched.
Signature
This method has the following signature:
public function getAudienceId(): stringThis method returns the ID of the audience the visitor matched.
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();$experience = $croct->fetchContent('home-banner', $options)->getMetadata()->getExperience();$audienceId = $experience->getAudienceId();