An object containing:
segments: An array of strings representing the personalization segments.boost: An array of PersonalizationBoost objects representing the personalization boost.import { usePersonalization } from '@nosto/preact/hooks'
export default () => {
const { segments, boost } = usePersonalization()
return (
<div>
<h1>Personalization Segments</h1>
<ul>
{segments.map(segment => (
<li key={segment}>{segment}</li>
))}
</ul>
<h1>Personalization Boost</h1>
<ul>
{boost.map(item => (
<li key={item.id}>{item.name}</li>
))}
</ul>
</div>
)
}
Custom hook to fetch personalization data such as segments and boost.
This hook uses the
nostojslibrary to fetch search session parameters and updates the state with the fetched segments and personalization boost.