Last updated

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:

PropertyTypeDescription
emailstringAffiliate email address
usernamestringAffiliate username
share_guidstringShare GUID
fluid_rep_idnumberFluid Rep ID
external_idstringExternal affiliate ID

Attribution Priority

Attribution is resolved in this order (highest priority first):

  1. Attribution Override — Manual override set via attributionOverride config or data attributes
  2. Server-Calculated Attribution — From settings API
  3. Affiliate Cookie — From fluid_affiliate cookie
  4. None — Returns null if 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');
}