Contentful Personalization & Analytics
    Preparing search index...

    Request-bound stateless Optimization Core event client.

    Index

    Constructors

    Properties

    canPersistProfile: boolean

    Build Personalization events with this request's context and locale defaults.

    Explicit event arguments override request context, including explicit undefined. Construction does not perform consent admission, invoke interceptors, submit events, or update request state. Use the direct request methods for SDK-managed submission.

    Accessors

    • get profile(): | {
          audiences: string[];
          id: string;
          jurisdiction?: "US"
          | "EU";
          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 | string[]>;
                  referrer: string;
                  search: string;
                  title?: string;
                  url: string;
                  [key: string]: JSONType;
              };
          };
          stableId: string;
          traits: Record<string, JSONType>;
      }
      | undefined

      Current request profile, updated after Experience responses.

      Returns
          | {
              audiences: string[];
              id: string;
              jurisdiction?: "US"
              | "EU";
              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 | string[]>;
                      referrer: string;
                      search: string;
                      title?: string;
                      url: string;
                      [key: string]: JSONType;
                  };
              };
              stableId: string;
              traits: Record<string, JSONType>;
          }
          | undefined

      • {
            audiences: string[];
            id: string;
            jurisdiction?: "US" | "EU";
            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 | string[]>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
            };
            stableId: string;
            traits: Record<string, JSONType>;
        }
        • audiences: string[]

          List of audience identifiers that this profile belongs to.

        • id: string

          Primary identifier of the profile.

        • Optionaljurisdiction?: "US" | "EU"

          Data-residency jurisdiction of the profile's storage, when the Experience API reports it.

          Set by the Experience API host the profile was written through (experience.eu.ninetailed.co stores it in the EU).

        • 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.

          • 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 | string[]>;
                  referrer: string;
                  search: string;
                  title?: string;
                  url: string;
                  [key: string]: JSONType;
              };
          }

          Aggregated session statistics for the profile.

          • activeSessionLength: number

            Duration of the active session.

          • averageSessionLength: number

            Average session duration across all sessions represented by this record.

            The unit must match SessionStatistics.activeSessionLength.

          • count: number

            Number of sessions associated with this profile or identifier.

            Often used in combination with SessionStatistics.averageSessionLength.

          • Optionalid?: string

            Session identifier, when supplied by the Experience API.

          • 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 | 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 | string[]>

              Parsed query parameters for the page.

              Query

            • 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

      • undefined

    Methods

    • Fetch a Contentful entry by ID or by content type and slug through the parent SDK's configured contentful.js client.

      Type Parameters

      Parameters

      Returns Promise<Entry<S, undefined, L>>

      Set entryQuery on an object descriptor to customize its query. If contentful.defaultQuery and the descriptor's entryQuery or per-call query omit locale, this request's locale becomes the managed Contentful query locale. Entry IDs use getEntry() or a coalesced getEntries() call; descriptors that identify entries by content type and slug use getEntries().

    • Fetch a Contentful entry by ID or by content type and slug through the parent SDK's configured contentful.js client.

      Type Parameters

      Parameters

      • descriptor:
            | {
                contentType?: undefined;
                entryId: string;
                entryQuery?: ContentfulEntryQuery;
                slug?: undefined;
                slugField?: undefined;
            }
            | {
                contentType: string;
                entryId?: undefined;
                entryQuery?: ContentfulEntryQuery;
                slug: string;
                slugField?: string;
            }

      Returns Promise<Entry<S, undefined, L>>

      Set entryQuery on an object descriptor to customize its query. If contentful.defaultQuery and the descriptor's entryQuery or per-call query omit locale, this request's locale becomes the managed Contentful query locale. Entry IDs use getEntry() or a coalesced getEntries() call; descriptors that identify entries by content type and slug use getEntries().

    • Fetch a Contentful entry by ID or by content type and slug, then resolve it with request-local selected optimizations.

      Type Parameters

      Parameters

      Returns Promise<FetchOptimizedEntryResult<S, undefined, L>>

      If options.selectedOptimizations is omitted, this uses the latest selected optimizations returned by an accepted request-bound Experience API call. Set entryQuery on an object descriptor to customize its query. If contentful.defaultQuery and the descriptor's entryQuery or per-call query omit locale, this request's locale becomes the managed Contentful query locale. Fetching follows the same getEntry() and getEntries() behavior as CoreStatelessRequest.fetchContentfulEntry.

    • Fetch a Contentful entry by ID or by content type and slug, then resolve it with request-local selected optimizations.

      Type Parameters

      Parameters

      • descriptor:
            | {
                contentType?: undefined;
                entryId: string;
                entryQuery?: ContentfulEntryQuery;
                slug?: undefined;
                slugField?: undefined;
            }
            | {
                contentType: string;
                entryId?: undefined;
                entryQuery?: ContentfulEntryQuery;
                slug: string;
                slugField?: string;
            }
      • Optionaloptions: Omit<FetchOptimizedEntryOptions, "query">

      Returns Promise<FetchOptimizedEntryResult<S, undefined, L>>

      If options.selectedOptimizations is omitted, this uses the latest selected optimizations returned by an accepted request-bound Experience API call. Set entryQuery on an object descriptor to customize its query. If contentful.defaultQuery and the descriptor's entryQuery or per-call query omit locale, this request's locale becomes the managed Contentful query locale. Fetching follows the same getEntry() and getEntries() behavior as CoreStatelessRequest.fetchContentfulEntry.

    • Parameters

      • payload: {
            campaign?: {
                content?: string;
                medium?: string;
                name?: string;
                source?: string;
                term?: string;
            };
            locale?: string;
            location?: {
                city?: string;
                continent?: string;
                coordinates?: { latitude: number; longitude: number };
                country?: string;
                countryCode?: string;
                postalCode?: string;
                region?: string;
                regionCode?: string;
                timezone?: string;
            };
            page?: {
                path: string;
                query: Record<string, string | string[]>;
                referrer: string;
                search: string;
                title?: string;
                url: string;
                [key: string]: JSONType;
            };
            screen?: { name: string; [key: string]: JSONType };
            traits?: Record<string, JSONType>;
            userAgent?: string;
            userId: string;
        }

      Returns Promise<EventEmissionResult>

    • Parameters

      • payload: {
            campaign?: {
                content?: string;
                medium?: string;
                name?: string;
                source?: string;
                term?: string;
            };
            locale?: string;
            location?: {
                city?: string;
                continent?: string;
                coordinates?: { latitude: number; longitude: number };
                country?: string;
                countryCode?: string;
                postalCode?: string;
                region?: string;
                regionCode?: string;
                timezone?: string;
            };
            page?: {
                path: string;
                query: Record<string, string | string[]>;
                referrer: string;
                search: string;
                title?: string;
                url: string;
                [key: string]: JSONType;
            };
            properties?: {
                path?: string;
                query?: Record<string, string | string[]>;
                referrer?: string;
                search?: string;
                title?: string;
                url?: string;
                [key: string]: JSONType;
            };
            screen?: { name: string; [key: string]: JSONType };
            userAgent?: string;
        } = {}

      Returns Promise<EventEmissionResult>

    • Parameters

      • payload: {
            campaign?: {
                content?: string;
                medium?: string;
                name?: string;
                source?: string;
                term?: string;
            };
            locale?: string;
            location?: {
                city?: string;
                continent?: string;
                coordinates?: { latitude: number; longitude: number };
                country?: string;
                countryCode?: string;
                postalCode?: string;
                region?: string;
                regionCode?: string;
                timezone?: string;
            };
            name: string;
            page?: {
                path: string;
                query: Record<string, string | string[]>;
                referrer: string;
                search: string;
                title?: string;
                url: string;
                [key: string]: JSONType;
            };
            properties: Record<string, JSONType>;
            screen?: { name: string; [key: string]: JSONType };
            userAgent?: string;
        }

      Returns Promise<EventEmissionResult>

    • Parameters

      • payload: {
            campaign?: {
                content?: string;
                medium?: string;
                name?: string;
                source?: string;
                term?: string;
            };
            event: string;
            locale?: string;
            location?: {
                city?: string;
                continent?: string;
                coordinates?: { latitude: number; longitude: number };
                country?: string;
                countryCode?: string;
                postalCode?: string;
                region?: string;
                regionCode?: string;
                timezone?: string;
            };
            page?: {
                path: string;
                query: Record<string, string | string[]>;
                referrer: string;
                search: string;
                title?: string;
                url: string;
                [key: string]: JSONType;
            };
            properties?: Record<string, JSONType>;
            screen?: { name: string; [key: string]: JSONType };
            userAgent?: string;
        }

      Returns Promise<EventEmissionResult>

    • Parameters

      • payload: {
            campaign?: {
                content?: string;
                medium?: string;
                name?: string;
                source?: string;
                term?: string;
            };
            componentId: string;
            experienceId?: string;
            locale?: string;
            location?: {
                city?: string;
                continent?: string;
                coordinates?: { latitude: number; longitude: number };
                country?: string;
                countryCode?: string;
                postalCode?: string;
                region?: string;
                regionCode?: string;
                timezone?: string;
            };
            page?: {
                path: string;
                query: Record<string, string | string[]>;
                referrer: string;
                search: string;
                title?: string;
                url: string;
                [key: string]: JSONType;
            };
            screen?: { name: string; [key: string]: JSONType };
            userAgent?: string;
            variantIndex?: number;
            viewDurationMs?: number;
            viewId?: string;
        }

      Returns Promise<void>