Events you can send to us
Socket events
You send events using window.DT.productGuide.emit(EVENT_TYPE, DATA)
.
These are the events:
/* -- This is used to initiate the product guide, productGuideId is the id of the guide and lang is the preferred language -- */
window.DT.initProductGuide('productGuideId', { lang: 'en' });
/* -- Options is a array of uuids of the buttons that where pressed. -- */
window.DT.productGuide.emit('options', { options: ['uuid'] });
/* -- Inputs is a array of objects that contain the id and value from the input. -- */
window.DT.productGuide.emit('user_input', { inputs: [{ id: 'uuid', input: 'Some value' }] });
/* -- This is used when loading in more products, from is the amount you have now, to is the previous amount + the amount you want to fetch. -- */
window.DT.productGuide.emit('products', { from: 3, to: 6 });
/* -- From is the uuid of the step you want to skip from -- */
window.DT.productGuide.emit('skip', { from: 'uuid' });
/* -- To is the uuid of the step you want to undo to -- */
window.DT.productGuide.emit('undo', { to: 'uuid' });
/* -- Used to restart the guide. -- */
window.DT.productGuide.emit('init');
These events will send a response back, you can see them here.
- The only one that will send
product_guide_products
isproducts
.
Other events
We also have some other events that can be used to see data in our dashboard. These are the types:
type EventType = 'add_to_cart' | 'purchase' | 'product_click';
type Item = {
id: string;
quantity?: number;
value: number | string;
};
type Event<T extends EventType = EventType> = {
type: T;
ext?: string
} & (T extends 'product_click'
? {
type: 'product_click';
productId: string;
position?: number;
stepId: string;
}
: T extends 'add_to_cart'
? {
type: 'add_to_cart';
items: Item | Item[];
currency: string;
}
: T extends 'purchase'
? {
type: 'purchase';
items: Item[];
currency: string;
}
: never);
Call them using window.DT.event(EventType, Event<EventType>)
.