analytics.addedPaymentInfo¶
analytics.addedPaymentInfo
is an event on the Event Bus that occurs after a user has added their payment info. This event only dispatches when analytics is enabled in the shop.
Event body¶
none
Example¶
In this example we listen to analytics.addedPaymentInfo
event and perform an action whenever it's emitted.
useStorefront(async (storefront) => {
storefront.eventBus.on('analytics.addedPaymentInfo', () => {
console.log('A user has added a payment info')
});
});
Example¶
In this example we use a Message Storage API to retrieve an array of past analytics.addedPaymentInfo
events.
useStorefront((storefront) => {
const messageStorageApi = storefront.getApiSync('messageStorageSystemApi');
const pastAddedPaymentInfoEvents = messageStorageApi.getChannelMessages('analytics.addedPaymentInfo');
if (pastAddedPaymentInfoEvents.length > 0) {
pastAddedPaymentInfoEvents.forEach(({ body: eventBody }) => {
console.log('perform action on every past event');
});
}
});