# Personal discount codes

> A discount code you give to one specific affiliate earns commission – even when the customer never clicked a link.

A personal discount code is a code you tie to one specific affiliate. When a customer uses the code, the affiliate earns commission on the sale – even without a click. It catches the sales a link can't: a customer who declined cookies, or who saw the recommendation on their phone and bought on a computer. How to use the codes with creators is covered in the guide to [influencer marketing](/en/influencer-marketing).

## Personal and general codes

| Code | Earns commission |
|---|---|
| **Personal** – for one specific affiliate | Yes, even without a click. |
| **General** – for all affiliates | No, not on its own. It's the click on the affiliate's link that earns the commission. |

A general code is shared together with the link. It makes the purchase cheaper for the customer, but it doesn't tell you which affiliate the customer came from.

## Create a personal code

1. Create the code in your webshop as an ordinary discount code.
2. Create the same code in Affilyflow under **Program → Discount codes**.
3. Choose the affiliate under **Who is the code for?**. The affiliate must have joined your program.

The affiliate sees the code on the program page under **Din personlige rabatkode** (Your personal discount code) and can share it. Upper and lower case and spaces make no difference when the code is compared.

## Click or code – who gets the sale?

- **A valid click always wins.** If the customer clicked an affiliate's link within the program's cookie period, the click decides the sale – even if the customer uses another affiliate's personal code. Last click wins.
- **Without a valid click, the code decides.** If the customer has no click, or the click has expired, the affiliate the code belongs to gets the sale.
- **Other networks.** In the WooCommerce plugin with **Last click wins** turned on, another network's most recent click also beats a personal code, so you never pay two networks for the same sale.
- **The commission** on a sale through a code is the program's **current** rate. There is no click to lock the rate on.

All the usual safeguards apply: self-referrals are rejected, a blocked affiliate earns no commission, the same order number only counts once, and the first sales from a new account are flagged for review and never approved automatically.

## Privacy

An order without a click is only sent to Affilyflow when it was placed with a personal code. The script and the WooCommerce plugin fetch a list of one-way fingerprints (SHA-256) of your personal codes and compare the customer's code with that list inside your store. Orders with a general code, or with no code at all, never leave your store.

The code needs no storage in the browser. That's why it also works for a customer who has declined marketing cookies.

## How the code reaches us

The code has to be included when the sale is reported. How depends on the platform:

| Platform | How the code is included |
|---|---|
| Custom-built store – the sale line | Add `data-affilyflow-coupon="KODE"` to the line. Separate several codes with commas. |
| Custom-built store – Google Analytics | Automatically: the `coupon` field in the GA4 `purchase` event is read. |
| Custom-built store – from your server | The `coupons` field in the call. See [Server-side tracking](https://www.affilyflow.com/en/docs/store/server-side-tracking). |
| JavaScript | `affilyflow.conversion({ ..., coupon: 'KODE' })`. See [track.js](https://www.affilyflow.com/en/docs/reference/track-js). |
| WooCommerce | Automatically from plugin version 1.11.0. |
| Shoporama | Automatically: the sale code in `thanks.html` sends the order's discount code along. |
| Magento 2, PrestaShop and Shopware 6 | Through the Google Analytics route: the `coupon` field in the GA4 `purchase` event is read when the platform sends it. |
| Stripe | One-off payments only, and only when the Stripe coupon has the same ID as the code. See below. |
| Smartweb, DanDomain and Webflow | Only if the order confirmation template can write the code into `data-affilyflow-coupon` on the sale line. |
| The Shopify app | Does not support personal discount codes yet. |

```html title="The sale line · with a discount code"
<div hidden data-affilyflow-order="1008" data-affilyflow-total="540.00" data-affilyflow-coupon="ANNA10"></div>
```

Without a click, the script only sends a sale that has an order number, so a reloaded order confirmation can never count twice.

### Stripe

Stripe only sends us the coupon's ID – not the promotion code the customer typed. So give the Stripe coupon **the same ID** as the personal code in Affilyflow. This works for one-off payments. Subscriptions still need a click.

## What you and the affiliate see

- **The sale details** on your side show **Attributed via: Personal discount code ANNA10 – no click**.
- **The affiliate** sees the code on the program page and on the sale.
- **Tracking coverage** in Setup counts the sales that came through personal discount codes without a click.

Source: https://www.affilyflow.com/en/docs/store/personal-discount-codes
