Skip to main content

Coupon Tracking with Recurring Subscriptions

Track coupon redemptions for recurring subscriptions by reusing the saved Click ID.

When a customer starts a subscription with an affiliate's coupon, redeem the coupon once to get a Click ID (CID), save it, and send it with every charge. Each recurring payment is then attributed to that affiliate.


​

How it works

  1. When the customer applies the coupon, your server calls the coupon redeem endpoint. Trackdesk finds the affiliate who owns the coupon and returns a CID. No conversion is created at this point.

  2. Save the CID with the customer or subscription record.

  3. On the first charge and on every renewal, create a conversion with that CID.

Setup

Step 1: Redeem the coupon

Send this request when the customer applies the coupon:

POST https://TENANT_ID.trackdesk.com/tracking/coupon/v1/redeem

{
"couponCodes": ["COUPON_CODE"],
"revenueOriginId": "REVENUE_ORIGIN_ID"
}

Replace these values:

  • TENANT_ID: your Tenant ID

  • COUPON_CODE: the code the customer entered. You can send up to 50 codes; the first one that matches an affiliate's coupon is used

  • REVENUE_ORIGIN_ID: your Revenue Origin ID

To store extra affiliate data, you can also send customParams with affS1 to affS5.

The response looks like this:

{
"cid": "b1f3c5a7-9d2e-4a8b-bc11-7c2e0a9f4d6e",
"expiredAt": "2027-04-19T12:00:00Z",
"conversionAttributionType": "CONVERSION_ATTRIBUTION_TYPE_LAST_TOUCH"
}

Save cid with the customer's subscription; you can ignore the other fields.

Step 2: Create a conversion for each charge

On the first payment and on every renewal, send:

POST https://TENANT_ID.trackdesk.com/tracking/conversion/v1

{
"cid": "CLICK_ID",
"conversionTypeCode": "CONVERSION_TYPE",
"amount": { "value": "AMOUNT" },
"externalId": "EXTERNAL_ID"
}

Replace these values:

  • CLICK_ID: the cid you saved in Step 1

  • CONVERSION_TYPE: the code of your Conversion Type, for example sale

  • AMOUNT: the charge amount as a string, for example "100.50"

  • EXTERNAL_ID: a unique ID for this charge, such as the invoice ID, so the same charge is never recorded twice

You can also send customerId and customParams.advS1 to customParams.advS5.


​

Testing

  1. Make sure the coupon exists in Trackdesk and is assigned to an affiliate.

  2. Open your site without tracking parameters, apply the coupon and check that the redeem call returns a cid.

  3. Complete a test payment. A conversion appears in the Conversion report, attributed to the coupon's affiliate.

Did this answer your question?