Overview
This guide shows you how to capture referral codes (ucc
) from visitors and automatically populate them into HubSpot forms when users submit lead generation or contact forms. This enables you to track which referrals lead to qualified leads and conversions.
Considerations when creating the ucc
property in HubSpot
When creating a custom property in HubSpot, it is important that the internal name of the property is ucc
. This sets up the property in either company or deal. The one to choose depends on your specific sales process and the corresponding HubSpot setup.
These instructions describe creating the ucc
property in the object type Company, group Company information. Often, it can make sense to create the ucc
property in the Deal object type. A custom property can be created following the instructions of HubSpot here.
Step 1: Create a form with a hidden ucc
field in HubSpot
To properly capture referral data, you need to add a ucc
field to your HubSpot form:
- Create a customized form in HubSpot by following the instructions here.
- In your form, create a hidden field called
ucc
. This field automatically picks up theucc
from the link and feeds it into the createucc
property in HubSpot. The result should look like this:

Step 2: Include the Cello Attribution Library
Add the Cello attribution script to your website’s<head>
section or before the closing </body>
tag:
Step 3: Add the Attribution Command Queue
Since HubSpot forms are loaded dynamically, include this script to handle race conditions between your code and the Cello library loading:Important: This script must be added before any calls to
window.CelloAttribution()
to prevent race conditions.Step 3: Integrate with HubSpot Form Creation
When creating your HubSpot form, use theonFormReady
callback to populate the referral code. Replace the placeholder values with your actual HubSpot configuration:
Test Your Implementation
1. Test Referral Code Capture
-
Visit your page with a referral parameter:
-
Open browser developer tools and check:
Expected response:
Promise {<fulfilled>: 'test123'}
2. Test Form Integration
- Open the page with the created form
- Add
?ucc=demo12345687
to the link and reload the page. After the initialization of the config, this will be added automatically to the link by Cello - Enter some test data into the form. The result should look similar to the following

- Submit your HubSpot form
- HubSpot should now have created a new contact and a new company. In the new company, you should find the
ucc
property filled with the entered valuedemo12345687
- The test was successful. You can now move ahead to the section on providing the required data to Cello.

Troubleshooting
Common Issues and Solutions
1. “getReferral is not supported” error- Make sure you’re using
getUcc()
instead ofgetReferral()
- This is the correct method for the latest attribution library
- Verify your form has a field with
name="ucc"
- Check that the field selector in
querySelectorAll()
matches your form - Ensure the
onFormReady
callback is executing
- Test with a URL containing the
ucc
parameter:?ucc=test123
- Check browser cookies for
cello-referral
- Verify the attribution script loaded properly
- Always include the command queue script before any attribution calls
- Use the
async
attribute on the attribution library script
HubSpot Scheduling Pages Integration
You can also use the Cello attribution library with HubSpot scheduling pages to capture referral codes when prospects book meetings or demos. This is particularly useful for sales-led referral programs where referrals often lead to booked consultations or product demos.How it works
HubSpot scheduling pages include built-in forms that collect contact information before allowing visitors to book meetings. You can integrate Cello attribution with these forms using the same approach as regular HubSpot forms.Setup Steps
The integration process for scheduling pages is identical to regular forms:- Include the Cello Attribution Library (Steps 2-3 above remain the same)
- Set up the
ucc
property in your HubSpot contacts/companies - Add a hidden
ucc
field to your scheduling page form - Configure the scheduling page to populate the referral code
Adding ucc
Field to Scheduling Pages
- Create or edit a scheduling page (HubSpot’s scheduling page guide)
- In the “Form” section, add the created
ucc
parameter to the form. You can’t hide this field on a scheduling page. This field automatically picks up theucc
parameter from the link and feeds it into the createducc
property in HubSpot. The result should look like this:

JavaScript Integration for Scheduling Pages
Since scheduling pages are embedded HubSpot components, you’ll add the same integration code to the page where your scheduling page is embedded:Testing Your Scheduling Page Integration
-
Visit your scheduling page with a referral parameter:
- Start the booking process and fill out the form
- Complete the booking
-
Check the created contact in HubSpot - the
ucc
field should containdemo12345687
Key Differences from Regular Forms
- Timing: Scheduling pages load asynchronously, so we use MutationObserver to detect when the form is ready
- Form structure: Scheduling page forms are embedded HubSpot components with specific styling
- Optional field: Make the
ucc
field optional since not all meeting bookings will come from referrals - Meeting context: The referral code will be associated with the contact and any resulting deals from the meeting
For sales-led businesses: Integrating referral tracking with scheduling pages is crucial for tracking which referrals lead to qualified sales conversations and ultimately closed deals.