@vio-live/web-sdk 0.36.0 → 0.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -14,6 +14,47 @@ How to keep this file: see [CONTRIBUTING → Changelog](CONTRIBUTING.md#changelo
14
14
  The details of each feature live in the [README](README.md); this file says *what*
15
15
  and *when*, and links there.
16
16
 
17
+ ## Unreleased
18
+
19
+ ## 0.37.1 — 2026-10-30
20
+
21
+ ### Fixed
22
+ - **Kustom: the return confirms the order again on a page with two brands' carts** — the return read
23
+ the order with the platform key when its own cart was already closed, and said «Vi kunne ikke
24
+ bekrefte betalingen» for a paid order. It now reads with the returning checkout's sponsor and
25
+ channel, as Qliro and Walley do; Kustom, Qliro, Walley and Adyen reopen on that sponsor
26
+ ([#123](https://github.com/vio-live/vio-web-sdk/pull/123)).
27
+ - **Vipps: coming back from a cancelled payment no longer leaves «Henter betalingsmåter…» for good** —
28
+ on a page that mounts the checkout before it calls `Vio.init()` (Vev), the return found no cart
29
+ (each connection keeps its own), so nothing asked for the payment methods. The checkout now reopens
30
+ on the cart once `Vio.init()` lands (up to 10 s) and lists the methods; a paid return also clears the
31
+ connection's cart. With no checkout at all, the payment step says «Handlekurven er tom.» instead of
32
+ loading.
33
+
34
+ ## 0.37.0 — 2026-10-29
35
+
36
+ > **Deploy the collector `89f2766` (vio-analytics#38) before using this version:** an older collector rejects
37
+ > `cta_click` (the rest of the batch is kept, those clicks are lost).
38
+
39
+ ### Added
40
+ - **Button tracking: `cta_click`** — which buttons shoppers use. Every tap on a button of
41
+ `<vio-product-detail>`, `<vio-cart>`, `<vio-product>` and `<vio-checkout>` sends one `cta_click`
42
+ (in `context`: `cta`, `cta_location`, `cta_label`, `option_value`, `product_id`,
43
+ `product_variant_id`, the detail's layout, and the usual attribution), on the tap, before the
44
+ action. Each tap also dispatches **`vio:cta-click`** (bubbles, composed; React `onCtaClick`).
45
+ **`Vio.trackCta({ cta, location, label, variant, … })`** sends the same event for a host's own
46
+ buttons (`location: 'host' | 'card' | 'block'`, `cta_variant` for the button option being
47
+ tested). Ids and fields: [README → Button tracking](README.md#button-tracking-cta_click-unreleased).
48
+
49
+ ### ⚠️ Upgrade notes
50
+ - **The collector must know `cta_click`** (and its context fields) before this ships: an older
51
+ collector rejects the event — the rest of the batch is not affected.
52
+ - On `cta_click`, **`variant_id` is the layout's experiment variant** (as on `view_item`); the
53
+ product variant is **`product_variant_id`**.
54
+ - Hosts with `autoTrack: false` (Vev) get no `cta_click` from the SDK's buttons unless they forward
55
+ `vio:cta-click` themselves (`Vio.trackCta(e.detail)`).
56
+ - Nothing is sent before `Vio.analytics.start()`, `Vio.trackCta()` included.
57
+
17
58
  ## 0.36.0 — 2026-10-29
18
59
 
19
60
  ### Changed
package/README.md CHANGED
@@ -577,6 +577,103 @@ To **undo** it, open any page with **`?vio_internal=0`**. Things to know:
577
577
  (`Vio.analytics.isInternal` reads it). `resolveInternal()` / `INTERNAL_KEY` are
578
578
  exported from `/core`.
579
579
 
580
+ ### Button tracking (`cta_click`) (unreleased)
581
+
582
+ Which buttons shoppers use. Every tap on a button of the SDK's elements sends **one
583
+ `cta_click`**, through the same pipeline as every other event (consent,
584
+ `privateContent`, internal traffic, batching, attribution). A host's own buttons
585
+ send the same event with **`Vio.trackCta()`**, so the dashboard compares them on
586
+ one scale.
587
+
588
+ **When.** On the tap, before the button's own action runs (before any navigation
589
+ to Vipps, Stripe…) — it never blocks or delays the action, and one tap is one
590
+ event. Only once `Vio.analytics.start()` ran (with `autoTrack`, the default);
591
+ before that nothing is queued. A host with `autoTrack: false` hears the DOM event
592
+ (below) and decides itself.
593
+
594
+ **The wire** — everything in `context`, next to `campaign_id` / `location_id` /
595
+ `content_*` / `sponsor_id` as every event carries them:
596
+
597
+ | field | what |
598
+ |---|---|
599
+ | `cta` | the button id, `[a-z0-9_.:-]`, 1–64 chars (lists below) |
600
+ | `cta_location` | `detail` · `cart` · `card` · `checkout` · `host` · `block` |
601
+ | `cta_label` | the visible text of the button, trimmed, ≤ 64 (`Kjøp nå med Vipps`, `Til kassen`) |
602
+ | `cta_variant` | the host's name of the button option it is testing, `[A-Za-z0-9._:-]`, ≤ 64 (`bar-kjop`, `outline-velg`). The SDK's own buttons send none |
603
+ | `option_value` | the option value chosen, ≤ 64 (`size`: `M`, `42`) |
604
+ | `product_id` | the product (string) |
605
+ | `product_variant_id` | the **product** variant, when known (every option chosen, or a single variant) |
606
+ | `layout_id` · `layout_revision` · `experiment_id` · `variant_id` | the `<vio-product-detail>` layout shown — only a non-default one, as on `view_item`. **`variant_id` is the layout's experiment variant**, never the product's: that one is `product_variant_id` |
607
+ | `component_template_id` | `product-detail` / `product-card` (or the carousel's) for the SDK's elements |
608
+
609
+ No PII: ids, the button's own text and the option value. With
610
+ `start({ privateContent: true })` `cta_label` and `option_value` stay on the device
611
+ too (they can name the product), with `content_url` / `content_title` /
612
+ `content_id`; `cta`, `cta_location`, `cta_variant` and the ids still go. Without
613
+ consent (`requireConsent`) the event goes with the visit's ephemeral ids, as every
614
+ event. A browser marked as internal sends `client.internal: true`.
615
+
616
+ **The SDK's buttons.**
617
+
618
+ | element (`cta_location`) | `cta` ids |
619
+ |---|---|
620
+ | `<vio-product-detail>` (`detail`) | `vipps` (Kjøp nå med Vipps) · `apple_pay` · `stripe` · `klarna` · `buy_now` (Kjøp nå) · `add_to_cart` (Legg i handlekurv) · `size` (any option value chosen, with `option_value`) · `quantity_plus` · `quantity_minus` · `description_open` («Beskrivelse» / the text / «Les mer», when the tap opens it) · `shipping_returns_open` («Frakt & retur», when it opens) · `terms_link` (Kjøpsvilkår) · `refund_link` (Angrerett og retur) · `checkout` («Til kassen» in the added-to-cart toast) · `close` (×, the backdrop, the handle) · `gallery_swipe` (the first change of photo per open product: a swipe, an arrow or a thumbnail) |
621
+ | `<vio-cart>` (`cart`) | `checkout` (Til kassen) · `vipps` · `apple_pay` · `stripe` · `klarna` · `remove` · `quantity_plus` · `quantity_minus` · `close` |
622
+ | `<vio-product>` card (`card`) | `open` (a tap — or Enter — on the card or its image) · `add` (the bag or bar button) |
623
+ | `<vio-checkout>` (`checkout`) | `select_<method>` (a method of the list: `select_vipps`, `select_stripe`, `select_klarna`, `select_apple_pay`, `select_kustom`, `select_qliro`, `select_walley`, `select_nexi`, `select_adyen`) · `pay_<method>` (the pay button of the chosen method: `pay_vipps`, `pay_stripe`, `pay_klarna`, `pay_apple_pay`, `pay_adyen`, `pay_kustom`…) · `pay_stripe_confirm` («Betal» under Stripe's own payment form) · `close` (×, the backdrop, the handle, «Lukk» / «Fortsett å handle» on the receipt) |
624
+
625
+ A detail's buttons carry the open product (`product_id`, `product_variant_id`), its
626
+ sponsor, slot, campaign and article; a cart line's carry its product, variant,
627
+ sponsor and where its units came from; the cart's and the checkout's footer
628
+ buttons carry the sponsor they pay.
629
+
630
+ **The DOM event.** Each SDK button tap also dispatches **`vio:cta-click`**
631
+ (`bubbles`, `composed`) from the element, so a host can mirror it to its own
632
+ analytics. `detail` is the `Vio.trackCta` shape: `{ cta, location, label?,
633
+ optionValue?, productId?, productVariantId?, sponsorId?, campaignId?, slot?,
634
+ contentId?, contentTitle?, componentTemplateId?, layout? }`. React: `onCtaClick` on
635
+ `VioProduct`, `VioProductDetail`, `VioCart` and `VioCheckout`.
636
+
637
+ ```js
638
+ window.addEventListener('vio:cta-click', (e) => myAnalytics.track('button', e.detail))
639
+ ```
640
+
641
+ **A host's own buttons** (Replit's cards and article blocks):
642
+
643
+ ```js
644
+ Vio.trackCta({
645
+ cta: 'choose_size', // required: [a-z0-9_.:-], ≤ 64 — invalid → ignored, one console.warn
646
+ location: 'block', // 'host' (default) | 'card' | 'block' | … — unknown → 'host', warned
647
+ label: 'Velg størrelse', // the button's visible text
648
+ variant: 'outline-velg', // the button option you are testing — invalid → left out, warned
649
+ optionValue: undefined, // the value chosen, for `size`
650
+ productId: 408948,
651
+ productVariantId: undefined,
652
+ sponsorId: 4,
653
+ campaignId: 31, // else resolved from slot / sponsor, as every event
654
+ slot: 'article-12-block-1',
655
+ contentId: 'art-12',
656
+ layout: undefined, // { layoutId, layoutRevision, experimentId, variantId } when it is a detail layout
657
+ })
658
+ ```
659
+
660
+ It sends nothing before `Vio.analytics.start()` and never throws. It does not
661
+ dispatch `vio:cta-click` (the host already knows its own tap). Ids to use in the
662
+ blocks — the same as the SDK's where the button does the same thing:
663
+
664
+ | block button | `cta` |
665
+ |---|---|
666
+ | a size chosen | `size` (with `optionValue`) |
667
+ | add to the cart | `add_to_cart` |
668
+ | «Velg størrelse» — opens the detail to choose | `choose_size` |
669
+ | «Produktbeskrivelse» / «Vis mer» | `description_open` |
670
+ | Vipps directly | `vipps` |
671
+ | the image or the title (opens the detail) | `open` |
672
+
673
+ Name the button option you are testing with `variant` (`bar-kjop` vs
674
+ `outline-velg`) and keep `cta` the same for buttons that do the same thing: the
675
+ dashboard groups by `cta` and splits by `cta_variant` / `cta_label`.
676
+
580
677
  ## Sponsor identity — name and logo
581
678
 
582
679
  The elements say **who sells**: the sponsor's (brand's) display name and logo.