Contentful Personalization & Analytics
    Preparing search index...

    Props for the OptimizedEntry component.

    interface OptimizedEntryProps {
        children: ReactNode | ((resolvedEntry: Entry) => ReactNode);
        entry: Entry;
        liveUpdates?: boolean;
        onTap?: (resolvedEntry: Entry) => void;
        style?: StyleProp<ViewStyle>;
        testID?: string;
        threshold?: number;
        trackTaps?: boolean;
        trackViews?: boolean;
        viewDurationUpdateIntervalMs?: number;
        viewTimeMs?: number;
    }
    Index

    Properties

    children: ReactNode | ((resolvedEntry: Entry) => ReactNode)

    Content to render. Accepts either a render prop or static children.

    • Render prop (resolvedEntry: Entry) => ReactNode: receives the resolved entry (variant or baseline) and returns content to render. Use this when you need the resolved entry data.
    • Static children ReactNode: rendered as-is without entry data. Use this when you only need tracking, not variant resolution.
    <OptimizedEntry entry={entry}>
    {(resolvedEntry) => (
    <HeroComponent
    title={resolvedEntry.fields.title}
    image={resolvedEntry.fields.image}
    />
    )}
    </OptimizedEntry>
    <OptimizedEntry entry={productEntry}>
    <ProductCard name={productEntry.fields.name} />
    </OptimizedEntry>

    entry

    entry: Entry

    The Contentful entry to optimize and track. For optimized entries (those with nt_experiences), the component automatically resolves variants. For non-optimized entries, the entry is passed through unchanged.

    const entry = await contentful.getEntry('entry-id', {
    include: 10,
    })
    liveUpdates?: boolean

    Whether this component should react to optimization state changes in real-time. Only applies to optimized entries; ignored for non-optimized entries. When undefined, inherits from the liveUpdates prop on OptimizationRoot. When false (or inherited as false), the component locks to the first variant it receives, preventing UI flashing when user actions change their qualification. When true, the component updates immediately when selected optimizations change.

    undefined

    Live updates are always enabled when the preview panel is open, regardless of this setting.

    onTap?: (resolvedEntry: Entry) => void

    Optional callback invoked with the resolved entry after a tap tracking event is emitted. When provided, implicitly enables tap tracking unless trackTaps is explicitly false.

    undefined

    style?: StyleProp<ViewStyle>

    Optional style prop for the wrapper View.

    testID?: string

    Optional testID for testing purposes.

    threshold?: number

    Minimum visibility ratio (0.0 - 1.0) required to consider the component "visible".

    0.8

    trackTaps?: boolean

    Per-component override for tap tracking.

    • undefined: inherits from trackEntryInteraction.taps on OptimizationRoot
    • true: enable tap tracking for this entry
    • false: disable tap tracking (overrides the global setting)

    undefined

    trackViews?: boolean

    Per-component override for view tracking.

    • undefined: inherits from trackEntryInteraction.views on OptimizationRoot
    • true: enable view tracking for this entry
    • false: disable view tracking for this entry

    undefined

    viewDurationUpdateIntervalMs?: number

    Interval (in milliseconds) between periodic view duration update events after the initial event has fired.

    5000

    viewTimeMs?: number

    Minimum time (in milliseconds) the component must be visible before tracking fires.

    2000