Connect attribution

This guide walks you through the steps required to attribute referrals and includes:

If your payment gateway is Stripe or Chargebee, use the following guides with Webhook integration

Attribution with Stripe

Attribution with Chargebee

1. Track conversions on your landing page

Add Attribution library to your Home page by including the following script in the <head> tag to track attributions and show New user banner.

Javascript
Copy

2. Track signups

When a signup finally happens, you need to make sure that a ucc code, identifying the referrer, is saved to the new user record and passed to Stripe upon customer creation.

Access Ucc code during signup

Ucc is present in the URL of your Home page when a new user is redirected to it from the invite link and in the cookies, added by the Attribution library.

Copy

To access the ucc during signup, you can use the Attribution library JS method getUcc().

Here is how to do it:

  • Add the following javascript code before any of the calls to the library to avoid race conditions.
Javascript
Copy
Javascript
Copy

Next save the ucc to your user record. You will need it in next step when you send Cello referral update events.

To make sure your referrers get rewarded when a new user signs up in the mobile app, follow this guide on Mobile attribution to track mobile app signups.

3. Connect Cello API

You can interact with the Cello API through HTTP requests from any language. Cello API provides 3 endpoints: Events to report and push (generic) events directly to Cello, Referral Codes to validate referral code (UCC) and Active link to retrieve an active referral code (UCC) and invite link for your user.

Domain base URL's

Use the Domain base URL that corresponds with the environment.

Endpoint URLEnvironment
https://api.sandbox.cello.so/Sandbox
https://api.cello.so/Prod

💡 Switch environments in the Portal using a switch to get the credentials

Authentication

To use the Cello API, you need to authenticate the request using an accessToken which is passed in the Authorization request header.

To obtain them you will need accessKeyId & secretAccessKey which you can get from your product dashboard on Access Keys page.

The value of expiresIn specifies after how many seconds the token expires.

Obtain accessToken & refreshToken

curl
Copy

Refresh accessToken

curl
Copy

Make sure that all requests contain Authorization: Bearer <accessToken> header and Content-Type: application/json

4. Send referral update events

This Cello API provides a way to report and push (generic) events directly to Cello. Currently Cello supports manual reporting via exports and direct integration to Stripe via a an webhook endpoint. For all other use cases you can use our Events endpoint.

Use cases:

  • New user signs up for your product based on a referral link.
  • New user schedules a demo call based on a referral link.
  • New user buys a subscription directly after the signup or after he or she tested the product.
  • New user cancels his or her subscription.
  • New user adds new seats to his or her active plan.

Example Requests and Flows

Based on your business model and signup flow, you need to provide Cello with certain events. You will find a couple of common use cases in the tab menu underneath. If they don't fit your needs, feel free to reach out to our support and discuss a custom flow.

If the buying persona is the organization and you want to attribute purchases on the organization level always provide the ID of the organization in the parameter payload.newUserId.

Subscription Flow
Demo Call Flow
One-time Purchases

If you have a standard subscription model with monthly, yearly or biennial, intervals you should provide Cello with the following events:

new-signup - The new user signs up

Javascript
Copy

invoice-paid - every time a transaction based on the provided subscription is successful an invoice-paid event should be reported to Cello.

Javascript
Copy

charge-refunded - the payment of the new user got refunded.

Javascript
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard