Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Recommendations Data & Events

The Recommendations drop-in uses the event bus to emit and listen to events for communication between drop-ins and external integrations.

Version: 1.1.1

Events reference

EventDirectionDescription
recommendations/dataEmits and listensTriggered when data is available or changes.

Event details

The following sections provide detailed information about each event, including its direction, event payload, and usage examples.

recommendations/data (emits and listens)

Emitted when product recommendations are loaded. This includes recommended products based on user behavior, cart contents, or product associations.

Event payload

RecommendationUnitModel[] | null

See RecommendationUnitModel for full type definition.

Example

import { events } from '@dropins/tools/event-bus.js';
events.on('recommendations/data', (payload) => {
console.log('recommendations/data event received:', payload);
// Add your custom logic here
});

Data Models

The following data models are used in event payloads for this drop-in.

RecommendationUnitModel

Used in: recommendations/data.

interface RecommendationUnitModel {
displayOrder: number;
pageType: PageType;
title: string;
items: Item[];
totalProducts: number;
typeId: string;
unitId: string;
unitName: string;
}