getAttribution()
Gets the current effective attribution data.
Signature
const attribution = window.FairShareSDK.getAttribution();
Returns
AttributionData | null — Attribution data object, or null if no attribution exists.
AttributionData is a union type containing one of:
| Property | Type | Description |
|---|---|---|
email | string | Affiliate email address |
username | string | Affiliate username |
share_guid | string | Share GUID |
fluid_rep_id | number | Fluid Rep ID |
external_id | string | External affiliate ID |
Attribution Priority
Attribution is resolved in this order (highest priority first):
- Attribution Override — Manual override set via
attributionOverrideconfig or data attributes - Server-Calculated Attribution — From settings API
- Affiliate Cookie — From
fluid_affiliatecookie - None — Returns
nullif no attribution found
Example
const attribution = window.FairShareSDK.getAttribution(); if (attribution) { // Attribution contains ONE of these fields console.log('Attribution:', attribution); // e.g., { fluid_rep_id: 12345 } or { email: "affiliate@example.com" } } else { console.log('No attribution'); }
Related
- getSessionToken — Get session token
- lookupAffiliate — Look up affiliate details
- Attribution Component — Display attribution UI