Before proceeding, you should have a program created on Partnero. If you haven’t created one yet, refer to the Knowledge Base for guidance.
How it works
- A customer signs up on your site and receives a unique referral link from Partnero
- They share the link with friends
- When a friend visits via the link, PartneroJS stores the referrer’s key in a
partnero_referralcookie - When the friend signs up, your backend reads the cookie and sends it to Partnero to link them as a referred customer
- When the referred customer makes a purchase, your backend records the transaction
- The referring customer earns a reward
Step 1: Install PartneroJS
PartneroJS tracks referral visits by reading the referrer’s key from the URL and storing it in a first-party cookie. This cookie is what your backend reads later during sign-up.1
Get your snippet
- Log in to Partnero
- Go to Programs and select your program
- Navigate to Integration in the sidebar
- Copy the PartneroJS snippet
2
Install the snippet
Paste the snippet into your website’s HTML just before the closing
</head> tag:yoursite.com?ref=REFERRAL_KEY), the script creates a partnero_referral cookie containing the referrer’s key.
Step 2: Track sign-ups
In a refer-a-friend program, every customer should be created in Partnero—both referrers and referred customers. The only difference is whether you include areferring_customer field.
How to get the referral key
Thepartnero_referral cookie is set by PartneroJS when a visitor arrives via a referral link. Read it on your server:
- Node.js / Express
- PHP / Laravel
- Python / Django
- Ruby on Rails
Create a customer
Send aPOST /v1/customers call for every sign-up. If the partnero_referral cookie exists, include it as referring_customer.key. If it doesn’t, omit the referring_customer field—the customer is still created and can share their own referral link.
- With referral (referred customer)
- Without referral (new referrer)
Request body
*If
referring_customer is provided, at least one of referring_customer.key or referring_customer.id is required.
Response
The response includes the customer’s referral link, which you can display in your UI:Step 3: Track sales
When a referred customer makes a purchase, record the transaction so Partnero can calculate rewards for the referring customer.Request body
Multiple transactions
Send multiple transactions for the same customer in a single request:Step 4: Display referral data
Show customers their referral link, stats, and rewards in your application. Fetch this data from your backend using the Partnero API.Get customer details and referral link
referral_link from the response to display a “Share your link” section in your app.
Get referral stats
Get reward balance
Get referred friends
Step 5: Credit rewards
If your reward configuration requires manual crediting, add credit to a referring customer’s balance:Complete integration example
Here’s the full flow in a Node.js/Express backend:Next steps
Webhooks
Get real-time notifications when referrals convert
Customer API
Full customer endpoint documentation
Mobile apps
Integrate tracking in iOS and Android apps
Refer-a-friend forms
No-code embeddable referral forms
