Attribution with Stripe
This guide walks you through the steps required to attribute referrals if your payment gateway is Stripe and includes:
- Tracking conversions on your landing page
- Tracking signups with Stripe
- Sending signup and transaction events to Cello
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.
<script type="module" src="https://assets.cello.so/attribution/latest/cello-attribution.js" async></script>
2. Track signups with Stripe
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.
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.
window.CelloAttribution=window.CelloAttribution||async function(t,o){if("getReferral"===t)throw new Error("getReferral is not supported in this context. Use getUcc instead.");let e,n;const i=new Promise((t,o)=>(e=t,n=o));return(window.CelloAttributionCmd=window.CelloAttributionCmd||[]).push({command:t,args:o,resolve:e,reject:n}),i};
// if in async function
const ucc = await window.CelloAttribution('getUcc');
// otherwise
window.CelloAttribution('getUcc').then((result) => {
const ucc = result;
})
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.
Now the next step depends on your flow!
4. Send signup and transaction events to Cello
Choose one of the 2 options depending on your scenario:
- I create Stripe customer at signup - Use only Stripe Webhook integration if you create Stripe customer at the point of signup
- I don't create Stripe customer at signup - Use a combination of Cello API and Stripe Webhook integration if you don't create Stripe customer at signup and only at purchase
Pick your scenario: