Send custom events to the Alby widget to enhance analytics and shopper experience
window.alby.track
will be deprecated, existing events will still be functional, it is not recommended that it is used, see https://help.alby.com/supplemental-events
The window.alby.track
function is designed to allow supplemental data to be published to the Alby JavaScript widget. This function can be called from the client-side code to communicate specific actions or data to the Alby widget, enhancing its functionality and integration with the client's application.
Usage
To use the window.alby.track
function, you will need to call the function in your client-side JavaScript code with the custom event name and a payload object containing the desired data.
Please note: The window.alby.track
function will only work after the alby embed script is finished loading. It is important to ensure that the alby embed script is properly loaded before attempting to use the window.alby.track
function.
Events
The following is a list of possible custom event names that can be used with the window.alby.track
function:
ADD_TO_CART
- Description: Trigger when a user has added a product to cart.
window.alby.track('ADD_TO_CART', {
price: 19.99, // Price of the item
variantId: 'abc123', // Variant ID of the item
quantity: 1, // Quantity of the item
currency: "USD" // Currency
});