This guide is optimized for the typical freemium scenario with Stripe.Use this guide if you:
- Create Stripe customer on signup
- Use Stripe 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 on Stripe customer creation
To track a signup, you can pass the followingmetadata
to Stripe Customer Object on customer creation.
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.
Now that the customer is created in Stripe with Cello metadata, a
customer.created
event will be sent with Stripe Webhook, which we will count as a signup event in Cello. You will connect Stripe Webhook in the next step.Step 4: Connect Stripe Webhook to send signup and purchase events
To send Cello signup and purchase events, you will need to connect Stripe 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 🎉