Skip to main content
FairShare ships four web components that you place directly in your HTML markup: <fluid-cart-widget>, <fluid-banner-widget>, <fluid-lead-capture-widget>, and <fluid-media-widget>. The SDK registers a component when its tag appears on the page, so you do not need an import or build step.

Cart Widget

When to Use

Use <fluid-cart-widget> to add a floating cart button and slide-out cart sidebar to your site. The widget displays a live item count, lets shoppers review and edit their cart, and links to checkout. If you want to build a fully custom cart UI, you can hide the widget with hideWidget and drive the cart panel with the JavaScript cart controls instead.

Usage

Attributes

JavaScript Settings Override

Override widget settings at runtime using cart.settings.set(). Settings are scoped to the current URL path, so you can apply different configurations on different pages without changing the HTML.

Lead Capture Widget

When to Use

Use <fluid-lead-capture-widget> when you want a ready-made contact form that submits leads directly to Fluid. The widget handles field rendering, validation, submission, and success messaging. It’s ideal for landing pages, contact sections, or anywhere you want to collect prospects without writing form-handling code.

Usage

Common attributes include:

Programmatic Lead Capture

If you’re building a custom form or capturing leads as part of another flow, submit directly via JavaScript without rendering the widget:
Pass the prospect’s details inside contactname, email, and phone. Keys outside that shape are dropped silently, so a flat payload submits an empty lead and still resolves successfully. Every field is optional, but send at least one of email or phone so the lead is reachable. The captured lead is attributed to the same rep that was resolved when the SDK initialized.

Affiliate hydration

FairShare can fill affiliate-specific names, images, links, and visibility states into a shared storefront page after it loads. Use the affiliate hydration guide to choose between custom elements, data attributes, and URL sentinels without duplicating a page for every affiliate.

Media Widget

When to Use

Use <fluid-media-widget> to embed a product video, media file, or an entire playlist without building a custom player. The widget supports both inline and popover display modes, making it suitable for product pages, landing pages, and lightbox-style media galleries.

Usage

Attributes

These are the attributes you’ll reach for most often. The widget accepts more than these — sizing, video-playback options, and event-callback hooks among them — so treat this table as a starting point rather than the complete set. Use playlist-id to show a browsable collection. Use media-id to show one item. If you provide both, playlist-id takes precedence. The widget does not recognize library-id. For playback events and CTA overrides, see the FairShare media guide.

JavaScript methods

Fetch media metadata to build custom players or display additional information alongside the widget:
The methods return response wrappers. Read playlist content from libraryResponse.library, including title and library_items. Read the media record from mediaResponse.media.

CSS Customization

FairShare components expose CSS custom properties (variables) that you can set in your stylesheet to match your brand. Define them on :root to apply them globally:
For colors, provide a valid CSS hex, RGB, or HSL value. For fonts, list your custom font first and include a generic family fallback.

Analytics and Events

Track events and inspect attribution state from anywhere in your JavaScript code. Firing a tracked event:
eventName accepts exactly one value, "CHECKOUT_STARTED". Any other name is accepted at the call site but never reaches Fluid, and nothing raises an error — so the call looks successful while no event is recorded. The method returns nothing — call it directly rather than awaiting it. Tracking checkout started:
Inspecting attribution and session state:
getSessionToken() throws when tracking has not initialized, initialization is still in progress, session creation failed, or the fluidShop identifier is invalid. Call it after initialization and handle the error when session state is optional. Flushing buffered events:
flushEvents() waits for delivery by default. Pass false when the caller should continue immediately.

Authentication

If your site has its own authentication system, you can pass a JWT to FairShare so the SDK associates cart and order activity with the authenticated user.
Call setAuthentication() after your login flow completes. To clear the session — for example when the user logs out — call window.FairShareSDK.reset().