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:
- Open browser Developer Tools (F12) → Console
- Visit:
https://yoursite.com?ref=TEST123 - 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 trackedVerify 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
2. Lead Tracking (Signup)
Steps:
- With cookies set (from step 1), complete your signup flow
- Check console for lead event
Expected console output:
[Affitor] trackLead called with: { email: 'test@example.com' }
[Affitor] Lead event trackedDashboard check:
- Go to Affitor → Integration Status
- Referrals tracker: ✅ Connected
3. Payment Tracking (Sale)
Steps:
- Use Stripe test mode (test card:
4242 4242 4242 4242) - Complete a test purchase
- 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: TEST123customer_code: cust_abc123program_id: YOUR_PROGRAM_ID
Dashboard check:
- Go to Affitor → Transactions
- Test conversion should appear
- Integration Status → Payments tracker: ✅ Connected
Integration Status Dashboard
Check all three integrations at once:
- Go to Affitor Dashboard
- Navigate to Settings → Integration
- 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
- Open incognito window (fresh cookies)
- Visit
yoursite.com?ref=TEST123 - Sign up with test email
- Purchase with Stripe test card
- Check dashboard for: 1 click → 1 signup → 1 conversion
Scenario 2: Returning Visitor
- Visit
yoursite.com?ref=PARTNER_A - Leave site
- Return directly to
yoursite.com(no ref) - Purchase
- Expected: Attributed to PARTNER_A (cookie persists)
Scenario 3: Partner Override
- Visit
yoursite.com?ref=PARTNER_A - Later visit
yoursite.com?ref=PARTNER_B - Purchase
- Expected: Attributed to PARTNER_B (last click wins)
Scenario 4: Expired Attribution
- Visit
yoursite.com?ref=PARTNER_A - Wait 61+ days (or manually clear cookies)
- Purchase
- 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.