Customers often share links to promoted products with their friends. When such a referral converts into a new sale, the customer and their friend receive benefits.
Let's imagine the products we're promoting are a black leather jacket, a red hat, and a blue tie. Let's also imagine the customer shares the product link by clicking a Share button on the ecommerce website.
- When the customer shares any of the promoted products, we generate a referral code.
- When the customer's friend redeems the referral code on their first purchase:
- They receive a 10% discount on their total cart value.
- We generate a coupon code for the customer.
- When the customer redeems it on their next purchase, they also receive a 10% discount on their total cart value.
The Referrals and Coupons features must be enabled.
To achieve this, let's create the following:
- A custom event to capture the sharing of the product link.
- A rule to generate the referral code.
- A rule to redeem the referral code.
- A rule to redeem the coupon code from the referral.
Sharing the product link
All incoming data in Talon.One is connected to an event. Talon.One provides default events to capture customer profile and session updates.
In our case, we want to capture the action of a customer sharing a product link when they click a Share button on the ecommerce website. Because this action is not related to a customer session or profile, we cannot use a default event to capture this action.
Let's create a custom event instead.
- Associated entity:
- Event type:
- Attribute type:
- API name:
- Rule Builder name:
Sharing of Product Link
- Rule Builder description:
This event records the sharing of a product link by a customer.
- Available in our Application.
When the customer clicks Share on the leather jacket, the website sends a request to the Track event V2 endpoint with the following payload:
"type": "URL Share",
"url_share": "jacket012345" // the SKU of the product that was just shared
Generating a referral code
Let's open the Rule Builder to build our first rule. It generates a referral code only when the link shared by the customer belongs to one of our promoted products. The generated referral code has a redemption limit of
Let's name the rule
Generate referral code on product share. It has 1 condition and 1 effect.
Rule 1: Condition
Check for event types and validate custom event values: Event type is
Sharing of Product Link is in collection
Rule 1: Effects
- Create referral code:
In the current campaign, Redemption limit is
Store generated value in session.
- Display an Info notification to your user, with the title: Type is
Info, Title is
Your referral code!and Message is
The referral code for your friend is [GeneratedReferral].
Redeeming the referral code
To find potentially discounted products by their SKU, let's
apply a cart item filter
on the received sessions.
This step ensures that the referral works only for our promoted products.
Let's name the filter
To list the SKUs of the promoted products,
let's create a collection
and name it
- Customer's cart items (Current Session): Condition is
SKU of item (Item)and is in collection is
We can now build our second rule, which applies to the friend redeeming the referral code. It checks if the code is valid and if the friend has made any previous purchases. We want the referral offer to apply only to new customers who are making their first purchase.
Let's name the rule
Redeem the referral code. It has 2 conditions and 2 effects.
Rule 2: Conditions
- Referral code is valid
- Validate attribute value:
Closed sessions (Customer Profile)is equal to
Rule 2: Effects
- Discount individual items: Pick a list of items is
promoted_products, Discount name is
10% off per promoted productand Discount Value is
([Item.Quantity] * [Item.Price]) * 10%.
- Create coupon code:
In the current campaign, Recipient is
Advocateand Redemption Limit is
Redeeming the coupon code from the referral
Our third rule applies to the customer, who redeems the coupon code from the referral.
Let's name the rule
Redeem coupon code from referral. It has 1 condition and 1 effect.
Rule 3: Condition
Coupon code is valid.
Rule 3: Effect
Discount session total: Discount name is "10% off" and Discount Value is
[Session.Total] * 10%.