What is Attribution JS?

Attribution JS is a lightweight JavaScript library that captures referral codes (ucc) from landing pages and maintains attribution throughout the user journey. When users click referral links and land on your website, this library ensures their referral source is properly tracked through signup and purchase events. The library automatically:
  • Detects referral code (ucc) query parameters from referral links
  • Stores referral code (ucc) as first-party cookies for persistent tracking
  • Attaches referral code (ucc) to signup forms
  • Provides APIs to retrieve referrer information for personalization

Installation Options

Choose your preferred installation method:

Key Capabilities

Attribution JS enables you to:

Referral Tracking

  • Capture referral codes - Automatically detect and store ucc parameters
  • Retrieve referral data - Access referral codes programmatically with getUcc() from URL or cookie.
  • Form integration - Auto-inject hidden referral fields into signup forms

Personalization & Campaigns

  • Get referrer names - Display personalized messages with referrer information
  • Access campaign config - Retrieve discount percentages and duration for referred users
  • Dynamic discount display - Show referral incentives based on campaign parameters
  • Privacy compliance - Manage cookie consent with built-in methods
  • Allow cookies - Enable cookie storage after user consent
  • Delete cookies - Remove stored data when consent is withdrawn
  • Custom handling - Implement your own consent flow with full API control

How It Works

  1. User clicks referral link - Link contains referral code (ucc) parameter (e.g., yoursite.com?ucc=ABC123)
  2. Script captures code - Attribution JS detects referral code (ucc) and makes it accessible via JS method
  3. Code persists - Stored as cookie for 3 months to handle return visits
  4. Signup attribution - Referral code (ucc) is attributed to new user on signup
  5. Referral conversion tracking - Pass the referral code (ucc) to Cello when tracking signups and purchases

Next Steps

1

Install the Library

2

Verify Installation

Test that referral codes are being captured correctly
3

Explore the API

Review all available methods for advanced functionality
Attribution JS works alongside Cello JS for complete referral program functionality. While Attribution JS handles tracking, Cello JS provides the referral component interface.