Skip to content

Add Visitor Engagement to Site Goals' Side Panel #12582

@zutigrm

Description

@zutigrm

Feature Description

This issue extends the Site Goals side panel so users can control which Visitor engagement secondary conversion-event tiles are shown in the Site Goals widgets. The panel should expose Visitor engagement event toggles per goal type, and the widget should render only selected and currently eligible secondary events while always keeping the Engagement rate tile visible.

For this iteration, the only supported selectable secondary ecommerce event is add_to_cart.

Design doc


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The Site Goals side panel (introduced in Add Site Goals Side Panel + Goal Drivers selection to the Site Goals panel #12578) includes a Visitor engagement subsection inside the Online store performance dropdown matching the Figma designs.
  • In the Online store performance dropdown, Visitor engagement renders selectable event items from supported secondary ecommerce events. For this issue, this is only the add_to_cart event (currently available/supported).
  • Selecting/deselecting Visitor engagement event items updates side-panel selection state for ecommerce.
  • The Engagement rate tile remains always visible in VisitorEngagementSection, regardless of panel selections.
  • The additional Visitor engagement tile(s) in Online store render only when:
    • the event is selected in panel state, and
    • the event is eligible for current context (secondary to current primary event).
  • If add_to_cart is deselected, its Visitor engagement tile is hidden.
  • If current primary event is add_to_cart (no secondary ecommerce events), no additional Visitor engagement tile is rendered or shown in the list.
  • Lead generation widget keeps engagement-rate behavior unchanged in this issue (no additional lead Visitor engagement event tiles added here).

Implementation Brief

  • Add assets/js/modules/analytics-4/components/site-goals/visitor-engagement/registry.ts with centralized Visitor engagement event metadata.

    • Include id, order, defaultEnabled, panelLabel, tileLabel; for this issue register only add_to_cart.
    • Keep structure extensible for future events (begin_checkout, remove_from_cart, etc.) without changing panel/widget contracts.
  • Extend Site Goals selection-panel state shape in assets/js/modules/analytics-4/components/site-goals/selection-panel/constants.ts and panel state handlers.

    • Add Visitor engagement selections alongside existing Goal drivers selections.
    • Use per-goal-type structure, e.g. visitorEngagement: { ecommerce: [...], lead: [...] }.
  • Update assets/js/modules/analytics-4/components/site-goals/selection-panel/Panel.tsx to initialize staged Visitor engagement values when panel opens and persist effective values on save.

    • Follow the same staged/effective pattern already used for Goal drivers in this panel.
  • Update assets/js/modules/analytics-4/components/site-goals/selection-panel/PanelContent.tsx to render a Visitor engagement subsection inside the Online store performance dropdown.

    • Place subsection between Key action and Goal drivers, matching provided designs.
    • Render checkbox items from visitor-engagement/registry.js.
  • Add reusable subsection/list component(s) if needed: assets/js/modules/analytics-4/components/site-goals/selection-panel/VisitorEngagementItems.tsx.

    • Keep it presentational and driven by props from panel container state.
  • Add assets/js/modules/analytics-4/components/site-goals/visitor-engagement/getActiveVisitorEngagementEvents.ts.

    • Resolve selected event IDs with safe filtering and ordering from registry; ignore unknown IDs; return array for widget consumption.
  • Add selector/hook used by widgets to read effective Visitor engagement selection: assets/js/modules/analytics-4/components/site-goals/selection-panel/hooks/useSiteGoalsEffectiveSelection.ts.

    • Provide goal-type specific selected Visitor engagement events.

Widget integration

  • Update assets/js/modules/analytics-4/components/site-goals/widgets/OnlineStorePerformanceWidget.tsx.

    • Keep existing getSecondaryEcommerceEvents( primaryEvent ) behavior.
    • Compute enabledSecondaryEvents = intersection( selectedVisitorEngagementEvents, secondaryEcommerceEvents ).
    • Only fetch/map secondary eventCount tiles for enabledSecondaryEvents.
    • Continue passing normalized props into VisitorEngagementSection.
  • Keep assets/js/modules/analytics-4/components/site-goals/widgets/LeadGenerationPerformanceWidget.tsx unchanged for extra Visitor engagement event tiles.

  • Ensure assets/js/modules/analytics-4/components/site-goals/widgets/VisitorEngagementSection.tsx remains presentational-only.

    • No selection/state fetching inside the section component.
  • Reuse centralized event label mapping where possible, and align Visitor engagement tile label for add_to_cart with design copy (Products added to cart).

    • Avoid hardcoding labels separately in widget and panel.

Test Coverage

  • Add selection-panel tests under: assets/js/modules/analytics-4/components/site-goals/selection-panel/.

    • Verify Visitor engagement group renders for ecommerce, checkbox toggle updates staged/effective selection, and save persists changes.
  • Add resolver/helper tests for: assets/js/modules/analytics-4/components/site-goals/visitor-engagement/getActiveVisitorEngagementEvents.ts.

    • Verify ordering, unknown ID filtering, and default behavior.
  • Extend OnlineStorePerformanceWidget tests.

    • Verify Engagement rate always renders; add_to_cart tile renders when selected+eligible; hides when deselected; hides when primary event is add_to_cart.
  • Extend LeadGenerationPerformanceWidget tests.

    • Verify no additional Visitor engagement event tile renders in this issue.
  • Extend VisitorEngagementSection tests as needed.

    • Verify presentational rendering remains driven by normalized props and unaffected by panel internals.

QA Brief

  • Connect SK with siteGoals feature flags
  • Verify that for Online store performance metric Products added to the cart is present in the widget under visitor engagement section when add_to_cart conversion event is available, and under visitor engagement in selection panel.
    • Checking/unchecking it from side panel should add/remove that metrics from section in the widget
    • When add to cart event is not detected it should not show it in the widget, or side panel. You can go to Tester settings -> Analytics -> Conversion reporting and set purchase and/or add_to_cart as detected events to verify that metrics is showing/not showing
Image
  • You can also check wexford website it has ecomm data for past 90 days period, or any other that has conversion reporting data. If using wexford - it has only purchase data, you can verify that add to cart metric is not showing

Changelog entry

  • Add Visitor Engagement settings to Site Goals' Side Panel

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0High priorityTeam SIssues for Squad 1Type: EnhancementImprovement of an existing feature

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions