Skip to main content

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

NameTypeDescriptionDefault
adapterPersonalizationAdapter | GrowthBookAdapterPersonalization adapter.
storagePersonalizationStorageAdapter | LocalStorageAdapter | CookieAdapterStorage adapter.CookieAdapter
apiCreateApi | undefinedApi Config for the adapter.
ttlValidExpirationTime | undefinedHow long does the personalized Info stay in cache.30 minutes
refreshValidExpirationTime | undefinedWhen is the personalized info refreshed.10 minutes
checkOnServerboolean | undefinedOptions to connect the preview system.true