Skip to content

Recommendations Data & Events

The Recommendations drop-in emits product recommendation updates, enabling dynamic display of cross-sell, upsell, and related product suggestions based on user behavior and cart contents.

Version: 1.1.1

Events reference

Drop-ins communicate via the event bus.

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

Event details

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.

Usage

import { events } from '@dropins/tools/event-bus.js';
const recommendationsDataListener = events.on('recommendations/data', (data) => {
console.log('recommendations/data event received:', data);
// Add your custom logic here
});
// Later, when you want to stop listening
recommendationsDataListener.off();

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;
}