Create a new stateful personalization instance.
Options to configure the personalization product for stateful environments.
Protected Optional ReadonlyallowedAllow‑list of event type keys permitted when consent is not present.
Protected ReadonlyapiOptimization API client used to send events to the Experience and Insights APIs.
Protected ReadonlybuilderEvent builder used to construct strongly‑typed events.
ReadonlyduplicationDeduplication helper used to track previously seen values within optional scopes
ReadonlyflagsStatic resolver for evaluating personalized custom flags.
Build a flattened map of flag keys to values from a change list.
Optionalchanges: {The change list returned by the optimization service.
Key identifying the subject of the change.
Metadata describing the originating experience and variant index.
Identifier of the personalization or experiment experience.
Index of the variant within the experience configuration.
Discriminator for a variable change.
New value for the variable identified by ChangeBase.key.
A map of flag keys to their resolved values.
InternalgetFunction that provides an anonymous ID when available.
ReadonlyinterceptorsInterceptors that can mutate/augment outgoing events or optimization state.
ReadonlymergeStatic resolver that returns values sourced from a user profile based on a Contentful Merge Tag entry.
Look up a merge-tag value from a profile using normalized selectors.
Merge-tag identifier.
Optionalprofile: {Profile from which to resolve the value.
List of audience identifiers that this profile currently belongs to.
Primary identifier of the profile.
Geo-location information associated with the profile.
Optionalcity?: stringCity name associated with the location.
Optionalcontinent?: stringContinent name associated with the location.
Optionalcoordinates?: { latitude: number; longitude: number }Geographical coordinates for the location.
Latitude component of the coordinates.
Longitude component of the coordinates.
Optionalcountry?: stringCountry name associated with the location.
OptionalcountryCode?: stringCountry code associated with the location.
OptionalpostalCode?: stringPostal or ZIP code associated with the location.
Optionalregion?: stringRegion or state name associated with the location.
OptionalregionCode?: stringRegion or state code associated with the location.
Optionaltimezone?: stringTime zone identifier associated with the location.
Random value associated with the profile.
Aggregated session statistics for the profile.
Duration of the active session.
Average session duration across all sessions represented by this record.
The unit should match SessionStatistics.activeSessionLength.
Number of sessions associated with this profile or identifier.
Often used in combination with SessionStatistics.averageSessionLength.
Unique identifier for this session statistics record.
Indicates whether the visitor has been seen before.
Landing page for the session.
Path component of the page URL (e.g., /products/123).
Parsed query parameters for the page.
Referrer URL that led to the current page.
Raw search string including the leading ? (e.g., "?q=test").
Optionaltitle?: stringTitle of the page as seen by the user.
Full URL of the page.
Stable, long-lived identifier of the profile.
Traits describing the profile (user-level attributes).
A stringified primitive if found; otherwise undefined.
Type guard to ensure the input is a MergeTagEntry.
Unknown value to validate.
true if the input is a valid merge-tag entry.
Generate a list of candidate selectors for a merge-tag ID.
Merge-tag identifier (segments separated by _).
Array of dot-path selectors to try against a profile.
Resolve the display value for a merge-tag entry using the provided profile,
falling back to the entry's configured nt_fallback when necessary.
The merge-tag entry to resolve.
Optionalnt_fallback?: stringFallback value to use when the merge tag cannot be resolved.
Internal identifier of the merge tag.
Human-readable name of the merge tag.
Contentful metadata, including tags.
System fields extended to constrain the content type to nt_mergetag.
Optionalprofile: {Optional profile used for lookup.
List of audience identifiers that this profile currently belongs to.
Primary identifier of the profile.
Geo-location information associated with the profile.
Optionalcity?: stringCity name associated with the location.
Optionalcontinent?: stringContinent name associated with the location.
Optionalcoordinates?: { latitude: number; longitude: number }Geographical coordinates for the location.
Latitude component of the coordinates.
Longitude component of the coordinates.
Optionalcountry?: stringCountry name associated with the location.
OptionalcountryCode?: stringCountry code associated with the location.
OptionalpostalCode?: stringPostal or ZIP code associated with the location.
Optionalregion?: stringRegion or state name associated with the location.
OptionalregionCode?: stringRegion or state code associated with the location.
Optionaltimezone?: stringTime zone identifier associated with the location.
Random value associated with the profile.
Aggregated session statistics for the profile.
Duration of the active session.
Average session duration across all sessions represented by this record.
The unit should match SessionStatistics.activeSessionLength.
Number of sessions associated with this profile or identifier.
Often used in combination with SessionStatistics.averageSessionLength.
Unique identifier for this session statistics record.
Indicates whether the visitor has been seen before.
Landing page for the session.
Path component of the page URL (e.g., /products/123).
Parsed query parameters for the page.
Referrer URL that led to the current page.
Raw search string including the leading ? (e.g., "?q=test").
Optionaltitle?: stringTitle of the page as seen by the user.
Full URL of the page.
Stable, long-lived identifier of the profile.
Traits describing the profile (user-level attributes).
The resolved string, or undefined if the entry is invalid and no
fallback is available.
ReadonlypersonalizedStatic resolver for personalized Contentful entries (e.g., entry variants targeted to a profile audience).
Find the personalization entry corresponding to one of the selected experiences.
Object containing the baseline personalized entry and the selections.
When true, skip type/shape validation for perf.
The matching PersonalizationEntry, or undefined if not found/invalid.
Optionalnt_audience?: The audience of the personalization (Audience).
The configuration of a PersonalizationEntry (JSON).
Accepts null or an explicit PersonalizationConfig and converts
falsy/undefined values into a default configuration.
Optionalnt_description?: null | stringThe description of the personalization (Short Text).
The personalization/experience ID related to this personalization entry.
The name of the personalization (Short Text).
The type of the personalization (nt_experiment | nt_personalization).
Optionalnt_variants?: Entry[]All used variants of the personalization (Contentful references to other Content Types).
Contentful metadata, including tags.
System-managed properties describing the entry.
Look up the selection metadata for a specific personalization entry.
Object with the target personalization entry and selections.
When true, skip type checks.
The matching SelectedPersonalization, if present.
Identifier of the personalization or experiment experience.
Optionalsticky?: booleanIndicates whether this personalization selection is sticky for the user.
Index of the selected variant within the experience configuration.
Typically corresponds to the index of the selected PersonalizationConfig entry.
Mapping of baseline entry IDs to their selected variant entry IDs.
Get the replacement variant config for the given selection index.
Baseline entry, personalization entry, and 1‑based variant index.
When true, skip type checks.
The EntryReplacementVariant for the component, if any.
Indicates whether this variant is hidden from allocation/traffic.
Unique identifier for the variant.
Resolve the concrete Contentful entry that corresponds to a selected variant.
Entry skeleton type.
Chain modifiers.
Locale code.
Personalization entry and selected variant.
When true, skip type checks.
The resolved entry typed as Entry or undefined.
Resolve the selected entry (baseline or variant) for a personalized entry and optional selected personalizations, returning both the entry and the personalization metadata.
Entry skeleton type.
Chain modifiers.
Locale code.
The baseline personalized entry.
OptionalselectedPersonalizations: {Optional selections for the current profile.
Identifier of the personalization or experiment experience.
Optionalsticky?: booleanIndicates whether this personalization selection is sticky for the user.
Index of the selected variant within the experience configuration.
Typically corresponds to the index of the selected PersonalizationConfig entry.
Mapping of baseline entry IDs to their selected variant entry IDs.
An object containing the resolved entry and (if chosen) the selection.
ReadonlystatesExposed observable state references.
Flush the offline queue
Get the specified Custom Flag's value (derived from the signal).
The name or key of the Custom Flag.
Key identifying the subject of the change.
Metadata describing the originating experience and variant index.
Identifier of the personalization or experiment experience.
Index of the variant within the experience configuration.
Discriminator for a variable change.
New value for the variable identified by ChangeBase.key.
The current value of the Custom Flag if found.
Resolve a merge tag to a value based on the current (or provided) profile.
The merge‑tag entry node to resolve.
Optionalnt_fallback?: stringFallback value to use when the merge tag cannot be resolved.
Internal identifier of the merge tag.
Human-readable name of the merge tag.
Contentful metadata, including tags.
System fields extended to constrain the content type to nt_mergetag.
Optional profile; defaults to the current signal value.
List of audience identifiers that this profile currently belongs to.
Primary identifier of the profile.
Geo-location information associated with the profile.
Optionalcity?: stringCity name associated with the location.
Optionalcontinent?: stringContinent name associated with the location.
Optionalcoordinates?: { latitude: number; longitude: number }Geographical coordinates for the location.
Latitude component of the coordinates.
Longitude component of the coordinates.
Optionalcountry?: stringCountry name associated with the location.
OptionalcountryCode?: stringCountry code associated with the location.
OptionalpostalCode?: stringPostal or ZIP code associated with the location.
Optionalregion?: stringRegion or state name associated with the location.
OptionalregionCode?: stringRegion or state code associated with the location.
Optionaltimezone?: stringTime zone identifier associated with the location.
Random value associated with the profile.
Aggregated session statistics for the profile.
Duration of the active session.
Average session duration across all sessions represented by this record.
The unit should match SessionStatistics.activeSessionLength.
Number of sessions associated with this profile or identifier.
Often used in combination with SessionStatistics.averageSessionLength.
Unique identifier for this session statistics record.
Indicates whether the visitor has been seen before.
Landing page for the session.
Path component of the page URL (e.g., /products/123).
Parsed query parameters for the page.
Referrer URL that led to the current page.
Raw search string including the leading ? (e.g., "?q=test").
Optionaltitle?: stringTitle of the page as seen by the user.
Full URL of the page.
Stable, long-lived identifier of the profile.
Traits describing the profile (user-level attributes).
The resolved value (type depends on the tag).
Determine whether the named operation is permitted based on consent and allowed event type configuration.
Method name; trackComponentView is normalized to
'component' for allow‑list checks.
true if the operation is permitted; otherwise false.
Identify the current profile/visitor to associate traits with a profile and update optimization state.
Identify builder payload.
The resulting OptimizationData for the identified user.
Guard used to suppress duplicate component view events for the same component based on a duplication key and the component identifier.
Operation name (unused).
Tuple [builderArgs, duplicationScope].
true if the event is NOT a duplicate and should proceed.
Hook invoked when an operation is blocked due to missing consent.
The blocked operation name.
The original arguments supplied to the operation.
Hook invoked when an operation is blocked by the duplication guard.
The blocked operation name (unused).
The original arguments supplied to the operation.
Record a page view and update optimization state.
Page view builder payload.
The evaluated OptimizationData for this page view.
Resolve a Contentful entry to a personalized variant using the current or provided selections.
Entry skeleton type.
Chain modifiers.
Locale code.
The entry to personalize.
Optional selections; defaults to the current signal value.
Identifier of the personalization or experiment experience.
Optionalsticky?: booleanIndicates whether this personalization selection is sticky for the user.
Index of the selected variant within the experience configuration.
Typically corresponds to the index of the selected PersonalizationConfig entry.
Mapping of baseline entry IDs to their selected variant entry IDs.
The resolved entry data.
Record a screen view and update optimization state.
Screen view builder payload.
The evaluated OptimizationData for this screen view.
Record a custom track event and update optimization state.
Track builder payload.
The evaluated OptimizationData for this event.
Record a "sticky" component view.
"Sticky" component view builder payload.
The evaluated OptimizationData for this component view if the device is online.
Stateful personalization product that manages consent, profile, flags, and selected variants while emitting Experience events and updating state.
Remarks
The class maintains reactive signals and exposes read‑only observables via PersonalizationStateful.states. Events are validated via schema parsers and run through interceptors before being submitted. Resulting state is merged back into signals.