Affiliate Link Issues

Troubleshoot problems with affiliate referral links

Table of Contents

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.

Affiliate shares: yoursite.com?via=token

Visitor clicks link

Tracking script captures token

Referral created, cookie set

Attribution active for purchase

Quick Diagnosis

  1. Copy an affiliate’s link
  2. Open in incognito/private browser
  3. Check console for AffiliateBase initialization
  4. Verify referral captured:
console.log(window.affiliatebase_referral);

Expected Results

  • Script loads: Console shows “AffiliateBase: Initialized”
  • Referral captured: window.affiliatebase_referral has a value
  • Cookie set: ab_referral cookie exists

Common Issues & Solutions

Symptom: Clicking link shows page not found.

Causes:

  • Invalid URL structure
  • Page doesn’t exist
  • Typo in link

Solutions:

  1. Verify the base URL is correct
  2. Check the page exists on your site
  3. Ensure no extra characters in URL
  4. Test without the tracking parameter first

Symptom: Page loads but window.affiliatebase_referral is undefined.

Causes:

  • Tracking script not on page
  • Invalid affiliate token
  • Script error preventing initialization

Solutions:

  1. Check script is present:

    • View page source
    • Search for “affiliatebase” or “jsdelivr”
  2. Validate affiliate token:

    • Go to Affiliates dashboard
    • Find affiliate and check their token
    • Ensure token in URL matches exactly
  3. 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:

  1. Verify affiliate is active (not disabled)
  2. Get fresh token from affiliate profile
  3. Check for typos (case-sensitive)
  4. Ensure affiliate belongs to active campaign

Symptom: ?via=token disappears after redirect.

Causes:

  • Server redirects stripping query params
  • CMS/plugin modifying URLs
  • CDN/cache rules

Solutions:

  1. Check redirect behavior:

    yoursite.com?via=token → yoursite.com  ❌ Bad
    yoursite.com?via=token → yoursite.com?via=token  ✓ Good
  2. Fix server configuration:

    • Update redirect rules to preserve query string
    • Check .htaccess or nginx config
    • Review CDN settings
  3. WordPress example fix:

    # Preserve query string in redirect
    RewriteRule ^old-page$ /new-page [R=301,L,QSA]

Symptom: Links work sometimes but not always.

Causes:

  • Race condition with script loading
  • Caching issues
  • Inconsistent page templates

Solutions:

  1. Ensure script on all pages:

    • Not just homepage or landing pages
    • Include in global template/layout
  2. Clear caches:

    • Browser cache
    • CDN cache
    • CMS cache
  3. Check template consistency:

    • Verify all page templates include script
    • Check dynamic pages too

Symptom: Shortened links don’t track.

Causes:

  • Shortener stripping query parameters
  • Redirect not passing parameters through

Solutions:

  1. Test your shortener:

    • Create shortened link
    • Click it
    • Check if ?via=token arrives at destination
  2. Use parameter-friendly shorteners:

    • Bitly (works)
    • Rebrandly (works)
    • Custom short domain (recommended)
  3. Configure shortener properly:

    • Enable query string passthrough
    • Test after configuration

Symptom: Links with special characters break.

Causes:

  • URL encoding issues
  • Special characters in token

Solutions:

  1. URL encode properly:

    const link = `yoursite.com?via=${encodeURIComponent(token)}`;
  2. Avoid special characters in tokens:

    • Use alphanumeric tokens
    • Replace spaces with hyphens

Symptom: Desktop works, mobile doesn’t.

Causes:

  • Mobile-specific page template missing script
  • AMP pages
  • Mobile redirect losing parameters

Solutions:

  1. Check mobile template:

    • Verify script in mobile template
    • Test on actual mobile device
  2. For AMP pages:

    • AMP may require different approach
    • Consider linking to non-AMP page first
  3. Check mobile redirects:

    • m.yoursite.com should preserve params
    • Responsive sites avoid this issue

Manual Validation

Test affiliate links manually:

  1. Format check:

    https://yoursite.com?via=TOKEN
    • HTTPS recommended
    • Valid parameter name (via, ref, affiliate, a)
    • Valid token
  2. Destination check:

    • URL should resolve
    • No 404 or redirects that lose params
  3. Tracking check:

    • Script loads
    • Referral captured
    • Cookie set

Affiliate Self-Check

Provide affiliates instructions to test:

  1. Open incognito browser
  2. Click their link
  3. Open console (F12)
  4. Run: console.log(window.affiliatebase_referral)
  5. Should see a referral ID

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