Testing Integration

Before going live, test your integration to ensure tracking works correctly.


Enable Test Mode

Add data-affitor-debug="true" to your tracker script:

<script
src="https://api.affitor.com/js/affitor-tracker.js"
data-affitor-program-id="YOUR_PROGRAM_ID"
data-affitor-debug="true">
</script>

Test mode:

  • Logs all tracking events to browser console
  • Events still sent to Affitor (marked as test)
  • Visible in dashboard under test events

Test Checklist

1. Pageview Tracking (Click)

Steps:

  1. Open browser Developer Tools (F12) → Console
  2. Visit: https://yoursite.com?ref=TEST123
  3. Look for Affitor debug messages

Expected console output:

[Affitor] Detected ref parameter: TEST123
[Affitor] Setting partner_code cookie: TEST123
[Affitor] Generated customer_code: cust_abc123
[Affitor] Click event tracked

Verify cookies:

  1. Developer Tools → Application → Cookies
  2. Check for partner_code = TEST123
  3. Check for customer_code = some value

Dashboard check:

  1. Go to Affitor → Integration Status
  2. Pageview tracker: ✅ Connected

2. Lead Tracking (Signup)

Steps:

  1. With cookies set (from step 1), complete your signup flow
  2. Check console for lead event

Expected console output:

[Affitor] trackLead called with: { email: 'test@example.com' }
[Affitor] Lead event tracked

Dashboard check:

  1. Go to Affitor → Integration Status
  2. Referrals tracker: ✅ Connected

3. Payment Tracking (Sale)

Steps:

  1. Use Stripe test mode (test card: 4242 4242 4242 4242)
  2. Complete a test purchase
  3. Check Stripe Dashboard → Webhooks for delivery status

Verify metadata (Stripe Dashboard):

  1. Go to Payments → find test payment
  2. Click to view details
  3. Check metadata contains:
    • partner_code: TEST123
    • customer_code: cust_abc123
    • program_id: YOUR_PROGRAM_ID

Dashboard check:

  1. Go to Affitor → Transactions
  2. Test conversion should appear
  3. Integration Status → Payments tracker: ✅ Connected

Integration Status Dashboard

Check all three integrations at once:

  1. Go to Affitor Dashboard
  2. Navigate to Settings → Integration
  3. View status for each tracker:

| Tracker | Status | Meaning | |---------|--------|---------| | Pageview | ✅ Connected | Script installed, receiving clicks | | Referrals | ✅ Connected | Receiving lead events | | Payments | ✅ Connected | Webhook configured, receiving sales |


Common Test Scenarios

Scenario 1: Full Flow Test

  1. Open incognito window (fresh cookies)
  2. Visit yoursite.com?ref=TEST123
  3. Sign up with test email
  4. Purchase with Stripe test card
  5. Check dashboard for: 1 click → 1 signup → 1 conversion

Scenario 2: Returning Visitor

  1. Visit yoursite.com?ref=PARTNER_A
  2. Leave site
  3. Return directly to yoursite.com (no ref)
  4. Purchase
  5. Expected: Attributed to PARTNER_A (cookie persists)

Scenario 3: Partner Override

  1. Visit yoursite.com?ref=PARTNER_A
  2. Later visit yoursite.com?ref=PARTNER_B
  3. Purchase
  4. Expected: Attributed to PARTNER_B (last click wins)

Scenario 4: Expired Attribution

  1. Visit yoursite.com?ref=PARTNER_A
  2. Wait 61+ days (or manually clear cookies)
  3. Purchase
  4. Expected: No attribution (outside 60-day window)

Troubleshooting Test Issues

Console Shows No Affitor Messages

Check:

  • data-affitor-debug="true" is set
  • Script URL is correct
  • No ad blockers/privacy extensions

Cookies Not Setting

Check:

  • URL has ?ref= parameter
  • Site uses HTTPS
  • No Content Security Policy blocking

Webhook Not Firing

Check:

  • Endpoint URL is correct: https://api.affitor.com/api/stripe/webhooks
  • Selected events include checkout.session.completed
  • Stripe is in test mode for test transactions

Go Live Checklist

Before going live, confirm:

  • [ ] Pageview tracker: ✅ Connected
  • [ ] Referrals tracker: ✅ Connected
  • [ ] Payments tracker: ✅ Connected
  • [ ] Test purchase attributed correctly
  • [ ] Commission calculated correctly
  • [ ] Debug mode disabled (data-affitor-debug="false")

Ready to Launch

Once all checks pass, you're ready to invite partners and start generating affiliate revenue.


Next Steps