Contentful Personalization & Analytics
    Preparing search index...

    Interface PersonalizationProductConfigDefaults

    Default state values for PersonalizationStateful applied at construction time.

    interface PersonalizationProductConfigDefaults {
        changes?: {
            key: string;
            meta: { experienceId: string; variantIndex: number };
            type: "Variable";
            value: null | string | number | boolean | Record<string, JSONType>;
        }[];
        consent?: boolean;
        personalizations?: {
            experienceId: string;
            sticky?: boolean;
            variantIndex: number;
            variants: Record<string, string>;
        }[];
        profile?: {
            audiences: string[];
            id: string;
            location: {
                city?: string;
                continent?: string;
                coordinates?: { latitude: number; longitude: number };
                country?: string;
                countryCode?: string;
                postalCode?: string;
                region?: string;
                regionCode?: string;
                timezone?: string;
            };
            random: number;
            session: {
                activeSessionLength: number;
                averageSessionLength: number;
                count: number;
                id: string;
                isReturningVisitor: boolean;
                landingPage: {
                    path: string;
                    query: Record<string, string>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
            };
            stableId: string;
            traits: Record<string, JSONType>;
        };
    }
    Index

    Properties

    changes?: {
        key: string;
        meta: { experienceId: string; variantIndex: number };
        type: "Variable";
        value: null | string | number | boolean | Record<string, JSONType>;
    }[]

    Initial diff of changes produced by the service.

    Type declaration

    • key: string

      Key identifying the subject of the change.

    • meta: { experienceId: string; variantIndex: number }

      Metadata describing the originating experience and variant index.

      • experienceId: string

        Identifier of the personalization or experiment experience.

      • variantIndex: number

        Index of the variant within the experience configuration.

        Typically corresponds to the array index in the experience's distribution.

    • type: "Variable"

      Discriminator for a variable change.

    • value: null | string | number | boolean | Record<string, JSONType>

      New value for the variable identified by ChangeBase.key.

    consent?: boolean

    Whether personalization is allowed by default.

    personalizations?: {
        experienceId: string;
        sticky?: boolean;
        variantIndex: number;
        variants: Record<string, string>;
    }[]

    Preselected personalization variants (e.g., winning treatments).

    Type declaration

    • experienceId: string

      Identifier of the personalization or experiment experience.

    • Optionalsticky?: boolean

      Indicates whether this personalization selection is sticky for the user.

      false
      

      Sticky selections should be reused on subsequent requests for the same user, rather than re-allocating a new variant.

    • variantIndex: number

      Index of the selected variant within the experience configuration.

      Typically corresponds to the index of the selected PersonalizationConfig entry.

    • variants: Record<string, string>

      Mapping of baseline entry IDs to their selected variant entry IDs.

      The keys are component identifiers and the values are the identifiers of the selected variant for that component.

    profile?: {
        audiences: string[];
        id: string;
        location: {
            city?: string;
            continent?: string;
            coordinates?: { latitude: number; longitude: number };
            country?: string;
            countryCode?: string;
            postalCode?: string;
            region?: string;
            regionCode?: string;
            timezone?: string;
        };
        random: number;
        session: {
            activeSessionLength: number;
            averageSessionLength: number;
            count: number;
            id: string;
            isReturningVisitor: boolean;
            landingPage: {
                path: string;
                query: Record<string, string>;
                referrer: string;
                search: string;
                title?: string;
                url: string;
                [key: string]: JSONType;
            };
        };
        stableId: string;
        traits: Record<string, JSONType>;
    }

    Default active profile used for personalization.

    Type declaration

    • audiences: string[]

      List of audience identifiers that this profile currently belongs to.

    • id: string

      Primary identifier of the profile.

    • location: {
          city?: string;
          continent?: string;
          coordinates?: { latitude: number; longitude: number };
          country?: string;
          countryCode?: string;
          postalCode?: string;
          region?: string;
          regionCode?: string;
          timezone?: string;
      }

      Geo-location information associated with the profile.

      GeoLocation

      • Optionalcity?: string

        City name associated with the location.

      • Optionalcontinent?: string

        Continent name associated with the location.

      • Optionalcoordinates?: { latitude: number; longitude: number }

        Geographical coordinates for the location.

        • latitude: number

          Latitude component of the coordinates.

        • longitude: number

          Longitude component of the coordinates.

      • Optionalcountry?: string

        Country name associated with the location.

      • OptionalcountryCode?: string

        Country code associated with the location.

        Validated to exactly COUNTRY_CODE_LENGTH characters, typically an ISO 3166-1 alpha-2 code.

      • OptionalpostalCode?: string

        Postal or ZIP code associated with the location.

      • Optionalregion?: string

        Region or state name associated with the location.

      • OptionalregionCode?: string

        Region or state code associated with the location.

      • Optionaltimezone?: string

        Time zone identifier associated with the location.

        Typically an IANA time zone string (e.g., "Europe/Berlin").

    • random: number

      Random value associated with the profile.

      Often used for deterministic bucketing (e.g., in experiments).

    • session: {
          activeSessionLength: number;
          averageSessionLength: number;
          count: number;
          id: string;
          isReturningVisitor: boolean;
          landingPage: {
              path: string;
              query: Record<string, string>;
              referrer: string;
              search: string;
              title?: string;
              url: string;
              [key: string]: JSONType;
          };
      }

      Aggregated session statistics for the profile.

      SessionStatistics

      • activeSessionLength: number

        Duration of the active session.

      • averageSessionLength: number

        Average session duration across all sessions represented by this record.

        The unit should match SessionStatistics.activeSessionLength.

      • count: number

        Number of sessions associated with this profile or identifier.

        Often used in combination with SessionStatistics.averageSessionLength.

      • id: string

        Unique identifier for this session statistics record.

      • isReturningVisitor: boolean

        Indicates whether the visitor has been seen before.

        true typically means the visitor has at least one prior session.

      • landingPage: {
            path: string;
            query: Record<string, string>;
            referrer: string;
            search: string;
            title?: string;
            url: string;
            [key: string]: JSONType;
        }

        Landing page for the session.

        Represents the first page the user visited in this session.

        Page

        • path: string

          Path component of the page URL (e.g., /products/123).

        • query: Record<string, string>

          Parsed query parameters for the page.

        • referrer: string

          Referrer URL that led to the current page.

        • search: string

          Raw search string including the leading ? (e.g., "?q=test").

        • Optionaltitle?: string

          Title of the page as seen by the user.

        • url: string

          Full URL of the page.

    • stableId: string

      Stable, long-lived identifier of the profile.

      Intended to remain constant across sessions and devices when possible. Usually equal to id.

    • traits: Record<string, JSONType>

      Traits describing the profile (user-level attributes).

      Traits