November 9, 2026
1. Coupon tracking overview2. What you need before you start
3. Creating and assigning coupon codes
4. Assigning codes automatically
5. Tracking coupon conversions
6. Rules worth knowing
7. Troubleshooting and best practices
Coupon codes let you track affiliate-driven sales without relying on referral links or cookies. When a customer buys using an affiliate’s code, the conversion is credited to that affiliate even if the customer never clicked their link.
Coupon tracking is especially useful for:
- Influencer marketing
- Offline promotions
- Podcast or video mentions
- Situations where links are not practical
- Cookieless tracking, for example when visitors block cookies or switch device before buying
- Your checkout or billing system supports discount codes.
- Your store is integrated with Tapfiliate (native integration, REST API, postback or Zapier).
- The codes exist in your store before you assign them in Tapfiliate.
Codes are often case-sensitive. The code in Tapfiliate has to match your store exactly.
Step 1: Create the code in your store
- Open your platform’s discount or coupon section (Shopify Discounts, for example).
- Create the code, set its value, usage limits and expiry date.
- Save it.

Step 2: Assign it to the affiliate in Tapfiliate
- Go to Affiliates.
- Click the affiliate’s name to open the details panel.
- Find the Coupon field. To edit it, a team member needs the Manage programs permission (team permissions); without it the field cannot be changed.
- Type the code exactly as it is in your store.
- Press Enter to save it. Only Enter saves the code: if you press Tab, click elsewhere, or leave or refresh the page instead, the code is not saved, even while it still shows in the field.

Setting codes for many affiliates at once
You can include coupon codes in the CSV when you import new affiliates, so a whole batch is set up in one go.For affiliates who are already in your account there is no bulk field in the dashboard, but you are not stuck doing them one by one either: the REST API sets a code on any affiliate, new or existing, so a short script can do the whole list. The call is in the next section.
If affiliates join your program continuously, assigning codes by hand does not scale. You can automate the whole thing, as long as your own system can create the discount code. Tapfiliate cannot create it for you.
Step 1: Get told when someone joins
In Tapfiliate, go to Settings > Integrations > Triggers and create a trigger on the event Affiliate approved for program. If your program approves affiliates automatically, this fires as soon as someone signs up. Choose the Webhook action and enter the URL of an endpoint on your own server (or of your Zap or Make scenario) — not a Tapfiliate address. If you run several programs, limit the trigger to one program with the program filter. If you need codes in more than one program, create one trigger per program and give each its own URL, for example a different path on your server (
/coupons/program-a, /coupons/program-b). The request does not name the program: its headers carry only the event and the delivery ID, the body is the affiliate, and the URL is sent exactly as you entered it. For every request except a test (see Step 2), the URL is what tells your endpoint which program the affiliate joined and which program id to use in Step 3. With one URL for all programs, Step 3 can send the code to the wrong program.Step 2: Create the code in your system
When your backend receives the webhook, it creates a discount code in your checkout, using whatever naming rule you like. Codes are unique across your whole account (see Rules Worth Knowing), so with a trigger per program the rule must give an affiliate a different code in each program, for example with the program in the name: otherwise Step 3 is refused in the second program and the code stays unassigned. Your endpoint can hear about the same affiliate more than once, so before it creates a code it checks two things.
A request it has already handled. If your endpoint does not answer with a 2xx status within 20 seconds, or another webhook action of the same trigger fails, Tapfiliate sends the same request again about 5 minutes, 1 hour, 12 hours and 24 hours after the first attempt. Every attempt carries the same
Tap-Trigger-Action-Id header: store the ID of each request you process and skip a request whose ID is not empty and has already been seen. A request sent with Test action has an empty ID and carries the affiliate who most recently joined any of your programs, whatever the trigger’s program filter or the affiliate’s status: answer it, but don’t create or assign a code for it.An affiliate who already has a code. If an affiliate is disapproved and approved again, the event fires again, with a new
Tap-Trigger-Action-Id. Look up the affiliate’s coupon in the program first (Retrieve an affiliate in a program) and skip them if it is already set.Without these checks your store gets a second code, and Step 3 replaces the affiliate’s code in Tapfiliate: orders with the code they have already shared are no longer credited to them through that code. More in Delivery and Retries and in the webhooks documentation.
Step 3: Write the code back to Tapfiliate
Your backend sends a
PATCH request to programs/{program_id}/affiliates/{affiliate_id}/ with the body {"coupon": "THECODE"}. The webhook body is the affiliate: their id (use it as {affiliate_id}) and their referral_link. It does not contain the program’s id: use the id of the program the trigger is set up for (you can look it up with the REST API’s list of programs). The code then appears on the affiliate in your dashboard and in their portal, exactly as if you had typed it in.The same call works for affiliates who joined long ago, so you can also run it once over your existing list.
Prefer no code at all? The same three steps can be built in Zapier or Make if your checkout system is supported there.
Test it with one affiliate before you let it loose on the whole program. Guides: Webhooks and Event-Driven Workflows and the REST API reference.
Native coupon tracking
Native coupon tracking is available for Shopify, WooCommerce, Wix Stores and Teachable (for Teachable, with the snippet from Integrating with Teachable). With these, conversions are recorded automatically when an order uses a tracked code, including the order value, the affiliate and the date. Our PrestaShop plugin does not send coupon codes to Tapfiliate, so with the plugin alone, an order from a PrestaShop store is not credited to an affiliate by its coupon.
JavaScript, REST API or postback
- JavaScript: add the coupon code to the conversion call. See the JavaScript API docs.
- REST API: include the
couponparameter when creating the conversion. No click id or cookie is needed for that order. See the REST API docs. - Postback (S2S): send
coupontogether withexternal_idfrom your backend. See the postback guide.
Zapier
- Trigger: new order in your platform.
- Filter: the order contains a coupon code.
- Action: create a conversion in Tapfiliate.
- Map the coupon code, order value and customer details.
- A coupon beats a click. If an order carries a code assigned to an affiliate, that affiliate gets the conversion, even if the customer clicked someone else’s link first. An order from a customer who is already in Tapfiliate under the same customer ID, from an earlier purchase, a sign-up or a trial, is the exception in two cases:
- If the program the customer is tied to has lifetime/recurring commissions, the order goes to the affiliate the customer is already tied to, and the coupon is not used. It is not credited to anyone if that affiliate can no longer be credited (for example, they are no longer approved in the program, their account was deleted, or the program is archived), or once that customer’s recurring commissions have ended (a recurring cap is reached or the customer is canceled).
- In any program, if that customer has no affiliate, their order is not credited to anyone, coupon or not.
- Send the coupon only for codes that belong to an affiliate. Through the REST API or postback, a conversion sent with a code that is not assigned to anyone is rejected with “Unknown coupon code”. The customer check above comes first: for a customer who is already in Tapfiliate, the order can be decided before the code is looked at. For all other orders, send the click id instead.
- The JavaScript tracker skips unknown codes. Codes passed in
couponswith the JavaScript conversion call (and by the WooCommerce plugin) that do not belong to any affiliate are ignored, and the conversion is attributed by the click as usual. - One code per affiliate per program. An affiliate in several programs can have a different code in each.
- Codes are unique across your whole account. A code can belong to only one affiliate, and the same code cannot be reused in another program. If you are bringing several stores into one account and two of them use the same code today, one has to be renamed, for example with a country suffix.
- Removing a code does not remove history. Conversions already credited stay as they are.
‼️ Conversions are not being tracked
- Check the coupon exists and is active in your store.
- Check the code in Tapfiliate matches exactly, including capitals.
- Check you pressed Enter after typing it. Only Enter saves it: Tab, a click elsewhere or a refresh does not.
- Check your integration actually sends the coupon with the order.
‼️ The code does not stay saved
- If Tapfiliate refuses a code, a notification at the top right of the page says why. The code is then not saved, even if it still shows in the field: after you reload the page, the field shows the code that is actually saved, or nothing. Press Esc to cancel an edit.
- If you did not see a notification, type the code again, press Enter (only Enter saves it, see Step 2) and wait a moment before you leave or reload the page.
- “This coupon is already in use.” means the code is already used in your account – by another affiliate, whatever their status (disapproved affiliates included), or by this same affiliate in another program. Each code can be used once per account. Give this affiliate a different code, or first remove the code where it is already used.
Best practices
- Use a clear naming rule, for example
AFF_JOHN10. - Test a code before you share it with affiliates: assign a test code to a test affiliate and create a test conversion with it. Place the test order in a private browser window where no affiliate link was opened, with an email address that has not been used on your site for an order, a sign-up or a trial, so that neither a link nor a customer who is already in Tapfiliate decides who gets the order (see Rules Worth Knowing). Then click the conversion on the Conversions page: the code credited it only if it went to the test affiliate and its Tracking source is Coupon (js) or Coupon (api). After the test, disapprove the test commission in the conversion, and cancel the test customer on the Customers page, so that in a program with lifetime or recurring commissions they don’t keep earning a commission every period.
- Never give the same code to two affiliates.
FAQ
❓Can Tapfiliate generate the codes for me?
No. Codes are created in the system that takes the payment. Tapfiliate links them to affiliates and tracks them.❓Do coupons need cookies?
No. Coupon attribution does not depend on cookies at all.❓Can an affiliate have two codes in the same program?
No, one per program. If you need a second code for the same partner, for example a deeper discount for a different audience, use a second program.❓Can I give every new affiliate a code without touching the dashboard?
Yes, with a trigger and the REST API. See Assigning codes automatically.Still need help?
If a coupon conversion is not appearing and the checks above did not find it, write to us at support@tapfiliate.com with the code and the order, and we will trace it.