Last updated

Attribution

The Attribution section provides tools for tracking and managing affiliate attribution throughout the customer journey. Attribution connects customer activity to the affiliate or representative who referred them.


What's Included

FunctionDescription
getAttributionGet the current attribution data
getSessionTokenGet the session token for tracking
lookupAffiliateLook up affiliate details by email, username, or ID

Benefits

  • Automatic Detection — Attribution is automatically detected from URLs, cookies, and server-side calculations
  • Multiple Attribution Methods — Support for email, username, share GUID, Fluid Rep ID, and external IDs
  • Override Capability — Manually set attribution via script tag data attributes or SDK configuration
  • Persistence — Attribution persists across page loads via cookies and session storage
  • Priority Resolution — Clear priority order ensures the correct attribution is always used

Attribution Priority

When multiple attribution sources exist, they are resolved in this order:

  1. Attribution Override — Manual override via attributionOverride config or data attributes
  2. Server-Calculated — Attribution determined by the settings API
  3. Affiliate Cookie — Stored in the fluid_affiliate cookie
  4. None — Returns null if no attribution is found

Setting Attribution

Via Data Attributes

<script
  src="https://cdn.fluid.app/sdk/cdn.js"
  data-fluid-shop="your-shop-id"
  data-share-guid="affiliate-share-guid"
></script>

Attribution Override Attributes (all optional, use one):

AttributeTypeDescription
data-share-guidstringAffiliate's share GUID
data-fluid-rep-idnumberFluid Rep ID (numeric)
data-emailstringAffiliate's email address
data-usernamestringAffiliate's username
data-external-idstringExternal affiliate ID

Via SDK Configuration

await window.FairShareSDK.initializeFairshare({
  fluidShop: "your-shop-id",
  attributionOverride: {
    email: "affiliate@example.com"
  }
});