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:Embedded Script Tag
Add directly to your HTML pages with a script tag
Google Tag Manager
Deploy through GTM without code changes
Key Capabilities
Attribution JS enables you to:Referral Tracking
- Capture referral codes - Automatically detect and store
ucc
parameters from referral links - Retrieve referral data - Access referral codes programmatically with
getUcc()
. Returns data from URL parameters or stored cookies (persisted for 3 months) - Form integration - Auto-inject hidden referral fields into signup forms for seamless attribution
Personalization & Campaigns
- Get referrer names - Display personalized messages using
getReferrerName()
to retrieve the name of the person who sent the referral - Access campaign config - Use
getCampaignConfig()
to retrieve discount percentages (in decimal format: 0.1 = 10%) and duration in months for referred users - Dynamic discount display - Show referral incentives based on campaign parameters with proper percentage conversion for user display
Cookie Management
- 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
- User clicks referral link - Link contains referral code (
ucc
) parameter (e.g.,yoursite.com?ucc=ABC123
) - Script captures code - Attribution JS detects referral code (
ucc
) and makes it accessible viawindow.CelloAttribution("getUcc")
method - Code persists - Stored as first-party cookie for 3 months to handle return visits and cross-session attribution
- Methods available - All attribution methods (
getUcc
,getReferrerName
,getCampaignConfig
) become available asynchronously after script initialization - Signup attribution - Referral code (
ucc
) is automatically attached to forms or retrieved programmatically for user registration - Referral conversion tracking - Pass the referral code (
ucc
) to Cello when tracking signups and purchases for complete attribution
Next Steps
1
Install the Library
Choose between embedded script or GTM installation
2
Verify Installation
Test that referral codes are being captured correctly
3
Explore the API
Review all available methods for advanced functionality
API Method Calls
All Cello Attribution methods use the unifiedCelloAttribution
function syntax:
Attribution JS works alongside Cello JS for complete referral program functionality. While Attribution JS handles tracking and data retrieval, Cello JS provides the referral component interface.