Declarative HTML integration Copy page Copy link View Markdown Use markup when you want the SDK to fill and track recommendation cards. For module initialization with HTML templates, see minimum initialization. For other integration methods, return to the SDK overview. Show your first recommendation card This is the shortest development path to see the SDK working in a browser. It is not the recommended production rollout order. For production onboarding, keep item integration separate and bring page/business event tracking live before recommendation placements. See Recommended rollout order. Use a development environment with a synchronized catalog and a configured recommendation list. Configure environment and page visit. Add one recommendation placeholder with field mappings. Connect your consent manager before testing event tracking. Apply the visitor’s existing decision before initialization and forward later changes. Verify the request to /recommendations/requests in the browser’s Network panel. If the placeholder is not filled, check the group, list policy, and returned items in SDK diagnostics. By default, the customer group keeps the original markup. The snippets below show the script and one card together. Use the environment and list name agreed with Froomle. <script defer src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@latest/dist/froomle.global.js" data-froomle-env="your_env" data-froomle-page-visit="home" ></script> <article class="reco-card" data-froomle-reco="recommended_for_you"> <a data-froomle-param-href="uri" href="#"> <img data-froomle-param-src="images[0]" data-froomle-param-alt="title" alt="" /> <h3 data-froomle-param-inner="title">Loading recommendation...</h3> </a> </article> If these four steps work, the rest of the SDK features are incremental extensions (filters, context item, histories, ordering, programmatic calls, React helpers). Once you want a full runnable project instead of the minimal first integration, use frontend-sdk-examples. Install and Run Script-Tag Setup (No Build Tool) Recommended starter (default defer mode): <script defer src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@latest/dist/froomle.global.js" data-froomle-env="your_env" data-froomle-page-visit="home" ></script> Use froomle:before-init for settings that must be present on the first recommendation request. Connect your consent manager to apply the visitor’s choice and forward changes. Need a runnable example instead of the minimal snippet above? Use frontend-sdk-examples and start with the plain HTML examples. Script Loading and Initialization Modes (Global Script Tag) Use defer unless your site needs a different loading order. This section applies to global/script-tag usage (froomle.global.js). For React and other module/import integrations, use module setup (setEnvironment, setPageVisit, setConsent) and ignore script loading modes. The browser reads your HTML to build the page. These options tell it when to download and run the SDK. They do not change how Froomle fetches recommendations or tracks events. Mode What the browser does When to use it defer (default) Downloads the SDK while reading the HTML, then runs it after the HTML has been read. Most websites and CMS templates. Other deferred scripts run in the order they appear in the HTML. Blocking (no defer or async) Pauses reading the HTML until the SDK has downloaded and run. Older pages where the next script needs the SDK to have run before it can continue. async Downloads the SDK while reading the HTML and runs it as soon as it arrives, even if the browser is still reading. Pages that do not depend on the SDK running before or after other scripts. Event-Driven Hook Pattern For complex pages with multiple modules or microfrontends, use the SDK’s hook pattern on top of one of the real script loading modes above, typically defer or async: froomle:before-init: pre-init settings that must affect the first automatic request. froomle:init: post-init orchestration once initialization completes. window.FroomleFrontendSdkReady: sticky fallback for late-loaded consumers. This is an orchestration pattern, not a separate browser loading mode. Runtime diagnostics therefore keep reporting the underlying browser/script mode in diagnostics.lifecycle.inferredLoadingMode. Hook Timing and Responsibilities froomle:before-init: pre-init hook, fired before DOM init and before the first recommendation request. froomle:init: post-init hook, fired once when SDK initialization completes. window.FroomleFrontendSdkReady: sticky readiness promise for consumers that may attach after events already fired. When to use each hook: Use froomle:before-init for settings that must be included in the first request: consent, external benchmark assignment, custom variables, histories, dynamic channel, runtime identity, or recommendation auth. Register the listener before inserting the SDK tag. To wait for an external assignment, call setCurrentGroup(groupPromise) inside the listener rather than awaiting the promise before calling the setter. Register a froomle:init listener before the SDK tag for code that needs initialization to be complete. See the event-driven example below. If your code runs after the SDK script has loaded, use window.FroomleFrontendSdkReady to wait for initialization, even if the event has already fired. An inline script immediately after a defer or async tag does not wait for that tag to load. init(), froomle:init, and window.FroomleFrontendSdkReady indicate SDK readiness, not that recommendations are available. The SDK can be ready even when a recommendation request fails. An invalid external assignment prevents initialization from completing. Settings Matrix (Script-Tag Mode) Use this matrix as the canonical checklist for what to configure where. This matrix is only for script-tag/global integrations (froomle.global.js). React/module-import integrations do not use these hooks. Setting Script tag attribute? Must be set before first request? Recommended place and usage environment (setEnvironment) Yes: data-froomle-env Yes (required) Put on SDK <script> tag. page_visit (setPageVisit) Yes: data-froomle-page-visit Yes (required) Put on SDK <script> tag. Benchmark configuration (configureBenchmark) Yes: data-froomle-benchmark-allowed-groups, data-froomle-benchmark-show-froomle-for Only when overriding the defaults; configure before initialization Use the SDK script tag for fixed settings or the pre-init hook for runtime settings. See Benchmark configuration. External assignment (setCurrentGroup) Yes: data-froomle-benchmark-current-group Yes, only if your system assigns the visitor Set a known group on the SDK script tag, or register the group or promise during froomle:before-init. request_domain (setRequestDomain) Yes: data-froomle-request-domain Yes (if custom domain is needed) Use script tag for fixed value; use froomle:before-init if runtime-derived. safe_request (setSafeRequest) Yes: data-froomle-safe-request Yes (if changed from default) Use script tag for fixed value; use froomle:before-init for runtime decisions. recommendation bearer (setRecommendationsBearer) No Yes (if the first recommendation request requires auth) Set in froomle:before-init when your backend already rendered a short-lived token into the page. recommendation bearer provider (setRecommendationsBearerProvider) No Yes (if the first recommendation request requires auth) Set in froomle:before-init when the browser should fetch or refresh a token from your backend. context_item / context_item_type Yes: data-froomle-context-item, data-froomle-context-item-type Yes (on detail pages) Use script tag for fixed detail pages, or set in froomle:before-init. user_id (setUserId) Yes: data-froomle-user-id Yes (if first request must be identified) Fixed value: script tag. Runtime value (cookie/session): froomle:before-init. device_id (setDeviceId) Yes: data-froomle-device-id Only if supplying your own ID for the first request Leave unset for an SDK-managed ID. See Identity. channel (setChannel) Yes: data-froomle-channel Yes (if channel affects first request) Fixed channel: script tag. Dynamic channel (viewport/device): froomle:before-init. site_context (setSiteContext) Yes: data-froomle-site-context Only if overriding the default before the first emitted event Defaults to window.location.hostname in browser integrations. Use the script tag or froomle:before-init to override the effective analytics site/subdomain; use setSiteContext("") in froomle:before-init to clear it before automatic events. Sent on Events API payloads, not recommendation requests. subscription_level (setSubscriptionLevel) Yes: data-froomle-subscription-level Yes (if first emitted event must carry it) Fixed visitor entitlement: script tag. Runtime-derived login/subscription state: froomle:before-init. Accepted values: NONE, REGISTERED, TRIAL, SUBSCRIPTION. Sent on Events API payloads, not recommendation requests. utm_tracking (setUtmTrackingEnabled) Yes: data-froomle-utm-tracking="false" Only if disabling URL UTM enrichment before the first emitted event Enabled by default in browser integrations. Reads standard UTM parameters from the current URL at event-send time. Sent on Events API payloads, not recommendation requests. Explicit event fields still win. referrer_tracking (setReferrerTrackingEnabled) Yes: data-froomle-referrer-tracking="false" Only if disabling browser referrer enrichment before the first emitted event Enabled by default in browser integrations. Reads window.location.href with the URL fragment removed and document.referrer, sends page_url, referrer_url, referrer_type, referrer_origin, and referrer_domain on Events API payloads, not recommendation requests. Explicit event fields still win. referrer_url is only as complete as the browser exposes through document.referrer. consent (setFroomleConsent / sdk.setConsent) Yes: data-froomle-consent (startup fallback) Set a known choice before the first request; otherwise the SDK uses its startup precedence Apply the CMP choice in froomle:before-init and forward later updates with the setter. See Consent. custom variables (setCustomVariable) No Yes, if variable must affect first request First-request variables: froomle:before-init. Late/non-critical variables: froomle:init or window.FroomleFrontendSdkReady. histories (addHistories) No Yes, if histories must influence first request Set in froomle:before-init. Post-init orchestration (non-settings) N/A No Register a froomle:init listener before the SDK tag, or use window.FroomleFrontendSdkReady after the script has loaded. defer (default) <script defer src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@latest/dist/froomle.global.js" data-froomle-env="your_env" data-froomle-page-visit="home" ></script> blocking (legacy compatibility) <script src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@latest/dist/froomle.global.js" data-froomle-env="your_env" data-froomle-page-visit="home" ></script> async (supported with readiness gating) <script async src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@latest/dist/froomle.global.js" data-froomle-env="your_env" data-froomle-page-visit="home" ></script> Event-driven Add only the listeners you need, before the SDK tag. The same listeners work with defer or async. <script> window.addEventListener('froomle:before-init', ({ detail: { sdk } }) => { sdk.setCustomVariable('section', 'homepage') }, { once: true }) window.addEventListener('froomle:init', ({ detail: { sdk } }) => { // Use the initialized SDK here. }, { once: true }) </script> <script defer src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@latest/dist/froomle.global.js" data-froomle-env="your_env" data-froomle-page-visit="home" ></script> froomle:before-init and froomle:init event payload: Field Meaning event.detail.sdk SDK API object available at init time. event.detail.mode Init trigger mode: auto or manual. event.detail.version SDK version string when available. mode values: auto: the SDK started itself during script evaluation (standard behavior in script-tag usage). manual: the SDK was started via init(). In normal script-tag integrations, you will usually see mode=auto. Recommendations in Markup Recommendation Placeholder data-froomle-reco marks a recommendation template. Each placeholder card usually maps fields with data-froomle-param-<target>. How binding works: SDK requests items for each list. The list policy selects original content or Froomle recommendations. If the slot receives a recommendation, data-froomle-param-<target> maps its fields into DOM attributes and text. If the list selects original content, the SDK keeps the existing card. The SDK registers eligible displayed items for recommendation tracking. Original cards need their own item identity. See Declarative list policy and original-card identity. <article class="reco-card" data-froomle-reco="recommended_for_you"> <a data-froomle-param-href="uri" href="#"> <img data-froomle-param-src="images[0]" data-froomle-param-alt="title" alt="" /> <h3 data-froomle-param-inner="title">Loading recommendation...</h3> </a> </article> Use multiple placeholder blocks to control count (for example, 12 placeholders ⇒ up to 12 returned items). This is a slot-based model: one placeholder represents one rendered recommendation item. When multiple placeholders target the same list with compatible configuration, the SDK batches them into a backend list request automatically. Brightspot CMS In Brightspot, use the server-rendered DOM integration when recommendation placements are rendered by Styleguide Handlebars templates. The integration has two separate layers: A page-level SDK bootstrap is included once by the page shell. It supplies the environment, page type, channel, consent, identity, subscription state, and optional context item. A reusable recommendation module renders one or more data-froomle-reco placeholders. It supplies its list name, allowed list variables, response-field mappings, and slot count. The native Brightspot flow is: An editor configures a shared or inline recommendation module. A Java ViewModel maps the CMS model to a Viewgen-generated view contract. A Handlebars template renders ordinary server-side HTML placeholders. The browser SDK requests recommendations and fills the marked title, image, and link fields. The SDK attaches recommendation identity and owns visibility-based impression and click tracking for the populated cards. Recommended Brightspot integration: Keep page context in the page ViewModel and include the SDK bootstrap once, before recommendation placements initialize. Keep placement configuration in a reusable module model and ViewModel. Do not make each page template implement its own recommendation request. Register both shared and inline module variants when editors need reusable site-wide blocks as well as page-local placements. Allowlist contracted list names and list-variable names in application code. Do not expose arbitrary API field names or response mappings as free-form CMS fields. Let the Java layer produce template data. The Java ViewModel must not call the Recommendations API or rewrite the full page response. Load the script-tag SDK and use its DOM mode; Brightspot does not need a React wrapper for server-rendered Handlebars placements. Forward every later CMP grant, downgrade, or withdrawal with window.FroomleFrontendSdk.setConsent(…). Page context and placement configuration remain independent, so the same module can be used across page types: Page Page-level state Recommendation module Article page Set the contracted article page type and the current article’s canonical catalog ID and item type. Use the same reusable module; the request can use the article as context. Homepage Set the contracted homepage page type and omit the context item. Use the same reusable module without inventing a context item. Section or other page Set the contracted page type. Include context only when the page represents one synchronized catalog item. Use the same module in any registered Brightspot page or container field. On article pages, prefer the canonical catalog ID exported by the page ViewModel. A Brightspot integration can use the page’s brightspot.contentId meta value as a fallback only when that value is also the identifier synchronized to Froomle. The page shell can pass its ViewModel values to a shared bootstrap partial: {{include "/froomle/FroomleSdkBootstrap.hbs" environment=froomleEnvironment pageVisit=froomlePageVisit channel=froomleChannel userId=froomleUserId contextItem=froomleContextItem contextItemType=froomleContextItemType subscriptionLevel=froomleSubscriptionLevel consentLevel=froomleConsentLevel}} The recommendation ViewModel exports placement values such as listName, listVariables, response mappings, and slots. The Handlebars component turns those values into SDK attributes: {{#each slots}} <article data-froomle-reco="{{../listName}}" {{~#each ../listVariables}} data-froomle-variable-{{name}}="{{value}}"{{/each}} {{~#with control}} data-froomle-id="{{itemId}}" data-froomle-item-type="{{itemType}}"{{/with}}> <a href="#" data-froomle-param-href="{{../uriField}}"> <img data-froomle-param-src="{{../imageField}}" data-froomle-param-alt="{{../titleField}}" alt=""> <span data-froomle-param-inner="{{../titleField}}"> Loading recommendation... </span> </a> </article> {{/each}} For an editorial control-versus-treatment benchmark, render the editor-selected control cards inside the same placeholders and identify each control item with data-froomle-id and data-froomle-item-type. The default list policy works without extra configuration: On the control branch, the SDK preserves the editor’s title, image, link, and item identity. On the treatment branch, the SDK replaces the marked fields with the returned recommendation and attaches Froomle attribution. Assignment is not an editor field. If the customer owns experimentation, resolve the group from the application’s experiment service and register it once at SDK startup. See Benchmarking and A/B Testing with the SDK. Use frontend-sdk-examples as a starting point. The brightspot example contains the Java CMS model, shared and inline module placements, ViewModel, Viewgen contract, Handlebars templates, styles, page bootstrap, article and homepage previews, and deterministic control and treatment previews. The example’s public Brightspot training project proves the component contract against its pinned reference version. Compile and validate the component in the customer’s authorized Brightspot project before production acceptance because private content models, module groups, theme structure, CMP wiring, and Brightspot versions can differ. Dynamic Injection and Refill The SDK observes DOM mutations after initial load when declarative DOM mode is active. This applies to: script-tag/global usage (froomle.global.js) module/import placeholder usage after explicit init() It does not apply to React bindings by default. Raw declarative data-froomle-… blocks injected onto a React page stay idle unless you explicitly start DOM placeholder mode yourself. Add or update slots Insert a new slot. The SDK can fill new data-froomle-reco placeholders after page load. An item ID on an original CMS card can identify the card if the SDK keeps it; do not copy old request metadata into new slots. Change the query on the same slot. Change a filter such as data-froomle-reco-filter-topic or a custom variable such as data-froomle-variable-section without changing the list or its content policy. The last displayed card stays visible and eligible for tracking against its own request until the new result is applied. If the request fails, that card stays. A successful empty Froomle result leaves the slot empty. Replace or reset a slot. For a new list or template, prefer inserting fresh markup. To deliberately reuse a previously SDK-filled slot, set its intended list and query and remove both data-froomle-id and data-froomle-request-id. The old card stops tracking and the SDK refills the slot. Changing the list name alone is not a reset, and resetting a slot does not let you change a list’s locked content policy. The same-slot query refresh does not change how the SDK handles consent or identity changes. Forward consent through the consent API and let the SDK manage the update. Load More and Infinite Scroll Add data-froomle-reco-feed to the section that holds the cards. Keep the list name, filters, variables, and field mappings on the individual data-froomle-reco slots. Append each load of new slots together after initialization. The closest marked ancestor determines the feed, so a nested marked feed is separate from the outer one. A load can send multiple list rows in one request: slots with different list names or query settings keep their own rows. Outside a marked feed, separately inserted nodes are processed independently; an inserted wrapper can batch the slots inside it. Loads within the same feed wait for the preceding load. When the next request is prepared, the SDK excludes filled cards that still belong to that feed, using their item IDs and types. It merges them with configured exclusions. A removed card no longer contributes a feed exclusion; another feed has its own feed exclusions. Page-wide exclusion rules can still collect items across feeds. This Load More example clones four slots into a fragment and inserts them together. Include the markup and listener on the page before the SDK initializes. <section id="recommendations" data-froomle-reco-feed></section> <button id="load-more" type="button" disabled>Load more</button> <template id="recommendation-card"> <article data-froomle-reco="recommended_for_you"> <a data-froomle-param-href="uri" data-froomle-param-inner="title"></a> </article> </template> <script> const feed = document.getElementById("recommendations") const card = document.getElementById("recommendation-card") const loadMore = document.getElementById("load-more") function appendNextBatch() { const batch = document.createDocumentFragment() for (let index = 0; index < 4; index += 1) { batch.append(card.content.cloneNode(true)) } feed.append(batch) } window.addEventListener("froomle:init", () => { appendNextBatch() loadMore.addEventListener("click", appendNextBatch) loadMore.disabled = false }, { once: true }) </script> CMS Load More. If your CMS already returns the next page of markup, append its recommendation slots to the marked section in one operation. See the Brightspot example. Infinite scroll. Call the same append function when a sentinel enters the viewport. The recommendation feed example implements both triggers. The page decides when to load more, when to stop, and how to display loading and empty states. A response may fill fewer slots than requested. Each load requests fresh recommendations with exclusions; it does not fetch another page of a saved ranking. Use programmatic pagination if your application needs a fixed ranking with page or rank controls. When switching topics for the whole feed, replace the old cards with new placeholders if the previous topic should no longer be shown or contribute feed exclusions. Recommendation Parameters: data-froomle-param-<target> Replace <target> with the field to update on the element, such as href, or use inner for its content. Common mappings: data-froomle-param-href="uri" data-froomle-param-src="images[0]" data-froomle-param-alt="title" data-froomle-param-inner="title" Nested fields are supported, for example: <span data-froomle-param-inner="item_attributes.fq_item_id"></span> Expression mode is also supported by prefixing with =: data-froomle-param-src="=photoUrl | replace('X,','NWB,') | replace('X.','NWB.')" data-froomle-param-href="=uri | append('?from=reco')" data-froomle-param-inner="=item_attributes.category_label | defaultField(item_attributes.main_tag) | default('No category')" data-froomle-param-href="=item_attributes.category_url | defaultField(item_attributes.main_tag_link) | default('#')" For composed values (for example srcset), use template placeholders: data-froomle-param-srcset="\${photoUrl | replace('X,','NWB,')}, \${photoUrl | replace('X,','NWBR,')} 2x" Scope: This transform syntax is for declarative HTML mapping (data-froomle-param-<target>). It is not executed inside framework prop systems (React/Vue directives). In React, apply transforms in your component code and render final values in JSX. Supported transforms: replace(from, to) prepend(value) append(value) default(value) (used when current value is empty) defaultField(other.path) (used when current value is empty and you want to fall back to another recommendation field, for example during schema migrations or field renames) trim lower upper urlencode What is supported: Field access (including nested paths) Transform chains with the supported transform set Template interpolation with \${…} for composed attributes (srcset, combined labels, etc.) Rename-migration fallback patterns such as category_label → main_tag while old and new fields coexist What is not supported: Running custom code from attribute strings if/else, loops, or arbitrary scripting in markup Arbitrary transform arguments that execute as nested expressions Regex/backreference syntax in transforms Filters and Variables Use list-level filters and variables in markup: data-froomle-reco-filter-<field>: list filters (sent as arrays by SDK for HTML usage) data-froomle-variable-<key>: list variables The suffix in data-froomle-reco-filter-<field> is the request-list field sent to the Recommendations API. The standard filterable item metadata fields are item_type, categories, tags, access_type, and flags. Use the not_ prefix for inverse filters such as not_flags or not_access_type. The request filter key must match the filterable item metadata field unless Froomle has explicitly configured a backend mapping. If the names differ, ask Froomle to configure and confirm that mapping before using the request key. Custom filter fields based on specific item_attributes keys must also be configured by Froomle before use. The SDK passes those fields through unchanged. <article data-froomle-reco="sample_list_name" data-froomle-reco-filter-item_type="article" data-froomle-reco-filter-categories='["News","Sports"]' data-froomle-reco-filter-tags="featured" data-froomle-reco-filter-access_type="PAID" data-froomle-reco-filter-flags='["breaking","editorial"]' data-froomle-reco-filter-not_flags="sponsored" data-froomle-reco-filter-race_types="MotoGP" data-froomle-variable-slot="1" > <h3 data-froomle-param-inner="title"></h3> </article> How HTML values are converted: data-froomle-reco-filter-<field> a single value such as MotoGP becomes ["MotoGP"] data-froomle-reco-filter-<field> a semicolon-separated value such as Monde;Sports becomes ["Monde", "Sports"] data-froomle-reco-filter-<field> a JSON array string such as ["Monde","Sports"] becomes ["Monde", "Sports"] data-froomle-variable-<key> a single value such as homepage stays scalar data-froomle-variable-<key> a semicolon-separated value becomes an array data-froomle-variable-<key> a JSON array string becomes an array Filter-key contract: This contract applies to programmatic getRecommendations(…), smartSort(…), proxyReco(…), React recommendation hooks, and declarative HTML filters. For JS/TS/React, prefer filter maps for hand-written code: filters: { categories: ['Monde', 'Sports'], flags: ['breaking'], not_flags: ['sponsored'], race_types: ['MotoGP'] }. The SDK flattens map entries onto the outgoing request list, for example "categories": ["Monde", "Sports"]. Tuple filters are also stable and not deprecated. They are useful for generated/dynamic filters. For JS/TS/React filter tuples, repeated filter keys merge into arrays in order. Example: [{ key: "categories", value: "Monde" }, { key: "categories", value: "Sports" }] becomes "categories": ["Monde", "Sports"]. In plain HTML, duplicate attribute names are not a supported way to express that. Use one attribute whose value is already multi-valued, for example Monde;Sports or ["Monde","Sports"]. Using Runtime Context to Drive Item Metadata Filters Recommendation filters constrain eligible items through synchronized item metadata. The recommendation request supplies a filter key and its current value, and the Froomle backend applies the configured matching rule to the corresponding item metadata field. The request filter key must match that filterable item metadata field unless Froomle has explicitly configured a backend mapping. If the names differ, ask Froomle to configure and confirm the mapping before integration; an unmapped request key does not filter the intended metadata. See Filters and Constraints and Item Synchronization Options. Runtime event context is a separate contract. As described in Shared Runtime State vs Recommendation Block Configuration, setSiteContext(…) and setSubscriptionLevel(…) configure event context. The SDK does not automatically copy those values into recommendation requests. When the same application state must constrain recommendation eligibility, translate it into explicit list-level filters: A site_context request filter should use a synchronized, filterable site_context field in item metadata and the same value vocabulary. If the catalog instead uses a differently named site, brand, or publication field, ask Froomle to configure the mapping before using site_context as the request key. subscription_level describes the visitor (NONE, REGISTERED, TRIAL, or SUBSCRIPTION), while item access_type describes the content restriction. Derive the allowed access_type values from the visitor state in the application or through an agreed backend rule; do not assume that setting subscription_level filters items automatically. For example, a subscribed visitor on specific.example.com might request items using the following filters, provided site_context is available for filtering as an item metadata field under that same name. If the item metadata field uses another name, Froomle must configure the mapping first. const filters = { site_context: 'specific.example.com', access_type: ['FREE', 'PAID'] } The equivalent declarative markup is: <article data-froomle-reco="recommended_for_you" data-froomle-reco-filter-site_context="specific.example.com" data-froomle-reco-filter-access_type='["FREE","PAID"]' > ... </article> Filter keys, value mappings, and allowed values are part of the module’s backend configuration. A custom subscription_level request filter is also possible when explicitly configured, but it is not a standard substitute for item access_type. Setting runtime context alone never activates recommendation filtering. Map form example: const filters = { categories: ['Monde', 'Sports'], flags: ['breaking'], not_flags: ['sponsored'] } Tuple form example with the same outgoing filter shape: const filters = [ { key: 'categories', value: 'Monde' }, { key: 'categories', value: 'Sports' }, { key: 'flags', value: 'breaking' }, { key: 'not_flags', value: 'sponsored' } ] Custom variable contract: Custom variables do not auto-merge on repeated setter calls. setCustomVariable('campaign_id', 'spring') followed by setCustomVariable('campaign_id', 'summer') sends "campaign_id": "summer". If a custom variable is intentionally multi-valued, pass the array explicitly in one value, for example setCustomVariable('access_types', ['FREE', 'PAID']). Example request shapes: { "lists": [ { "list_name": "recommended_for_you", "categories": ["Monde"], "slot": "homepage" }, { "list_name": "recommended_for_you", "categories": ["Monde", "Sports"], "access_type": ["FREE", "PAID"], "flags": ["breaking", "editorial"], "not_flags": ["sponsored"] } ] } List merging behavior: Blocks with same list_name, same filters, and same list variables can be merged into one request. Add a differentiator such as data-froomle-variable-slot to keep blocks separate. Request-root variables must be set in JS/TS, not via markup: import { setCustomVariable } from '@froomle/frontend-sdk' setCustomVariable('section', '12345') Type note: setCustomVariable is typed as setCustomVariable(key: string, value: unknown). Use application-side narrowing when you read values back in your own code. Exclusions from HTML markup In DOM/script-tag mode, mark items that are already visible on the page and opt in on the SDK script tag: <article data-froomle-id="already-visible-article" data-froomle-item-type="article"> ... </article> <script src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@latest/dist/froomle.global.js" data-froomle-env="sample_env" data-froomle-page-visit="home" data-froomle-auto-exclude="page" ></script> Custom selector setup from script attributes: <article data-article-url="/news/articles/article-123?utm=frontpage"> ... </article> <script src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@latest/dist/froomle.global.js" data-froomle-env="sample_env" data-froomle-page-visit="home" data-froomle-auto-exclude="page" data-froomle-auto-exclude-selector="[data-article-url]" data-froomle-auto-exclude-id-attribute="data-article-url" data-froomle-auto-exclude-id-regex="articles/([^/?#]+)" data-froomle-auto-exclude-item-type="article" ></script> In DOM/script-tag mode, declarative data-froomle-reco placements still work normally. The SDK scans matching elements in the current page before preparing the recommendation request. Selector sources use visible elements by default. When processing specific SDK placements, the scan skips those placements by default; this is separate from collecting previously filled cards for a feed. Ordering Sections Use section ordering when you want to rank whole blocks by a field such as category. Use Smart Sort when you want to rank the actual articles or products in a candidate set. Ordering Container <div data-froomle-order-categories="recommended_for_you"> ... </div> categories is the field to order by; recommended_for_you is the recommendation list used for ordering. Use one ordering attribute per container, replacing <field> in data-froomle-order-<field> with the actual field name. Set data-froomle-reco-show-froomle-for on the container if this list needs a different content policy. The value "*" in that separate attribute means all allowed groups; it does not change the visitor’s assignment. Elements To Order Give each participating direct child a unique data-froomle-ordervalue. The service must return the exact string for the configured field: <div data-froomle-order-categories="recommended_for_you"> <section data-froomle-ordervalue="Sports">Sports block</section> <section data-froomle-ordervalue="Politique">Politics block</section> <section data-froomle-ordervalue="Monde">World block</section> </div> Customer experience: keep the original sections in their existing order. Froomle experience: place the returned sections in the returned order. Only those marked sections whose keys were returned remain; a successful empty result removes every marked section. Unmarked children are left in place. Failed or invalid result: keep the original sections. A returned key that cannot be matched to exactly one unused child is an invalid result, not a partial ordering. Ordering the sections does not register them as recommendations for tracking. SDK recommendation placements inside retained sections are handled separately. Script-tag Whitelist See Supported Inputs by Location for the script-tag bootstrap whitelist. You only need benchmark attributes to customize the default configuration, supply an external group, or configure selector fallback for original-card identity.