Contentful Personalization & Analytics
    Preparing search index...

    Runtime context attached to SDK event-stream emissions for optimized entry interactions.

    interface EventOptimizationContext {
        audienceEntry?: AudienceEntry;
        baselineEntry: ContentfulEntry;
        contextId: string;
        optimizationEntry: OptimizationEntry;
        resolvedEntry: ContentfulEntry;
        selectedOptimization: {
            experienceId: string;
            sticky?: boolean;
            variantIndex: number;
            variants: Record<string, string>;
        };
        selectedVariant?: { hidden?: boolean; id: string };
    }
    Index

    Properties

    audienceEntry?: AudienceEntry
    baselineEntry: ContentfulEntry
    contextId: string
    optimizationEntry: OptimizationEntry
    resolvedEntry: ContentfulEntry
    selectedOptimization: {
        experienceId: string;
        sticky?: boolean;
        variantIndex: number;
        variants: Record<string, string>;
    }

    Type Declaration

    • experienceId: string

      Identifier of the personalization or experiment experience.

    • Optionalsticky?: boolean

      Indicates whether this optimization selection is sticky for the user.

      false
      

      Reuse sticky selections 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 OptimizationConfig 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.

    selectedVariant?: { hidden?: boolean; id: string }

    Type Declaration

    • Optionalhidden?: boolean

      On a baseline: true excludes the whole component from allocation.

      On a variant: can be true (author chose "Use empty variant") or false (unfilled placeholder). Both states share id: "". Do not use this field to detect an empty variant — use id === "" instead. The Experience API strips this field before runtime; it is only present in Contentful CDA nt_config.

    • id: string

      Unique identifier for the variant. Empty string ("") for an empty variant — both the deliberate "Use empty variant" choice and an unfilled placeholder slot.