This guide explains how to set up and track coupons specifically for recurring subscriptions.
1. How the General Flow Works
Before diving into the technical setup, here is a quick overview of how the coupon tracking process flows:
Triggering the Conversion: A conversion must be triggered the exact moment a user successfully applies a coupon.
Coupon Redeemed Conversion: This initial action creates a specific
couponredeemedconversion in the system.Returning the CID: The request to redeem the coupon will return a Click ID (CID), which you will need to save for the next steps.
Standard API Integration: Once you have the CID, the rest of the process behaves just like a standard API integration, using that CID to track any future recurring actions.
2. Step-by-Step setup
Step 1: The Coupon Redeem Endpoint
When a user redeems a coupon, you will call this endpoint to log the action and generate the required CID.
Endpoint:
https://YOUR_TENANT_ID.trackdesk.com/tracking/conversion/v1
⚠️ Make sure to replace YOUR_TENANT_ID with your actual Trackdesk Tenant ID.
Note: A successful coupon redemption will return the CID in the response. It is crucial that you save this CID.
Required Payload Information:
couponCode: The exact coupon code the user entered.status: Use the string"CONVERSION_STATUS_APPROVED".conversionTypeCode: Use the fixed string"couponredeemed"for this case. (Note: You must manually create this conversion type in your system first, as it is not included by default.)revenueOriginId: The fixed string ID that you can find following the steps in this article.
Step 2: The Sale Conversion Endpoint
Whenever a recurring charge actually occurs, use the same endpoint to officially create the sale conversions in the system.
Endpoint:
https://YOUR_TENANT_ID.trackdesk.com/tracking/conversion/v1
⚠️ Make sure to replace YOUR_TENANT_ID with your actual Trackdesk Tenant ID.
Required Payload Information:
cid: The unique Click ID you collected during the coupon redemption step.conversionTypeCode: Use the string"sale".amount.value: The charge amount, formatted as a string (e.g.,"100.5").externalId: A unique ID identifying this specific transaction.
Optional fields: You can also include customerId and customParams.AdvS for saving additional information, though these are not mandatory.
3. Testing Your Integration
To make sure everything is working correctly, follow these testing steps:
Create a Coupon: Ensure that the coupon exists on your platform and can be used for discounts.
Redeem the Coupon: Access the website without tracking parameters and enter the coupon code.
Check the Conversion Report: After redeeming, an informational conversion will be added to the Conversion report with the type "Coupon redeemed". After the actual payment goes through, a conversion entry will also be added to reflect the transaction.
