Coupon Tracking

Attribute sales to affiliates using unique coupon codes.

Overview

Refgrow allows you to track affiliate sales not only through referral links but also via unique coupon codes. This provides an alternative or supplementary method for affiliates to drive sales and get credit for them. Coupon tracking works with Stripe, LemonSqueezy (via webhooks), and manual conversion tracking.

How Coupon Tracking Works

  1. Create Coupons in Refgrow:

    Navigate to your Project Dashboard -> Coupons. Here you can create coupon codes and assign them to specific affiliates. For each coupon in Refgrow, you can optionally provide:

    • Stripe Coupon ID: The Coupon ID from your Stripe Dashboard (Dashboard → Products → Coupons → click coupon → Details). Can be custom text like SAVE20, summer-discount, or auto-generated like coup_XXXXXXXX.
    • LemonSqueezy Discount Code: If this coupon in Refgrow corresponds to a specific Discount Code you've created in your LemonSqueezy store. This is used by Refgrow to match webhook events from LemonSqueezy.

    The main "Your Coupon Code" in Refgrow is the code your customers will typically use, and it's also used for manual tracking.

  2. Affiliate Shares Coupon:

    Your affiliate shares their assigned coupon code (e.g., "AFFILIATE20") with their audience.

  3. Customer Makes a Purchase:

    A customer uses this coupon code during the checkout process on your website (integrated with Stripe or LemonSqueezy).

  4. Conversion Attribution:
    • Via Webhooks (Stripe/LemonSqueezy):

      When a purchase is completed, Stripe or LemonSqueezy sends a webhook event to Refgrow. This event contains information about the discount or coupon used.

      Refgrow uses an improved matching system that attempts to find the affiliate in this priority order:

      • For Stripe:
        1. Matches by what the customer actually typed during checkout
        2. Matches by Stripe Coupon ID (if configured)
        3. Matches by Stripe Promotion Code ID (if configured)
      • For LemonSqueezy: Matches by the "LemonSqueezy Discount Code" text you entered.

      If a match is found and the coupon is active and assigned to an affiliate, Refgrow attributes the sale to that affiliate and calculates the commission.

      Simplified Setup: In most cases, you only need to set the "Your Coupon Code" to match what customers type. The system will automatically find them by the customer-entered code. Use Stripe Coupon ID or Promotion Code ID only if you need precise control over matching.
    • Via Manual Tracking JS Call:

      You can also track conversions made with a coupon manually by calling the Refgrow() JavaScript function. Pass the coupon code as the fourth argument:

      // Example: Track a $50 purchase made with coupon 'AFFILIATE20'
      Refgrow(50, 'purchase', 'customer@example.com', 'AFFILIATE20');

      Refgrow will then look up 'AFFILIATE20' in your project's coupons and attribute the sale accordingly.

Setting Up Coupons

  1. Go to your Project Dashboard.
  2. Navigate to the Coupons tab from the sidebar.
  3. Click on "Add Coupon".
  4. Fill in the details:
    • Assign to Affiliate: Select the affiliate this coupon belongs to.
    • Your Coupon Code: The primary code customers will use (e.g., "AFFILIATE20"). This must be unique per project. In most cases, this is all you need to set!
    • Stripe Coupon ID (Optional): The Coupon ID from your Stripe Dashboard → Products → Coupons → click coupon → Details. Can be custom text like SAVE20 or auto-generated like coup_XXXXXXXX. Use only if you need precise Stripe integration.
    • LemonSqueezy Discount Code (Optional): Enter the exact discount code text from your LemonSqueezy store if this code corresponds to a LemonSqueezy discount. This is vital for webhook tracking with LemonSqueezy.
    • Status: Set to Active or Inactive.
  5. Click "Add Coupon".

You can edit or delete coupons from the same page.

Note: If a conversion is made using both a referral link (cookie present) AND a coupon code, the coupon code attribution will typically take precedence if the webhook identifies the coupon successfully.

Understanding Stripe Objects

Stripe has different types of discount-related objects that can be confusing. Here's what each one means:

Object Type What It Is Example ID Where to Find
Coupon ID The actual discount configuration in Stripe SAVE20, summer-discount, coup_abc123 Dashboard → Products → Coupons → click coupon → Details
Customer Entered Code What customers actually type during checkout SAVE20PERCENT, HZEFAY This is what appears in the discount field during checkout
Note: In most cases, you only need to set the "Your Coupon Code" field to match what customers type during checkout. The system will automatically find the affiliate when a customer uses that exact code.

Use Cases

  • Influencer Marketing: Provide unique coupon codes to influencers instead of or in addition to referral links.
  • Podcast/Offline Advertising: Share memorable coupon codes in audio or print media.
  • Partner Promotions: Offer special discount codes to specific partners.
  • Simplified Sharing: Some affiliates and customers find coupon codes easier to share and remember than long URLs.

Troubleshooting

  • Coupon not tracking via Stripe Webhook:
    1. First, ensure your "Your Coupon Code" in Refgrow matches what customers type during checkout.
    2. If you're using specific Stripe IDs, verify they match exactly in your Stripe Dashboard.
    3. Use the built-in diagnostic tools in Refgrow (Coupons → Diagnostics dropdown) to validate your setup.
    4. Check server logs for [COUPON DEBUG] messages to see exactly what Refgrow received from Stripe.
  • Coupon not tracking via LemonSqueezy Webhook: Ensure the "LemonSqueezy Discount Code" in Refgrow exactly matches the discount code text used in the LemonSqueezy transaction and passed in the webhook. Check your LemonSqueezy webhook logs and Refgrow server logs.
  • Manual coupon tracking not working: Double-check that you are passing the correct coupon code (the one defined as "Your Coupon Code" in Refgrow) to the Refgrow() JavaScript function.
  • Still having issues? Use the new diagnostic tools available in your Coupons dashboard to validate configuration and find potential problems automatically.

Something missing? Suggest a feature