Widget reference

Developer docs: all pages

Start

Help and docs

Changes

Use the saved embed from Install. The page supplies only the product or location keys it needs. An omitted type defaults to where-to-buy; an empty, unknown or retired type renders nothing.

<script
    src="https://cdn.test.stockisto.com/widget.js"
    data-api-base="https://api.test.stockisto.com"
    data-embed="we_0123456789abcdef0123456789abcdef"
    data-sku="7130171"
    async
></script>

01The eight widgets

WidgetPlacementKeysWidget page
where-to-buyA brand product page; shops near the shopperdata-embed, data-skuWhere to buy
guided-handoffA brand product page; retailer and installer handoffdata-embedInstaller finder
store-locatorA brand page; network map or listdata-embedStore locator
installer-finderA brand page; approved installersdata-embedInstaller finder
store-availabilityA retailer product page; stock by branchdata-stockisto-slug, data-retailer, data-skuStore availability
store-cardA store page; address, hours, brands and ratingdata-store-id, data-retailerStore card
installer-cardAn installer site; credential and coveragedata-installer, data-stockisto-slugInstaller card
stock-alertA retailer product page; back-in-stock emaildata-stockisto-slug, data-store-id, data-skuStock alert
AttributeValues or default
data-widget-typewhere-to-buy, guided-handoff, store-locator, installer-finder, store-availability, store-card, installer-card, stock-alert, (where-to-buy)
data-viewfull, inline, button, pill, corner, map, list, (full)

02Products

One product code, up to 100 characters. An unknown code shows a not-found state, never brand-wide results. data-skus takes up to 6 comma-separated codes.

AttributeWhat it does
data-sku-typeThe kind of code in data-sku. rsk, gtin, enummer, mpn, sku, vvs, nrf, lvi, retailer_sku, nobb, finfo, efo, elnummer_dk, sahkonumero, tun, ean
data-skuOne product code, up to 100 characters.
data-skus-typeThe kind of code in data-skus. rsk, gtin, enummer, mpn, sku, vvs, nrf, lvi, retailer_sku, nobb, finfo, efo, elnummer_dk, sahkonumero, tun, ean
data-skusUp to 6 comma-separated product codes.

03Location and list

A fixed data-lat and data-lng search centre prevents a browser location prompt. data-radius is in kilometres. data-per-view controls rows in the inline view.

AttributeDefaultWhat it does
data-latFixed search latitude. -90–90
data-lngFixed search longitude. -180–180
data-radius50Search radius in kilometres. >= 0
data-filterFilter stock or retailer status. confirmed, showroom, authorized
data-rankstockOrder the results. stock, distance, price
data-channelallChoose the sales channel. all, near, online
data-pricesretailerChoose which prices to show. retailer, online, msrp, off
data-audienceconsumerChoose the customer audience. consumer, trade
data-quantityRequired quantity. 1–9007199254740991
data-reservefalseEnable reservations.
data-guidedfalseEnable guided questions.
data-per-view3Rows before showing all. 1–12
data-jsonldonInclude structured data. on, off
data-map-height480Map frame height in pixels. 320–800

04Styling

data-theme and the colour overrides take hex colours. data-width accepts full or 200 to 2000 pixels. The browser supplies the font; no web font is loaded.

AttributeValues or default
data-theme-presetlight, heritage, dark, blue, copper, fjord, oak, signal, graphite, (heritage)
data-radius-scalesm, md, lg, (md)
data-densityspacious, cozy, compact, dense, (cozy)
data-shadowsoft, flat, none, (soft)
data-fontgrotesk, sans, serif, mono, system, (grotesk)
data-theme(#1e5e45)
data-theme-accent2Second accent, hex colour.
data-theme-surfaceCard surface, hex colour.
data-theme-inkText colour, hex colour.
data-widthFull width or 200 to 2000 pixels.

05Language and consent

AttributeValues or default
data-analytics-consentOnly the literal true sends analytics. Leave it off until consent is given.
data-langen, sv, nb, da, fi, (en)

Without data-lang, the widget follows the page language, then the browser, then English. Only the literal true in data-analytics-consent enables analytics.

06Content Security Policy

CSPTESTFor
script-srchttps://cdn.test.stockisto.comEvery widget
connect-srchttps://api.test.stockisto.comEvery widget
style-src'unsafe-inline'Every widget
img-srchttps://api.test.stockisto.comEvery widget
frame-srchttps://find.test.stockisto.comStore locator and installer finder

07Boot errors

data-stockisto-errorWhat to check
unknown-widget-typedata-widget-type
embed-unavailabledata-embed, data-api-base
missing-data-sourcedata-embed, data-stockisto-slug
unknown-brand-slugdata-stockisto-slug
pill-target-locator-without-brand-slugdata-stockisto-slug

08Analytics events

With consent, the widget posts events to /api/v1/analytics/events without credentials. The API answers 202. Account attribution requires the page’s domain in Allowed origins.

Seller action events

The event is retailer_cta_click, with widgetEvent cta_click and ctaType call, directions or website.

A quote link that opens a phone number or a website counts as a call or website action.

09Install from npm

Not live yet. The local package is version 2.10.4 with ESM, CommonJS and TypeScript types. npm installation is unavailable until publication is verified. Use the script tag above.

import {
    readConfig,
    fetchRetailers,
    mountStoreListWidget,
} from "@stockisto/widget";

const script = document.createElement("script");
script.dataset.apiBase = "https://api.test.stockisto.com";
script.dataset.stockistoSlug = "your-brand-slug";
script.dataset.sku = "7130171";
const config = readConfig(script);
const { rows } = await fetchRetailers(config, new AbortController().signal);
const container = document.getElementById("where-to-buy");
if (container) mountStoreListWidget(container, rows, config);
Widgetnpm
where-to-buymountStoreListWidget, mountPdpWidget, mountWhereToBuyButton, mountPillWidget, mountCornerWidget
store-locatormountStoreLocatorWidget(container, config)
installer-findermountInstallerFinderWidget
store-availabilitymountStoreAvailabilityWidget(container, config, rows)
store-cardmountStoreCardWidget, storeCardParts
installer-cardmountInstallerCardWidget
guided-handoffrenderGuidedHandoff