How to Create an Affiliate Program with Wix | AffiliateBase

Wix is a leading cloud-based web development platform that allows users to create HTML5 websites and mobile sites. If you're running a Wix site and want to monetize it through an affiliate program, AffiliateBase makes it simple.

This comprehensive guide will walk you through everything you need to know about setting up an affiliate program with Wix, from custom code integration to form tracking and Stripe payment integration.

Whether you're running a business website, online store, or portfolio, an affiliate program can help you grow your audience and increase revenue.

Follow these steps to integrate AffiliateBase with your Wix site:

1

Add the Tracking Script

Add the AffiliateBase tracking script to your Wix site. In your Wix Editor, go to **Settings > Custom Code** and add this script to the **Head** section. Using jsDelivr CDN ensures fast global delivery and automatic updates. No hosting required.
html
<script>(function(w,r){w._abq=w._abq||[];w[r]=w[r]||function(){(w[r].q=w[r].q||[]).push(arguments)}})(window,'affiliatebase');</script>
<script async src="https://cdn.jsdelivr.net/npm/affiliatebase-tracking@1/src/index.js" data-org-id='YOUR_ORG_ID'></script>
2

Add Stripe Payment Links Support (Optional)

If you're using Stripe Payment Links or Buy Buttons on your Wix site, add this script to the **Body - end** section to automatically pass the referral ID.
html
<!-- Add to your site alongside the tracking script -->
<script>
  document.addEventListener('DOMContentLoaded', function() {
    setTimeout(function() {
      const referralId = window.affiliatebase_referral || '';
      if (!referralId) return;

      // Update Stripe Payment Links
      document.querySelectorAll('a[href^="https://buy.stripe.com/"]').forEach(link => {
        const url = new URL(link.href);
        if (!url.searchParams.has('client_reference_id')) {
          url.searchParams.set('client_reference_id', referralId);
          link.href = url.toString();
        }
      });

      // Update Stripe Pricing Tables
      document.querySelectorAll('stripe-pricing-table').forEach(table => {
        table.setAttribute('client-reference-id', referralId);
      });

      // Update Stripe Buy Buttons
      document.querySelectorAll('stripe-buy-button').forEach(button => {
        button.setAttribute('client-reference-id', referralId);
      });
    }, 1500);
  });
</script>
3

Track with Wix Velo (Advanced)

For advanced tracking using Wix Velo (Corvid), you can access the referral ID in your page code.
javascript
// In your Wix Velo page code
import wixWindow from 'wix-window';

$w.onReady(function () {
  // Get referral ID from browser
  wixWindow.getBrowserAPI().then(api => {
    const referralId = api.window.affiliatebase_referral || '';
    console.log('Referral ID:', referralId);

    // Store in session or pass to forms
    if (referralId) {
      // Add to hidden form field
      $w('#hiddenReferral').value = referralId;
    }
  });
});
4

Test Your Integration

Publish your Wix site and verify tracking is working with a test affiliate link.
javascript
// Visit your site with a test affiliate link:
// https://yoursite.wixsite.com/mysite?via=test123

// Open browser console and check:
console.log(window.affiliatebase_referral); // Should show "test123"

Why Use AffiliateBase with Wix?

AffiliateBase is the perfect solution for Wix users who want to add affiliate marketing to their websites.

Simple Custom Code

Easy integration using Wix's custom code feature. Just copy and paste.

Stripe Integration

Works seamlessly with Stripe Payment Links, Buy Buttons, and embedded checkout.

Wix Velo Support

Advanced users can leverage Wix Velo for custom tracking logic.

No Coding Required

Basic setup works with any Wix template without writing code.

Frequently Asked Questions

Do I need Wix Premium to use AffiliateBase?
You'll need a Wix Premium plan to add custom code to your site's head section.
Can I track conversions from Wix forms?
Yes! You can use Wix Velo to inject the referral ID into form submissions.
Does AffiliateBase work with Stripe on Wix?
Yes, the tracking script automatically integrates with Stripe Payment Links and Buy Buttons embedded on Wix.
What tracking parameters does AffiliateBase support?
AffiliateBase automatically detects ?via=, ?ref=, ?affiliate=, and ?a= URL parameters.

Ready to Launch Your Wix Affiliate Program?

Get started with AffiliateBase today and start growing your Wix site with affiliate marketing.