Testing Your Integration
Before inviting affiliates, verify your AffiliateBase integration is working correctly. This guide walks through testing each component.
Prerequisites
Before testing, ensure you have:
- Connected your Stripe account
- Added the tracking script to your site
- Created at least one affiliate (or use a test link)
Step 1: Test the Tracking Script
Verify Script Loads
- Open your website in a browser
- Open Developer Tools (F12 or right-click → Inspect)
- Go to the Console tab
- Look for:
AffiliateBase: Initialized
Check for Errors
In the Console, look for any red error messages mentioning:
affiliatebaseFailed to load resourceContent Security Policy
No errors? Your script is loading correctly.
Step 2: Test Referral Tracking
Click a Test Link
Visit your site with a referral parameter:
https://yoursite.com?via=test
Or use an actual affiliate’s token:
https://yoursite.com?via=affiliate-token
Verify Referral Capture
In the browser console, run:
console.log(window.affiliatebase_referral);
You should see a referral ID string like:
"abc123-def456-ghi789"
Check Cookies
- Go to Application tab (Chrome) or Storage tab (Firefox)
- Expand Cookies → your domain
- Look for
ab_referralcookie
The cookie should contain referral data.
Step 3: Test Conversion Tracking
Make a Test Purchase
- Click an affiliate link to your site
- Add a product to cart
- Complete checkout with Stripe
- Use Stripe test card:
4242 4242 4242 4242
Verify in Dashboard
After the test purchase:
- Open your AffiliateBase dashboard
- Go to Dashboard or Referrals
- Look for the new conversion
- Verify it’s attributed to the correct affiliate
Check Stripe Webhook
- Go to your Stripe Dashboard
- Navigate to Developers → Webhooks
- Find the AffiliateBase endpoint
- Check recent webhook deliveries
- Verify
invoice.paidevents show 200 status
Step 4: Test the Affiliate Portal
If you set up an affiliate portal:
- Log in as an affiliate (or use your test affiliate account)
- Verify the dashboard loads
- Check that referral links are displayed
- Confirm earnings show correctly
Common Testing Issues
”window.affiliatebase_referral is undefined”
Cause: Script hasn’t loaded yet, or you’re on localhost.
Solutions:
- Wait 1-2 seconds after page load
- Test on a deployed site (not localhost)
- Check that the script is in your HTML
”No conversion appeared in dashboard”
Causes:
- Webhook didn’t fire
- Referral cookie wasn’t set
client_reference_idnot passed to Stripe
Solutions:
- Check Stripe webhook logs for errors
- Verify cookie exists before checkout
- Ensure you’re passing
client_reference_idin checkout
”Conversion shows but wrong affiliate”
Cause: Referral was attributed to a different affiliate.
Check:
- What cookie value was set?
- Was there a previous referral?
- Is promo code attribution overriding link attribution?
”Test works but production doesn’t”
Causes:
- Different script configuration
- Missing script on some pages
- Environment variable issues
Solutions:
- Compare test and production HTML
- Verify organization ID is correct for production
- Check all checkout pages have the script
Testing Checklist
Use this checklist to verify your setup:
- Tracking script loads without errors
-
window.affiliatebase_referralpopulated after clicking affiliate link -
ab_referralcookie is set - Test purchase completes successfully
- Conversion appears in AffiliateBase dashboard
- Commission calculated correctly
- Affiliate can see earnings in their portal
Debugging Tools
Browser Console Commands
// Check if script loaded
console.log(typeof window.affiliatebase);
// Get current referral
console.log(window.affiliatebase_referral);
// Get full referral object
console.log(window.AffiliateBase?.referral);
// Check cookies
console.log(document.cookie);
Network Tab
Monitor requests to:
cdn.jsdelivr.net(script loading)api.affiliatebase.com/api/track(tracking calls)
Stripe Webhook Logs
In Stripe Dashboard → Developers → Webhooks:
- View delivery attempts
- Check response codes
- Resend failed webhooks for testing
Test Mode vs Live Mode
Stripe Test Mode
When testing:
- Use Stripe test API keys
- Use test card numbers
- Transactions don’t involve real money
- Webhooks still fire normally
Test Card Numbers
| Card Number | Description |
|---|---|
4242 4242 4242 4242 | Successful payment |
4000 0000 0000 0002 | Card declined |
4000 0000 0000 3220 | 3D Secure required |
Use any future expiration date and any 3-digit CVC.
Next Steps
Once testing is complete:
- Invite more affiliates
- Configure commission rates
- Set up your affiliate portal
- Review Troubleshooting if issues persist