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()orevent.respondWith(), to add to cart your way. Without an answer, the player opens the product page, so a button never does nothing.
Listen
Section titled “Listen”// 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));Add to cart with your own cart
Section titled “Add to cart with your own cart”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 });What every event carries
Section titled “What every event carries”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.
All events
Section titled “All events”In the DOM, each event is the same name with lumieo: in front, such as lumieo:video:play.
| Event | When | Extra fields |
|---|---|---|
close | The viewer closed. | – |
error | The widget couldn't load or play. code says why and docsUrl links to the fix. | code, docsUrl |
impression | At least half the widget was on screen. Sent once per widget per page load. | – |
open | The viewer opened on a video. | – |
ready | The player loaded and the widget is ready to show. | – |
video:change | The shopper moved to another video. direction, fromPosition and toPosition say where. | direction, fromPosition, toPosition |
video:complete | A video played to the end. | – |
video:pause | A video paused. cause: "details" means the player paused it while product details were open. | cause |
video:play | A video started or resumed. cause: "details" means it resumed after product details closed. | cause |
video:progress | A video reached 25, 50 or 75 percent (percent). | percent |
playlist:end | The last video finished. | – |
story:seen | The last video of a stories group started. groupId says which group. | groupId |
bubble:dismiss | The shopper closed the floating bubble. It stays hidden for this page load; store it yourself to keep it hidden on later pages. | – |
bubble:open | The shopper tapped the floating bubble. open follows. | – |
product:click | The shopper tapped a product card. | – |
product:details | The shopper opened a product's details. | – |
product:view | A product card came into view. delayS is the products delay that was in force. | delayS |
variant:select | The shopper picked a size or other variant. | – |
action:add-to-cart | The 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:custom | The shopper pressed one of your own buttons. actionId says which. Without a responder, the player follows the button's link. | actionId |
action:view-product | The shopper pressed View product. Without a responder, the player opens the product page. | – |
Error codes
Section titled “Error codes”lumieo:error carries one of these in code, and a link to its page in docsUrl.
| Code | What it means |
|---|---|
experience-not-found | No widget has this id, or it's Off. Check the experience attribute and that the widget is On. |
domain-not-allowed | This website's address isn't on the market's allowed list. Add it under Web › Website settings. |
plan-limit-reached | Your plan's monthly plays are used up. The widget hides until the next period or an upgrade. |
fetch-failed | The player couldn't reach lumieo. It retries on the next page load. |
update-player | The page loads an old copy of the player. Use the current embed code. |
unsupported-type | The widget uses a format this version of the player doesn't know. Reload to get the latest player. |
unsupported-browser | The shopper's browser is too old to play video here. The widget stays hidden. |
no-product-videos | The widget only shows videos tagged with this page's product, and there are none. The widget stays hidden. |