Skip to main content
Attribution script helps you to capture referral code on your landing pages and make it available at signup to attribute referral conversions to the right referrers. In addition, it helps you to personalize messages for referees on the landing page, get discount information and detect potential fraud and abuse of your referral program. Script Loading Context: The attribution script loads asynchronously and methods become available shortly after page load. All attribution methods use the unified window.CelloAttribution("methodName") syntax.

Adding the script

You can add attribution script to your website like any other third party JavaScript code by inserting the following code snippet into the <head> tag of each page on your website.
Make sure to use type="module" and async html params in the script tag
  • Sandbox URL
  • Production URL
<script type="module" src="https://assets.sandbox.cello.so/attribution/latest/cello-attribution.js" async></script>

Verifying the installation

Now that you have added the attribution script to your website, make sure that the ucc is available on the signup page. To verify, follow these steps:

Step 1: Test with URL parameters

Add ?productId=test and ?ucc=test to your website URL:
https://yourwebsite.com/?productId=test&ucc=test
Open browser developer tools (F12) and verify these values are saved in cookies:
  • cello-product-id should contain test
  • cello-referral should contain test

Step 3: Test method access

Navigate to your signup page and test the attribution methods from the browser console:
// Wait for script to load if needed
setTimeout(async () => {
  try {
    const ucc = await window.CelloAttribution('getUcc');
    console.log('UCC test result:', ucc); // Should return 'test'
    
    // Test other methods
    const referrerName = await window.CelloAttribution('getReferrerName');
    const campaignConfig = await window.CelloAttribution('getCampaignConfig');
    
    console.log('Attribution methods working:', {
      ucc,
      referrerName,
      campaignConfig
    });
  } catch (error) {
    console.error('Attribution test failed:', error);
  }
}, 2000);
Expected result:
Promise {<fulfilled>: 'test'}

Troubleshooting Installation Issues

Script not loading

// Check if script loaded
if (typeof window.CelloAttribution !== 'function') {
  console.error('Attribution script failed to load');
  // Check network tab for loading errors
  // Verify script URL is accessible
}

Methods return undefined

  • Wait longer for script initialization (try 3-5 seconds)
  • Check browser console for JavaScript errors
  • Verify script tag has type="module" and async attributes
  • Ensure no ad blockers are interfering
  • Check if cookies are enabled in browser
  • Verify no GDPR/cookie consent is blocking storage
  • Test in incognito mode to rule out extensions
Installation successful if methods return expected values and cookies are stored properly. Need help? Check the troubleshooting guide for common issues and solutions.
I