Types and Interfaces

View as Markdown

Types and Interfaces

The Types and Interfaces used and exported by the Personalize Edge SDK.

SetUserIdOptions

The SetUserIdOptions interface provides configuration options for the setUserId method.

NameTypeDescription
preserveUserAttributes boolean

Set to true to merge user attributes from the current user.

InitOptions

The InitOptions interface specifies configuration options for initializing the SDK. These options allow for customization during the setup process

NameTypeDescription
requestRequest

A web-standard Request object used to track users and extract attributes like query parameters, referrer, and geolocation in edge functions.

userIdstring

The user ID to be explicitly assigned.

customVariantQueryParamstring

Specifies a custom name for the variant query parameter

liveAttributesClientAttributes

Specifies the custom attributes object to treat as live attributes. These attributes must be pre-configured in the Personalize project.

ClientAttributes

The ClientAttributes type alias represents a collection of key-value pairs, where each key is an attribute key that you have defined in the Attributes module, and the corresponding value can be of the type expected by the audience rules.

ManifestExperience

The ManifestExperience type alias defines the structure of an experience within a personalization manifest.

NameTypeDescription
shortUidstring

The unique identifier for the experience.

activeVariantShortUidstring

The unique identifier for the active variant associated with the experience; it can be null if no variant is active.

Manifest

The Manifest type alias defines the structure of the personalization manifest

NameTypeDescription
activeVariantsstring

A record mapping experience short UIDs to their corresponding active variant short UIDs

experiencesManifestExperience

An array of ManifestExperience objects, each representing an experience and its associated active variant.

TriggerImpressionsOptions

The TriggerImpressionsOptions type alias defines the structure of the argument passed to the TriggerImpressionsOptions method.

NameTypeDescription
experienceShortUids string[]

A list of Experience Short UIDs. The corresponding active variants are picked from the Manifest.

aliasesstring[]

A list of Variant Aliases. An alias consists of an Experience Short UID and a corresponding Variant Short UID.

InitializationStatus

The InitializationStatus type alias defines in the Contentstack Personalize SDK represents the current state of the SDK's initialization process. It can have one of the following string values:

  • initializing: Indicates that the SDK is in the process of initializing.
  • success: Signifies that the SDK has successfully initialized.
  • error: Denotes that an error occurred during the initialization.