Skip to content
Widget Library

Config Schema

Every setting a recommendation widget accepts, and what each one does.

This page lists the settings of the recommendation widget. The source is src/contract/config.ts. Settings marked planned are in the schema but not yet drawn by the web widget.


  • The config carries data and settings only. No field holds HTML, CSS or JavaScript.
  • The config is versioned. A widget that does not know the schemaVersion draws nothing and reports UNSUPPORTED_SCHEMA.
  • Every value is drawn as text. See Security Model.

The config exists in two forms, each with its own schema. Both are generated from the same types, so they cannot drift.

Form Schema What it is Who uses it
Stored settings schema/recommendation-widget-settings.v1.schema.json What the panel saves for a campaign Sauron validates with it on write
Served payload schema/recommendation-widget-config.v1.schema.json What a widget is given to draw The server builds it for a response; the widget reads it

The served payload is the stored settings plus the response part: instanceId, actionId, interactionId and products. The server adds these four fields and changes no setting. Stored settings that carry one of them are refused, and so is a served payload that lacks one.

Every field on this page belongs to the stored settings unless it is marked response part.


Field Meaning
schemaVersion The version of this schema. Currently 1.
component 'recommendation'.
instanceId Response part. The campaign.
actionId Response part. Sent as interactionId with the impression.
interactionId Response part. Sent as interactionId with the widget view.
delivery 'render': the widget draws itself. 'data': the site draws it; see Data Only Delivery.

Field Meaning
title The default title.
titles Titles per language. See Languages and Texts.
titleLevel The level of the heading the title is drawn as, 2 to 6. 2 (an h2) when not set. Chosen to fit the headings of the page around the widget. Web only.
labels Default texts: addToBasket, addToFavorites, seeAll, and the texts for screen readers oldPrice, discount, rating.
seeAll.url Optional. An https URL; draws a link in the header whose text is labels.seeAll (“See all” when not set). A tap sends no event.
labelsByLanguage Those texts per language.
products Response part. The products to show, already chosen and ordered by the server.

A product has typed core fields and may carry any number of account-specific fields.

Core field Notes
productId, name, url, image Required.
price, priceText Required. priceText arrives formatted; the widget does not format prices.
oldPrice, oldPriceText, brand Optional.
discount Optional. A percentage; drawn as -25% in English and -%25 in Turkish.
rating, reviewCount Optional. Drawn as 4.5 (120), or 4.5 without a review count; 4,5 (120) in Turkish. See Numbers.
badges Optional. The product’s own badge texts, drawn after the badges of the card when badge is among card.fields. At most two badges are drawn, one on a compact card. A long text is cut on the card; the whole text stays in the markup.

Fields the widget does not know are kept, never removed.

To show one on the card, add an entry to card.fields:

{ "path": "params.badgeLabel", "display": "badge" }
Rule Detail
path A dot path into the product. Only the product’s own properties are followed.
display 'text' or 'badge'.
Lists Each item of a list is drawn as its own element.
Not drawn A missing path, an empty value or an object.
Always text A value that contains HTML is shown as the characters it is made of.

A field with no data draws nothing and takes no space on the card. The same holds for brand, oldPrice, discount, rating and badge.

A badge is a part of the product card and is defined on the card, in card.badges. A badge is either a fixed text or the value of a field of the product.

"card": {
"badges": [
{ "value": "discount" },
{ "text": "Members only", "texts": { "TR": "Üyelere özel" }, "when": "params.memberOnly" },
{ "text": "Free returns", "texts": { "TR": "Ücretsiz iade" } }
]
}
Badge Fields Drawn
Fixed text text, optional texts by language (matched like titles) On every product.
Fixed text with a condition text, texts, when (a dot path into the product) Only on a product that has the field: a text that is not empty, a number other than zero, true, or a list with an entry.
Product value value (a dot path into the product) The field as text. discount and rating are written the way the language writes them (-25%, -%25). A list gives one badge per entry. Nothing for a product without the field, a discount of zero, true, false or an object.
Rule Detail
Order The badges of the card in their order, then the product’s own badges texts when badge is among card.fields.
How many Two on a standard card, one on a compact card; the rest is left out. At most four definitions.
Without badge in card.fields The badges of the card are still drawn; the product’s own are not.
Conditions Only “the product has this field”. There are no comparisons; a rule such as “more than 20% off” belongs in the product data, as a field of its own.
Always text A fixed text and a product value are both written as text, never as markup.
A badge is not both An entry with text and value together, or with neither, is not valid.

One optional strip between the header and the cards. This version knows one kind, the countdown.

"slot": {
"type": "countdown",
"endsAt": "2026-11-27T23:59:59+03:00",
"text": "Ends in",
"texts": { "TR": "Bitmesine kalan" }
}
Field Notes
type "countdown".
endsAt The moment the countdown ends: an ISO-8601 date and time with a time zone (Z or an offset). Without a zone a time means a different moment on every device, so it is refused.
text, texts Optional. The text before the time, by language, matched like titles.
Rule Detail
What is drawn The text and the time left as HH:MM:SS, in the digits of the context language, updated every second.
More than a day Written in hours (51:14:37), so the format needs no words.
At the end The slot removes itself. The widget stays, and nothing is sent.
Not drawn An end time that is over, one that cannot be read, or a slot of a kind this version does not know. The widget is drawn without it.
Clock The clock of the visitor’s device. A device with a wrong clock shows a wrong time left.
Colours countdownBackground and countdownColor; see Theming.

Web only.

Field Meaning
placement.selector The element on the page the widget is placed relative to.
placement.insert APPEND, PREPEND, BEFORE, AFTER or SELF (replace the element’s content).

Field Meaning
layout.type 'slider', 'grid', 'list' or 'compact'. See Layouts.
layout.breakpoints A list of { minWidth, columns, step, gap }.
layout.arrows Draw previous and next arrows on a slider.
layout.loop On a slider, a step past an edge goes to the other edge, and no arrow is ever disabled.
layout.pagination On a slider, draw one dot per page.

A breakpoint applies when the widget’s own width is at least minWidth pixels; the widest one that fits wins. columns is the number of cards visible in a row and may be fractional (1.5). step is the number of cards one arrow tap moves. gap is the space between cards in pixels.


Field Meaning
card.fields Which product fields are drawn, in this order.
card.addToBasket Draw an add-to-basket button, if the runtime can add to the basket.
card.addToFavorites Draw a favourite button, if the runtime has favourites.
card.openInNewTab Open the product in a new tab.
card.nameLines Maximum lines for the product name, 1 to 10. Longer names are cut with an ellipsis.

Field Meaning
rules.minProducts Minimum number of products per device. Below it the widget is not shown. Defaults to 1.
rules.devices The devices the widget is shown on. All when absent.

theme is the campaign’s own theme: a closed list of semantic and component tokens (colours, sizes, radii, a border, the font). It overrides, token by token, the theme set at initialisation and the site’s CSS; the tokens, their fallbacks and the layers are on the Theming page. There is no free CSS, and each value must have the form of its kind:

Kind Accepted
Colour Hex with 3, 4, 6 or 8 digits; rgb(), rgba(), hsl() or hsla() with three components and an optional alpha, separated by commas or by spaces (alpha after /); transparent, currentColor, inherit; or one of the 148 colour names of CSS in lower case (red, rebeccapurple). Up to 64 characters. No other word and no other function
Length A number with px, rem, em or %, or 0
Font family Families separated by commas. A family is a quoted name (letters, digits, spaces, hyphens, underscores; the quote is closed and holds no comma) or words separated by one space, each starting with a letter
Border none, 0, or a width in px, a style (solid, dashed, dotted) and a colour (hex, a colour name or a colour keyword)

Each token becomes a CSS custom property on the widget element (titleColor → --sgf-title-color). The widget checks every value again before applying it, with the same rules as the schema; a value that does not have the form of its kind is ignored and the rest of the theme still applies.

With an empty theme the widget still looks finished: it inherits the page’s font and text colour and uses neutral defaults for buttons, badges and arrows.

paginationColor and paginationActiveColor colour the pagination dots; they have no effect when layout.pagination is off.


The schema also limits values, so a config cannot carry something a setting was never meant to hold.

Value Rule
Product URL, image URL https only
Identifiers Letters, digits, _, ., :, -; at most 64 characters
Texts At most 300 characters; button texts at most 60
Placement selector At most 300 characters; no <, >, {, }
Custom field path Letters, digits and underscores, separated by dots
Products At most 100
Breakpoints 1 to 10; columns above 0 and at most 12
Unknown fields Rejected everywhere except on a product

The generated schemas are schema/recommendation-widget-settings.v1.schema.json (stored settings) and schema/recommendation-widget-config.v1.schema.json (served payload). See Security Model.


  • Events and Display Rules explains what the widget does with these settings.
  • A complete example config is in fixtures/valid/reco-basic.json.