{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/sdk/sidebars.yaml"},"props":{"codeGuideFiles":[],"dynamicMarkdocComponents":[],"metadata":{"type":"markdown"},"seo":{"title":"Affiliate Hydration","description":"Fluid is the open e-commerce platform built for direct-sales."},"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"affiliate-hydration"},"children":["Affiliate Hydration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Affiliate Hydration lets a single cached storefront page render for every visitor — attributed or anonymous — with affiliate-specific values (name, avatar, link URLs) filled in on the client by the FairShare SDK."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK ships custom elements, data attributes, and inline sentinels that the theme author uses in place of the server-rendered ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ affiliate.name }}"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ affiliate.avatar }}"]}," variables. The SDK swaps them at runtime with the resolved affiliate's values (or a fallback for anonymous visitors), and re-swaps them if the affiliate changes mid-session."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the storefront-theme migration guide, see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/themes/affiliate-hydration"},"children":["Affiliate Hydration Cheatsheet"]},"."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"whats-included"},"children":["What's Included"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Item"},"children":["Item"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#fluid-affiliate-fields"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-name>"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Element"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Renders the affiliate's full name"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#fluid-affiliate-fields"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-email>"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Element"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Renders the affiliate's email address"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#fluid-affiliate-fields"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-initials>"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Element"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Renders the affiliate's initials"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#fluid-affiliate-fields"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-avatar>"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Element"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Renders the affiliate's avatar URL as text"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#fluid-affiliate-fields"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-my-site-url>"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Element"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Renders the affiliate's MyHub URL as text"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#data-attributes"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-src"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Attribute"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fills the host element's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["src"]}," with an affiliate field"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#data-attributes"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-href"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Attribute"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fills the host element's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["href"]}," with an affiliate field"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#data-attributes"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-alt"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Attribute"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fills the host element's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["alt"]}," with an affiliate field"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#data-attributes"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Attribute"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fills the host element's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["textContent"]}," with an affiliate field"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#data-attributes"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-base-url"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Attribute"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Overrides the origin used to resolve ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my_site_url"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#visibility-toggles"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-show-if"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Attribute"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Reveals the element when the named field or affiliate is present"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#visibility-toggles"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-hide-if"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Attribute"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Hides the element when the named field or affiliate is present"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#sentinels"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["__fluid_affiliate_username__"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Sentinel"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Rep-username placeholder swapped in URLs and JSON literals"]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"benefits"},"children":["Benefits"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["One cached page per storefront"]}," — The rendered HTML is affiliate-independent, so a single CDN artifact serves every rep and every anonymous visitor"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Automatic swap"]}," — The SDK detects the elements and attributes on load and fills them with the resolved affiliate; no explicit initialize call"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Reactive to rep switches"]}," — When the visitor navigates from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/rep-a/"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/rep-b/"]},", the SDK re-swaps every managed value"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Anonymous fallback"]}," — Visitors without a rep prefix see fallback content (default text inside the element, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"home\""]}," for URL segments)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Framework-agnostic"]}," — Works with plain Liquid themes, Alpine.js components, Turbo/Barba SPAs, and any other client-side layer"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"quick-example"},"children":["Quick Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<!-- Text field: renders the affiliate's name, or \"our team\" for anonymous visitors -->\n<p>Shop with <fluid-affiliate-name>our team</fluid-affiliate-name></p>\n\n<!-- Attribute field: fills src + alt with affiliate values; hidden when there's no avatar -->\n<img\n  data-fluid-affiliate-src=\"avatar\"\n  data-fluid-affiliate-alt=\"name\"\n  data-fluid-affiliate-show-if=\"avatar\"\n  style=\"display:none\"\n/>\n\n<!-- URL sentinel: browser gets a real /rep-a/shop link after the SDK swaps -->\n<a href=\"/{{ username }}/shop\">Shop this rep</a>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"fluid-affiliate--fields"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-*>"]}," fields"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Custom elements that render an affiliate field's value as text content. The SDK creates them in the light DOM (no Shadow DOM), so surrounding theme styles apply normally."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"usage"},"children":["Usage"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<p>Hi, <fluid-affiliate-name>friend</fluid-affiliate-name></p>\n<span class=\"badge\"><fluid-affiliate-initials>FA</fluid-affiliate-initials></span>\n<a><fluid-affiliate-my-site-url>#</fluid-affiliate-my-site-url></a>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"elements"},"children":["Elements"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Element"},"children":["Element"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Fills with"},"children":["Fills with"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Fallback (anonymous)"},"children":["Fallback (anonymous)"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-name>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The affiliate's full name"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The content inside the tag"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-email>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The affiliate's email address"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The content inside the tag"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-initials>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The affiliate's initials"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The content inside the tag"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-avatar>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The avatar URL as text"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The content inside the tag"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-my-site-url>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The affiliate's MyHub URL as text"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The content inside the tag"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Put a sensible default inside the tag — that's what anonymous visitors see. For attributed visitors, the SDK replaces the tag's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["textContent"]}," with the resolved value."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"when-not-to-use"},"children":["When NOT to use"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For an attribute value (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["src"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["href"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["alt"]},"), a custom element can't help — HTML doesn't allow tags inside attribute values. Use a ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"#data-attributes"},"children":["data attribute"]}," instead."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"data-attributes"},"children":["Data attributes"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Markers on any element that tell the SDK to fill one of its HTML attributes (or its ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["textContent"]},") with an affiliate field. Use these for eagerly-fetched attributes (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["src"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["href"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["alt"]},") where a custom element can't sit inside the attribute value."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"usage-1"},"children":["Usage"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<img data-fluid-affiliate-src=\"avatar\" data-fluid-affiliate-alt=\"name\" />\n<a data-fluid-affiliate-href=\"my_site_url\">View store</a>\n<span data-fluid-affiliate=\"name\">friend</span>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"attributes"},"children":["Attributes"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Attribute"},"children":["Attribute"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Fills"},"children":["Fills"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Valid <field> values"},"children":["Valid ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<field>"]}," values"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-src=\"<field>\""]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["src"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["avatar"]}," (any URL field)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-href=\"<field>\""]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["href"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my_site_url"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["avatar"]}," (any URL field)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-alt=\"<field>\""]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["alt"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," (any text field)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate=\"<field>\""]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["textContent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Any field — same as using a custom element"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-base-url=\"<url>\""]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Override for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my_site_url"]}," origin"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An absolute URL (e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://staging.example.com"]},")"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<field>"]}," is one of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["email"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["avatar"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["initials"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my_site_url"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"data-fluid-affiliate-base-url"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-base-url"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["By default, the SDK resolves ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my_site_url"]}," against ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["window.location.origin"]},". Add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-base-url"]}," on the same element to override:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<!-- Default: uses the current page's origin -->\n<a data-fluid-affiliate-href=\"my_site_url\">View store</a>\n\n<!-- Explicit origin override -->\n<a\n  data-fluid-affiliate-href=\"my_site_url\"\n  data-fluid-affiliate-base-url=\"https://staging.example.com\"\n>View store</a>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Only affects ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my_site_url"]},"; other fields ignore this attribute."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"why-not-img-src-affiliate.avatar--"},"children":["Why not ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<img src=\"{{ affiliate.avatar }}\">"]},"?"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The browser fetches ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["src"]}," before the SDK runs. If you put a raw affiliate value or sentinel in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["src"]},", the browser makes a broken request to the placeholder URL before the SDK can swap. Always use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data-fluid-affiliate-src"]}," for eagerly-fetched attributes."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Lazy attributes (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<a href>"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<form action>"]},", text nodes) are safe to hold sentinels directly."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"visibility-toggles"},"children":["Visibility toggles"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Reveal or hide an element based on whether the SDK has resolved an affiliate — or a specific affiliate field. Handles anonymous vs. attributed rendering from one HTML source."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"usage-2"},"children":["Usage"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<!-- Show only when a rep is attributed -->\n<div data-fluid-affiliate-show-if=\"affiliate\" style=\"display:none\">\n  Hi, <fluid-affiliate-name></fluid-affiliate-name>\n</div>\n\n<!-- Show only when the rep has an avatar -->\n<img\n  data-fluid-affiliate-src=\"avatar\"\n  data-fluid-affiliate-show-if=\"avatar\"\n  style=\"display:none\"\n/>\n\n<!-- Show only for anonymous visitors -->\n<div data-fluid-affiliate-hide-if=\"affiliate\">\n  <a href=\"/join\">Become a rep</a>\n</div>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"tokens"},"children":["Tokens"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Token"},"children":["Token"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Element visible when"},"children":["Element visible when"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["affiliate"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Any affiliate resolved (not the anonymous / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"home\""]}," fallback)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["email"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["avatar"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["initials"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my_site_url"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["That specific field has a value"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["hide-if"]}," wins over ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["show-if"]}," when both target the same element."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"why-the-inline-styledisplaynone"},"children":["Why the inline ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["style=\"display:none\""]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK toggles the element after the page loads. Without pre-hiding, an anonymous visitor sees affiliate content flash before it disappears. The SDK removes ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["display:none"]}," when the condition holds; leaves it in place when it doesn't. No flash either way."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For accessibility notes on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["aria-live"]}," and screen reader behaviour, see the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/themes/affiliate-hydration#accessibility"},"children":["themes cheatsheet — Accessibility section"]},"."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"sentinels"},"children":["Sentinels"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Inline placeholder strings that the SDK swaps document-wide with the resolved rep username. Use these for URL path segments (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["href"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["form action"]},") or JSON literals embedded inside ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<script>"]}," tags where a custom element or data attribute can't fit."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"usage-3"},"children":["Usage"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"liquid","header":{"controls":{"copy":{}}},"source":"<!-- Liquid source — the raw {{ username }} compiles to a sentinel under hydration -->\n<a href=\"/{{ username }}/shop\">Shop</a>\n<form action=\"/{{ username }}/join\">...</form>\n","lang":"liquid"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Server-rendered HTML:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<a href=\"/__fluid_affiliate_username__/shop\">Shop</a>\n<form action=\"/__fluid_affiliate_username__/join\">...</form>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["At runtime, the SDK replaces every occurrence of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["__fluid_affiliate_username__"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["href"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["action"]},", text nodes, and JSON literals with the resolved rep username, falling back to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"home\""]}," for anonymous visitors."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"liquid-identifiers-that-emit-sentinels"},"children":["Liquid identifiers that emit sentinels"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Liquid variable"},"children":["Liquid variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Sentinel emitted"},"children":["Sentinel emitted"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Use for"},"children":["Use for"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ username }}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["__fluid_affiliate_username__"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Path segments in link/form URLs"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ share_guid }}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["__fluid_affiliate_username__"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Sharing-link surfaces"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ affiliate_guid }}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["__fluid_affiliate_username__"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Legacy alias for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["share_guid"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ sharing_id }}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["__fluid_affiliate_username__"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Sharing link variants"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ external_id }}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Real value (not a sentinel)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Backend-only surfaces (webhooks, non-cached)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ company.shop_page_url }}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["URL with sentinel baked in"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Shop link (no theme edit needed)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ company.join_page_url }}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["URL with sentinel baked in"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Join link (no theme edit needed)"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"company-url-helpers"},"children":["Company URL helpers"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ company.shop_page_url }}"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ company.join_page_url }}"]}," already emit sentinel-bearing URLs under hydration:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"liquid","header":{"controls":{"copy":{}}},"source":"<a href=\"{{ company.shop_page_url }}\">Shop</a>\n<!-- Renders to: <a href=\"/__fluid_affiliate_username__/shop\">Shop</a> -->\n","lang":"liquid"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK swaps the sentinel client-side. No theme edit needed."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"one-case-that-requires-care"},"children":["One case that requires care"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Raw ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["__fluid_affiliate_username__"]}," sentinels in text nodes can only be swapped once — after the first substitution the original string is gone. For text nodes that need to survive a rep switch mid-session, prefer the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<fluid-affiliate-name>"]}," custom element over the raw ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ username }}"]}," sentinel. The element re-renders on affiliate change; the sentinel doesn't."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For URL paths (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/{{ username }}/shop"]},"), rep switching triggers a full page navigation anyway, so this rarely comes up in practice."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-the-sdk-finds-them"},"children":["How the SDK finds them"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["On page load and on subsequent DOM mutations, the SDK scans the document for the custom elements, data attributes, and sentinels above. Two scan paths:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Initial scan"]}," — Runs once after the SDK boots. Finds every marker in the initial HTML."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["MutationObserver"]}," — Watches for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["childList"]}," changes on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["document.body"]}," and re-scans newly-added subtrees. This is what makes SPA navigation (Turbo, Barba) work without explicit hooks — as long as the swap dispatches standard DOM mutations, the SDK picks up the new markers."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If your SPA library performs DOM swaps in a way that skips mutation events, call the SDK's rescan API after each swap:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"document.addEventListener('turbo:load', function () {\n  window.FairShareSDK?.rescanForSentinels?.();\n});\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The optional-chaining call is deliberate — if the SDK isn't loaded yet, the call is a no-op instead of a TypeError."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"fields-that-stay-real-no-hydration"},"children":["Fields that stay real (no hydration)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Not every affiliate field goes through hydration. These render with real, per-request values even under hydration:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Under hydration"},"children":["Under hydration"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ affiliate.web_rep_store_enabled }}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Real (company-level setting, not per-rep)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ affiliate.logged_in_rep_for_store }}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Real"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ affiliate.sign_in_url }}"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sign_out_url"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Real placeholders (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"#\""]},") — wire up via SDK auth API, not the Liquid value"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ company.* }}"]}," (except URL helpers above)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Real (not affiliate-dependent)"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sign_in_url"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sign_out_url"]},", the Liquid renders ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"#\""]},". Wire the click through a JS handler that calls the SDK's auth API — the SDK holds the real URLs even when the Liquid variable doesn't."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"mysite-pages-dont-hydrate"},"children":["Mysite pages don't hydrate"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Any template under ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/my/*"]}," (bio pages, favorites, personal links) renders with the real affiliate's values. Hydration is bypassed because mysite content is fundamentally per-rep. In a mysite template you can use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{ affiliate.name }}"]}," directly — the SDK isn't relied on for these pages."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"verifying-hydration-is-on"},"children":["Verifying hydration is on"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Every response includes diagnostic headers you can use to confirm hydration is running:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -I -A \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36\" \\\n     \"https://<host>/<rep>/products/<slug>\" \\\n  | grep -iE \"x-hydration|x-credit|x-original-credit|x-cdn-cache|x-gcs-path\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Header"},"children":["Header"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-hydration: on"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Hydration is active for this request"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-credit: _default"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Cache key is collapsed — every rep for this page shares one artifact"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-original-credit: <rep>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The rep from the request URL (preserved for analytics)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-cdn-cache: HIT"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MISS"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Cache state at request time"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-gcs-path: <host>/latest/pages/_default/<page>/..."]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Path to the cached artifact served for this request"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use a browser-shaped ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-A"]}," UA — many storefronts return 500 for bare-curl User-Agents."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"related"},"children":["Related"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/themes/affiliate-hydration"},"children":["Affiliate Hydration Cheatsheet"]}," — Full theme-author guide with migration walkthroughs, gotchas, troubleshooting, and pre-flight checklist"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/sdk/fairshare/components/attribution"},"children":["Attribution Overview"]}," — How the SDK determines ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["which"]}," affiliate to hydrate"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/sdk/fairshare/events/getattribution"},"children":["getAttribution"]}," — Read the resolved attribution programmatically"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/sdk/fairshare/settings/lookupaffiliate"},"children":["lookupAffiliate"]}," — Look up affiliate details by email, username, or ID"]}]}]},"headings":[{"value":"Affiliate Hydration","id":"affiliate-hydration","depth":1},{"value":"What's Included","id":"whats-included","depth":2},{"value":"Benefits","id":"benefits","depth":2},{"value":"Quick Example","id":"quick-example","depth":2},{"value":"<fluid-affiliate-*> fields","id":"fluid-affiliate--fields","depth":2},{"value":"Usage","id":"usage","depth":3},{"value":"Elements","id":"elements","depth":3},{"value":"When NOT to use","id":"when-not-to-use","depth":3},{"value":"Data attributes","id":"data-attributes","depth":2},{"value":"Usage","id":"usage-1","depth":3},{"value":"Attributes","id":"attributes","depth":3},{"value":"data-fluid-affiliate-base-url","id":"data-fluid-affiliate-base-url","depth":3},{"value":"Why not <img src=\"{{ affiliate.avatar }}\"> ?","id":"why-not-img-src-affiliate.avatar--","depth":3},{"value":"Visibility toggles","id":"visibility-toggles","depth":2},{"value":"Usage","id":"usage-2","depth":3},{"value":"Tokens","id":"tokens","depth":3},{"value":"Why the inline style=\"display:none\"","id":"why-the-inline-styledisplaynone","depth":3},{"value":"Sentinels","id":"sentinels","depth":2},{"value":"Usage","id":"usage-3","depth":3},{"value":"Liquid identifiers that emit sentinels","id":"liquid-identifiers-that-emit-sentinels","depth":3},{"value":"Company URL helpers","id":"company-url-helpers","depth":3},{"value":"One case that requires care","id":"one-case-that-requires-care","depth":3},{"value":"How the SDK finds them","id":"how-the-sdk-finds-them","depth":2},{"value":"Fields that stay real (no hydration)","id":"fields-that-stay-real-no-hydration","depth":2},{"value":"Mysite pages don't hydrate","id":"mysite-pages-dont-hydrate","depth":2},{"value":"Verifying hydration is on","id":"verifying-hydration-is-on","depth":2},{"value":"Related","id":"related","depth":2}],"frontmatter":{"seo":{"title":"Affiliate Hydration"}},"lastModified":"2026-07-07T16:32:00.000Z"},"slug":"/docs/sdk/fairshare/components/affiliate-hydration","userData":{"isAuthenticated":false,"teams":["anonymous"]}}