All Collections
Managing Your Program
Advanced Use
Make referral attribution based on a pre-distributed coupon code
Make referral attribution based on a pre-distributed coupon code
Samantha avatar
Written by Samantha
Updated over a week ago

How to make attribution to an Advocate or Affiliate with a multi-use coupon code

You can distribute multi-use coupon codes generated in your ecommerce platform to your existing referring Advocates and Customers, to share with friends, outside of a Referral widget and independent from a referral link.

Primarily, Friendbuy makes attribution between a Referrer and a Friend based on a cookie, dropped in Friend's browser when he or she clicks a referral link. Once that Friend converts, the order is sent to Friendbuy, via the Order Tracking Javascript or REST API.

We've outlined to use cases below, each with a slightly different process and using a different request body parameter. To make this association, you'll have to have access to and familiarity with Friendbuy's REST API.

IMPORTANT NOTE: You must be passing coupon_code as a property with the purchase/conversion data sent Friendbuy, via Order Tracking JavaScript or POST/Purchases API endpoint. In the use cases defined here, referral code IS NOT required in POST/Purchases.

Use Case 1: You'd like to distribute many random, personal coupon codes to Advocates and potential referring Customers.
First, you'll bulk generate these codes in your ecommerce platform as 'multi-use', so that many users can redeem an Offer when shared using same code. Next you will upload this bank (named specifically for the campaign) to Coupons. Next you will create a dedicated Referral widget for this campaign, which doesn't need to be customized, as users will not actually use it on your site. Generating new personal referral codes for a campaign with coupon bank specified in request, will programmatically make an association with an Advocate and a randomly selected, unused coupon code from the bank, so that when a referred Friend applies this code at checkout, attribution can made.
To perform this , fetch the campaign id (required) for your campaign from the URL of this widget's overview/settings page, and coupon bank id (required) from the URL when bank is open in app. You will need at least need customer email present in customer object, or email if customer object is not present. Customer ID id optional but recommended.

The request body will look like this:

{
  "campaign": {
    "id": 53345
  },
  "customer": {
    "id": "C9911",
    "first_name": "Jaylene",
    "last_name": "Zheng",
    "email": "jzheng@example.mil",
  },
   "coupon_bank_id": {
    "id": "9900",
}


Use Case 2: You have a smaller, defined subset of Advocates, Influencers, or Affiliates, and you would like to equip them with a personalized code to share.
For a smaller number of expected Referrers for a given campaign, such as for Affiliate Marketing or to support an Influencer program, you may be able to generate customized coupon codes in your eCommerce platform. For example, for George Clooney, you could create a custom code such as Clooney1. Once created, you'll want to align the list of codes with Advocates/Affiliates with email addresses. Similar to the steps outlined above: you'll upload the codes to a specified Coupon bank, create a dedicated widget and fetch campaign ID from URL, but instead of including a coupon code bank ID in your request, you will associate each personalized coupon code individually.

The request will look like this:

{
  "campaign": {
    "id": 53345
  },
  "customer": {
    "id": "C9911",
    "first_name": "Georgie",
    "last_name": "Clooney",
    "email": "cloondog@example.mil",
  },
   "coupon_code": "Clooney1"
}

Both successful responses will include "referral_code", for example cPw5. The unique referral code in that link can later be traced in the Friendbuy platform, both on User Lookup tool, and listed with each conversion.

What if Friend purchases are made offline?

If a referred friend uses the Advocate's personal coupon code in-store, or not via existing website checkout process, you can pass Friendbuy the purchase event and data via the POST/Purchases API endpoint. If the coupon code is included in the Body, we can make attribution back to the Referrer.  To support these use cases, referral code IS NOT required in POST/Purchases in lieu of coupon code.

For information regarding API access, please see here, and for complete REST API documentation, visit our Developer Docs.

Did this answer your question?