This guide is optimized for the typical freemium scenario with Chargebee.Use this guide if you:
- Create Chargebee customer on signup
- Use Chargebee webhook to send Cello referral conversion events
Step 1: Integrate the Referral Component
First, integrate Cello Referral Component into your web app to provide referrers with full referral experience. Referral Component is integrated using one of our SDKs. For your web app, use Cello JS - our client-side SDK. You can install it by:- Adding a script tag to the
<head>
of your application - Generating a JWT token for user authentication
- Booting the component with the provided token and user details
Step 2: Capture referral codes on landing page
Next, you will need to add Cello attribution script to your referral landing page:- Setup a landing page for your referral links to redirect to
- Install attribution script. Choose one of the following installation options best suited for your setup:
-
Verify the installation
To verify, follow these steps:
-
Add
?productId=test
and?ucc=test
to your website URL -
Make sure that these values are saved in the cookies as
cello-product-id
andcello-referral
-
Navigate to your signup page and try to access the ucc using the
getUcc()
method from the browser consoleThis method should return a promise with valuetest
-
Add
Step 3: Add Cello metadata or custom fields on Chargebee customer creation
To track a signup, you can pass the following metadata to Chargebee on customer creation.You can also choose to use Chargebee custom fields (CF_) to add referral data to the event. Learn more about custom fields in the Chargebee documentation
cello_ucc
- ucc, a referral code identifying the referrer. You can retrieve this code using attribution scriptgetUcc ()
method, you have installed as a prerequisite to this guide.new_user_id
- a unique user ID in your system, identifying the new user who just signed up. This should be the same ID (productUserId
) you will use to boot the Referral component, when this user logs into your appnew_user_organization_id
(optional) - add this, if your referrers can refer an organization rather then a single user and you want to reward based on that.
meta_data
:
Now that the customer is created in Chargebee with Cello metadata, a
Customer Created
event will be sent with Chargebee Webhook, which we will count as a signup event in Cello.Step 4: Connect Chargebee Webhook to send signup and purchase events
To send Cello signup and purchase events, you will need to connect Chargebee Webhook to Cello. Follow this guide to connect the webhook:Congratulations! You are done and now able to try out the full Cello referral experience 🎉