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. For common events shared across multiple drop-ins (such as locale, error, authenticated, etc.), see the Common events reference.
Version: 1.1.1
Events reference
| Event | Direction | Description |
|---|---|---|
| recommendations/data | Emits and listens | Triggered when data is available or changes |
Event details
The following sections provide detailed information about each event, including its direction, data payload structure, and usage examples.
recommendations/data (emits and listens)
Triggered when data is available or changes
Data payload
RecommendationUnitModel[] | nullUsage
Listen to this event in your storefront:
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 listeningrecommendationsDataListener.off();