Affiliate Link Issues
Affiliate links are how referrals get tracked. If links aren’t working correctly, affiliates can’t earn commissions. This guide helps diagnose and fix link issues.
How Affiliate Links Work
Affiliate shares: yoursite.com?via=token
↓
Visitor clicks link
↓
Tracking script captures token
↓
Referral created, cookie set
↓
Attribution active for purchase
Quick Diagnosis
Test the Link
- Copy an affiliate’s link
- Open in incognito/private browser
- Check console for AffiliateBase initialization
- Verify referral captured:
console.log(window.affiliatebase_referral);
Expected Results
- Script loads: Console shows “AffiliateBase: Initialized”
- Referral captured:
window.affiliatebase_referralhas a value - Cookie set:
ab_referralcookie exists
Common Issues & Solutions
Issue: Link Returns 404
Symptom: Clicking link shows page not found.
Causes:
- Invalid URL structure
- Page doesn’t exist
- Typo in link
Solutions:
- Verify the base URL is correct
- Check the page exists on your site
- Ensure no extra characters in URL
- Test without the tracking parameter first
Issue: Link Works but No Referral Captured
Symptom: Page loads but window.affiliatebase_referral is undefined.
Causes:
- Tracking script not on page
- Invalid affiliate token
- Script error preventing initialization
Solutions:
-
Check script is present:
- View page source
- Search for “affiliatebase” or “jsdelivr”
-
Validate affiliate token:
- Go to Affiliates dashboard
- Find affiliate and check their token
- Ensure token in URL matches exactly
-
Check for JavaScript errors:
- Open browser console
- Look for red error messages
- Fix any blocking errors
Issue: Token Not Recognized
Symptom: Referral shows “Invalid token” or similar.
Causes:
- Affiliate disabled or deleted
- Token changed
- Typo in token
Solutions:
- Verify affiliate is active (not disabled)
- Get fresh token from affiliate profile
- Check for typos (case-sensitive)
- Ensure affiliate belongs to active campaign
Issue: Link Redirects Remove Parameter
Symptom: ?via=token disappears after redirect.
Causes:
- Server redirects stripping query params
- CMS/plugin modifying URLs
- CDN/cache rules
Solutions:
-
Check redirect behavior:
yoursite.com?via=token → yoursite.com ❌ Bad yoursite.com?via=token → yoursite.com?via=token ✓ Good -
Fix server configuration:
- Update redirect rules to preserve query string
- Check .htaccess or nginx config
- Review CDN settings
-
WordPress example fix:
# Preserve query string in redirect RewriteRule ^old-page$ /new-page [R=301,L,QSA]
Issue: Link Tracking Intermittent
Symptom: Links work sometimes but not always.
Causes:
- Race condition with script loading
- Caching issues
- Inconsistent page templates
Solutions:
-
Ensure script on all pages:
- Not just homepage or landing pages
- Include in global template/layout
-
Clear caches:
- Browser cache
- CDN cache
- CMS cache
-
Check template consistency:
- Verify all page templates include script
- Check dynamic pages too
Issue: Link Shortener Breaking Tracking
Symptom: Shortened links don’t track.
Causes:
- Shortener stripping query parameters
- Redirect not passing parameters through
Solutions:
-
Test your shortener:
- Create shortened link
- Click it
- Check if
?via=tokenarrives at destination
-
Use parameter-friendly shorteners:
- Bitly (works)
- Rebrandly (works)
- Custom short domain (recommended)
-
Configure shortener properly:
- Enable query string passthrough
- Test after configuration
Issue: Special Characters in Links
Symptom: Links with special characters break.
Causes:
- URL encoding issues
- Special characters in token
Solutions:
-
URL encode properly:
const link = `yoursite.com?via=${encodeURIComponent(token)}`; -
Avoid special characters in tokens:
- Use alphanumeric tokens
- Replace spaces with hyphens
Issue: Links Not Working on Mobile
Symptom: Desktop works, mobile doesn’t.
Causes:
- Mobile-specific page template missing script
- AMP pages
- Mobile redirect losing parameters
Solutions:
-
Check mobile template:
- Verify script in mobile template
- Test on actual mobile device
-
For AMP pages:
- AMP may require different approach
- Consider linking to non-AMP page first
-
Check mobile redirects:
m.yoursite.comshould preserve params- Responsive sites avoid this issue
Link Validation
Manual Validation
Test affiliate links manually:
-
Format check:
https://yoursite.com?via=TOKEN- HTTPS recommended
- Valid parameter name (via, ref, affiliate, a)
- Valid token
-
Destination check:
- URL should resolve
- No 404 or redirects that lose params
-
Tracking check:
- Script loads
- Referral captured
- Cookie set
Affiliate Self-Check
Provide affiliates instructions to test:
- Open incognito browser
- Click their link
- Open console (F12)
- Run:
console.log(window.affiliatebase_referral) - Should see a referral ID
Link Preview Issues
Social Media Previews
When sharing on social media:
- Preview fetches may not execute JavaScript
- Link preview shows but tracking still works on click
- This is normal behavior
Messaging Apps
Link previews in messaging apps:
- WhatsApp, Slack, etc. may fetch preview
- These fetches don’t create referrals
- Only actual clicks from users create referrals
Best Practices for Affiliates
Share these tips with your affiliates:
Do’s
✅ Test links before sharing widely ✅ Use HTTPS links ✅ Link to relevant, high-converting pages ✅ Keep links simple and readable ✅ Use descriptive anchor text
Don’ts
❌ Modify the token manually ❌ Use broken or outdated links ❌ Share links with extra parameters that break tracking ❌ Use link shorteners that strip parameters
Troubleshooting Tools
Browser Extension
Recommend affiliates use:
- Browser developer tools
- Cookie viewers
- Network inspectors
Testing Workflow
1. Open incognito browser
2. Clear any existing cookies
3. Click affiliate link
4. Check console for initialization
5. Verify window.affiliatebase_referral
6. Check cookies for ab_referral
7. Navigate to checkout page
8. Verify referral still exists
When to Escalate
Contact support if:
- All affiliate links failing
- Issue persists after trying solutions
- Server-side configuration help needed
- Suspected system issue
Include:
- Specific affiliate link that fails
- Error messages seen
- Steps already tried
- Browser and device info