Capture Referral Information
To ensure accurate tracking of referral activity in Cello, it's essential to capture specific information when registering transactions and events involving new users. This information allows Cello to properly attribute referrals to the correct individuals, maintaining reliable referral records.
The following key data points need to be included:
- Referral code (UCC): This unique code identifies the referrer and the active campaign at the time of referral. You can learn more about the UCC in our Pre-Signup Attribution section.
productUserId
ornewUserId
: This is a unique identifier that distinguishes users on your platform.
These pieces of information should be included in any events or records sent to Cello when using Stripe or Chargebee Webhooks.
Cello utilizes your own product's unique user identifier, known as productUserId
or newUserId
, to simplify integration and data management.
Cello uses this data to attribute the referral to the correct user and ensure each attribution is unique. It's crucial these keys match correctly to maintain accurate referral records.
To achieve this, simply add the following fields when creating a user record in your subscription tool:
- The cello referral code (UCC), labeled as
cello_ucc
- The product user ID, labeled as
productUserId
ornewUserId
How to include this data depends on your particular setup and user record creation process. Both the Stripe documentation and Chargebee documentation offer more details on adding metadata.
Retrieving Referrer Information
For Cello to correctly attribute new referrals, the associated UCC must be included whenever a customer or transaction is created in Stripe or Chargebee
Retrieving Cello's UCC
If you're utilizing Cello's Attribution Library, the UCC can be easily accessed from the cookie by calling the following function:
window.CelloAttribution('getReferral')
If the UCC was stored during the signup process, retrieve the UCC from your user data.
Incorporating the UCC into your Stripe or Chargebee data
There are various points at which you can introduce the UCC into your Stripe or Chargebee data, provided you've implemented using the APIs in your frontend. This facilitates modifications to the customer creation or subscription process.
Include the UCC during customer creation
Adding Metadata to Customers in Stripe
Stripe's Metadata object supports the inclusion of additional structured data on an object. For more information, see the Stripe Documentation.
Include the UCC during customer creation in Stripe
Below is an example for a NodeJS app, illustrating how to include cello_ucc
and new_user_id
during customer creation. For more details, see the Stripe documentation.
We recommend introducing the cello_ucc
at the customer creation stage. Doing so allows Cello to attribute subsequent events based on the stripe_customer_id
, which is associated with all Stripe events.
Always include your new_user _id alongside cello_ucc
const stripe = require('stripe')('sk_test_51KiCYYCSMQAUBF...');
const customer = await stripe.customers.create({
description: 'New Stripe Customer',
coupon: 'lHTYr6Y9',
metadata: {
cello_ucc: "hdz7afhs7",
new_user_id: "xcsdad"
}
});
As alternative it's also possible to update the customer after the creation. Especially if the Stripe Customer is not created during the signup. Cello also processes the customer.updated events.
const customer = await stripe.customers.update(
'cus_NffrFeUfNV2Hib',
{
metadata: {
cello_ucc: "hdz7afhs7",
new_user_id: "xcsdad"
}
});
Adding Metadata to Customers in Chargebee
Chargebee's Metadata object supports the inclusion of additional structured data on an object. For more information, see the Chargebee documentation.
Include the UCC during customer creation in Chargebee
Below is an example for a NodeJS app, illustrating how to include cello_ucc
and new_user_id
during customer creation. For more details, see the Chargebee documentation.
We recommend introducing the cello_ucc
at the customer creation stage. Doing so allows Cello to attribute subsequent events based on the id
, which is associated with all Chargebee events.
Always include your new user id alongside cello_ucc
var chargebee = require("chargebee");
chargebee.configure({site : "getmoonly-v3-test", api_key : "test_jqXGuQLkBHUSR2PM0qgUV21W1VqSFJIU"});
chargebee.customer.create({
first_name : "Bob",
last_name : "Bobsky",
//...
// other customer fields
//...
meta_data: {
cello_ucc: "hdz7afhs7",
new_user_id: "xcsdad"
}
// ..
// })