Skip to main content

Tracking Parameters

URL parameters for affiliate link tracking

Table of Contents

Tracking Parameters

AffiliateBase uses a canonical URL parameter for affiliate tracking. This guide covers supported parameters, how they work, and best practices for using them.

Supported Parameters

Use via for link-token attribution:

ParameterExample
via?via=affiliate-token

You can add optional custom parameter names with script config:

<script
  async
  src="https://cdn.jsdelivr.net/npm/@relay-capital/[email protected]/dist/track.min.js"
  data-account-id="YOUR_ACCOUNT_ID"
  data-affiliatebase-params="partner,invite"
></script>

data-params is also supported as an alias for data-affiliatebase-params.

How Parameters Work

Basic Usage

Append to any URL on your site:

https://yoursite.com?via=john
https://yoursite.com/pricing?via=john
https://yoursite.com/features?via=john&utm_source=twitter

Parameter Processing

When a visitor lands with a tracking parameter:

  1. Script detects the parameter
  2. Validates the affiliate token
  3. Creates/updates referral record
  4. Stores tracking cookies
  5. Removes parameter from URL (optional)

Token Validation

The token must match an active affiliate. Invalid tokens are ignored:

  • Non-existent tokens → No tracking
  • Disabled affiliate tokens → No tracking
  • Valid tokens → Referral created

URL Structure Examples

https://yoursite.com?via=john
https://yoursite.com/pricing?via=john
https://yoursite.com/blog/post-title?via=john

Tracking parameters work alongside others:

https://yoursite.com?via=john&utm_source=twitter&utm_medium=social
https://yoursite.com?plan=pro&via=john

Clean URLs

Some affiliates prefer cleaner URLs:

https://yoursite.com/go/john  (requires server-side redirect)

Parameter Priority

If multiple tracking parameters exist, via is checked first:

?via=john&ref=sarah → "john" is used

Then any custom parameters from data-affiliatebase-params (or data-params) are checked.

Special Parameters

Referral Preloading

Load an existing referral without creating new tracking:

?referral=existing-referral-uuid

Use case: Return visitors from email links where you’ve stored their referral ID.

Custom Parameters

Configuring Custom Parameters

Use script attributes to support custom token parameter names:

  • data-affiliatebase-params="partner,invite"
  • data-params="partner,invite" (alias)

For Affiliates

Affiliates can create links to any page:

Main site: https://yoursite.com?via=TOKEN
Pricing:   https://yoursite.com/pricing?via=TOKEN
Features:  https://yoursite.com/features?via=TOKEN
Blog:      https://yoursite.com/blog?via=TOKEN

Best Practices for Affiliates

  1. Link to relevant pages - Don’t always link to homepage
  2. Use descriptive anchors - “Start free trial” vs “Click here”
  3. Test links first - Verify tracking works
  4. Keep URLs clean - Avoid unnecessary parameters

Using Shorteners

Affiliate links can be shortened:

Original: https://yoursite.com/pricing?via=john
Shortened: https://bit.ly/xyz123

Important: The shortener must pass through parameters. Test before widespread use.

  • Bitly (works well)
  • Rebrandly (works well)
  • TinyURL (works well)
  • Custom domains (recommended for professionals)

Shortener Warnings

Some shorteners strip query parameters. Always test your shortened link to ensure the via parameter arrives at your site.

QR Codes

Creating QR Codes

Generate QR codes for offline promotion:

Encode: https://yoursite.com?via=john

When scanned, visitor lands on your site with tracking active.

QR Code Use Cases

  • Business cards
  • Print materials
  • Product packaging
  • Event displays
  • Physical stores

Deep Linking

Product Pages

Link directly to specific products:

https://yoursite.com/products/widget?via=john

Checkout Pages

Link to checkout with product selected:

https://yoursite.com/checkout?product=pro&via=john

Campaign Landing Pages

Create dedicated pages for campaigns:

https://yoursite.com/special-offer?via=john

Parameter Conflicts

With Existing Parameters

If your site already uses another query parameter for internal purposes:

// This might conflict
?internal_ref=abc123&via=john

// Better: use different parameters
?internal_ref=xyz&via=john

Solving Conflicts

  1. Keep via for affiliate attribution.
  2. Keep your internal parameters under distinct names (for example internal_ref).
  3. If needed, add custom token keys via data-affiliatebase-params.

Testing Parameters

Verify Tracking Works

  1. Open your site with ?via=test-token
  2. Open browser console
  3. Check window.affiliatebase_referral
  4. Should contain the referral ID

Test Different Scenarios

  • Homepage with parameter
  • Deep page with parameter
  • Parameter with other query strings
  • Parameter after page load (SPA navigation)

Troubleshooting

Parameter Not Tracked

  1. Verify parameter spelling
  2. Check affiliate token is valid
  3. Ensure tracking script is loaded
  4. Look for console errors

Parameter Stripped

Some systems strip unknown parameters:

  • CDNs/caching layers
  • Redirect services
  • CMS configurations

Solution: Check your infrastructure and ensure via is preserved end-to-end.

Next steps