Skip to content

Events and actions

The player tells your page what shoppers do, and asks your page to do things it can’t do itself, such as adding to your cart.

  • Listen with Lumieo.on() or a DOM listener, to forward events to your analytics.
  • Answer an action with Lumieo.handle() or event.respondWith(), to add to cart your way. Without an answer, the player opens the product page, so a button never does nothing.
// Calls made before the loader finishes are queued and replayed.
window.Lumieo ??= { q: [] };
Lumieo.q.push([
"on",
"video:play",
(event) => {
analytics.track("Video played", { video: event.videoId });
},
]);
// Or, once the loader has run:
Lumieo.on("product:click", (event) => console.log(event.product.externalId));
// DOM events bubble from the element, prefixed with lumieo:
document.addEventListener("lumieo:open", (event) => console.log(event.detail));
Lumieo.handle("action:add-to-cart", async (event) => {
await myCart.add(event.variant.externalId, event.quantity);
return { ok: true };
});

Return { ok: true } (with an optional message) or { ok: false, message, reason }. The button shows a pending state, then the result. A responder that throws, or doesn’t answer within 10 seconds, counts as a failure; change the limit with Lumieo.configure({ actionTimeoutMs }).

Tell the player when your cart changes elsewhere, so its buttons stay right:

Lumieo.setProductState("SHOP-PRODUCT-ID", { inCart: 2 });

Each event’s detail has v, type, experienceId, sessionId and occurredAt, and, when they apply, playlistId, videoId, siteId, position, videoTimeMs, origin, product (externalId, name, url), variant (externalId, sku, price, available) and quantity. Products and variants use your shop’s own ids. Events never contain personal data.

In the DOM, each event is the same name with lumieo: in front, such as lumieo:video:play.

EventWhenExtra fields
closeThe viewer closed.–
errorThe widget couldn't load or play. code says why and docsUrl links to the fix.code, docsUrl
impressionAt least half the widget was on screen. Sent once per widget per page load.–
openThe viewer opened on a video.–
readyThe player loaded and the widget is ready to show.–
video:changeThe shopper moved to another video. direction, fromPosition and toPosition say where.direction, fromPosition, toPosition
video:completeA video played to the end.–
video:pauseA video paused. cause: "details" means the player paused it while product details were open.cause
video:playA video started or resumed. cause: "details" means it resumed after product details closed.cause
video:progressA video reached 25, 50 or 75 percent (percent).percent
playlist:endThe last video finished.–
story:seenThe last video of a stories group started. groupId says which group.groupId
bubble:dismissThe shopper closed the floating bubble. It stays hidden for this page load; store it yourself to keep it hidden on later pages.–
bubble:openThe shopper tapped the floating bubble. open follows.–
product:clickThe shopper tapped a product card.–
product:detailsThe shopper opened a product's details.–
product:viewA product card came into view. delayS is the products delay that was in force.delayS
variant:selectThe shopper picked a size or other variant.–
action:add-to-cartThe shopper pressed Add to cart. Answer it with a responder to add the item to your cart; without one, the player opens the product page.–
action:customThe shopper pressed one of your own buttons. actionId says which. Without a responder, the player follows the button's link.actionId
action:view-productThe shopper pressed View product. Without a responder, the player opens the product page.–

lumieo:error carries one of these in code, and a link to its page in docsUrl.

CodeWhat it means
experience-not-foundNo widget has this id, or it's Off. Check the experience attribute and that the widget is On.
domain-not-allowedThis website's address isn't on the market's allowed list. Add it under Web › Website settings.
plan-limit-reachedYour plan's monthly plays are used up. The widget hides until the next period or an upgrade.
fetch-failedThe player couldn't reach lumieo. It retries on the next page load.
update-playerThe page loads an old copy of the player. Use the current embed code.
unsupported-typeThe widget uses a format this version of the player doesn't know. Reload to get the latest player.
unsupported-browserThe shopper's browser is too old to play video here. The widget stays hidden.
no-product-videosThe widget only shows videos tagged with this page's product, and there are none. The widget stays hidden.