PersonalizationClient
The PersonalizationClient handles the connection all methods for the Personalization system and hands them over to the configured adapter.
import { PersonalizationClient } from '@archibald/personalization';
In order to use the personalization client, you need to create a new instance which takes the following options. Afterward you need to provide the instance to the PersonalizationClientProvider.
const PersonalizationClient = new PersonalizationClient({
adapter: PersonalizationAdapter,
api
});
// wrap the application in the cms data provider
<PersonalizationClientProvider client={PersonalizationClient}>
<AppRoutes />
</PersonalizationClientProvider>
PersonalizationClientOptions
| Name | Type | Description | Default | |
|---|---|---|---|---|
| adapter | PersonalizationAdapter | GrowthBookAdapter | Personalization adapter. | ||
| storage | PersonalizationStorageAdapter | LocalStorageAdapter | CookieAdapter | Storage adapter. | CookieAdapter | |
| api | CreateApi | undefined | Api Config for the adapter. | ||
| ttl | ValidExpirationTime | undefined | How long does the personalized Info stay in cache. | 30 minutes | |
| refresh | ValidExpirationTime | undefined | When is the personalized info refreshed. | 10 minutes | |
| checkOnServer | boolean | undefined | Options to connect the preview system. | true |