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
| Function | Description |
|---|---|
| getAttribution | Get the current attribution data |
| getSessionToken | Get the session token for tracking |
| lookupAffiliate | Look 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:
- Attribution Override — Manual override via
attributionOverrideconfig or data attributes - Server-Calculated — Attribution determined by the settings API
- Affiliate Cookie — Stored in the
fluid_affiliatecookie - None — Returns
nullif 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):
| Attribute | Type | Description |
|---|---|---|
data-share-guid | string | Affiliate's share GUID |
data-fluid-rep-id | number | Fluid Rep ID (numeric) |
data-email | string | Affiliate's email address |
data-username | string | Affiliate's username |
data-external-id | string | External affiliate ID |
Via SDK Configuration
await window.FairShareSDK.initializeFairshare({ fluidShop: "your-shop-id", attributionOverride: { email: "affiliate@example.com" } });
Related
- getAttribution — Get attribution data programmatically
- getSessionToken — Get session token
- lookupAffiliate — Look up affiliate information