Skip to content

Testing Integration

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


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

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:

  • Developer Tools → Application → Cookies
  • Check for partner_code = TEST123
  • Check for customer_code = some value

Dashboard check:

  • Go to Affitor → Integration Status
  • Pageview tracker: ✅ Connected

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:

  • Go to Affitor → Integration Status
  • Referrals tracker: ✅ Connected

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):

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

Dashboard check:

  • Go to Affitor → Transactions
  • Test conversion should appear
  • Integration Status → Payments tracker: ✅ Connected

Programmatically verify integration:

POST https://api.affitor.com/api/tracking/test
Content-Type: application/json
{
"program_id": "YOUR_PROGRAM_ID",
"step_id": "pageview"
}

Response:

{
"success": true,
"message": "Test event received",
"testEvent": {
"id": "evt_123",
"event_type": "test",
"timestamp": "2026-01-21T12:00:00Z"
}
}

Check all three integrations at once:

  1. Go to Affitor Dashboard
  2. Navigate to Settings → Integration
  3. View status for each tracker:
TrackerStatusMeaning
Pageview✅ ConnectedScript installed, receiving clicks
Referrals✅ ConnectedReceiving lead events
Payments✅ ConnectedWebhook configured, receiving sales
TrackerStatusMeaning
Pageview⏳ PendingScript not detected yet
Referrals⏳ PendingNo lead events received
Payments⏳ PendingNo payment events received

  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
  1. Visit yoursite.com?ref=PARTNER_A
  2. Leave site
  3. Return directly to yoursite.com (no ref)
  4. Purchase

Expected: Attributed to PARTNER_A (cookie persists)

  1. Visit yoursite.com?ref=PARTNER_A
  2. Later visit yoursite.com?ref=PARTNER_B
  3. Purchase

Expected: Attributed to PARTNER_B (last click wins)

  1. Visit yoursite.com?ref=PARTNER_A
  2. Wait 61+ days (or manually clear cookies)
  3. Purchase

Expected: No attribution (outside 60-day window)


Check:

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

Check:

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

Check:

  • Stripe webhook endpoint configured
  • Correct events selected
  • Endpoint URL is correct (https://api.affitor.com/api/stripe/webhooks)

Check:

  • Program ID is correct
  • Backend API is reachable
  • Check Network tab for failed requests

Once all tests pass:

  1. Remove test mode:

    data-affitor-debug="true"
  2. Switch Stripe to live mode (if using test mode)

  3. Verify one real transaction before announcing to partners

  4. Monitor dashboard for first few days


If tests fail after checking troubleshooting steps:

Include:

  • Program ID
  • Browser and version
  • Steps to reproduce