How to Create an Affiliate Program with Squarespace | AffiliateBase

Squarespace is a popular all-in-one platform for building beautiful websites, online stores, and portfolios. If you're running a Squarespace 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 Squarespace, from code injection to form tracking and Stripe payment integration.

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

Follow these steps to integrate AffiliateBase with your Squarespace site:

1

Add the Tracking Script

Add the AffiliateBase tracking script to your Squarespace site. Navigate to **Settings > Advanced > Code Injection** and paste this script in the **Header** 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 Squarespace site, add this script to the **Footer** code injection 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 Form Submissions (Optional)

Add data-affiliatebase="true" to forms to auto-inject the referral ID. Add this script to **Code Injection > Footer** to track form submissions.
html
<!-- Add to Code Injection > Footer -->
<script>
  document.addEventListener('DOMContentLoaded', function() {
    // Auto-inject referral ID into Squarespace forms
    const forms = document.querySelectorAll('form[data-form-id]');
    forms.forEach(form => {
      const referralId = window.affiliatebase_referral || '';
      if (referralId) {
        const hiddenInput = document.createElement('input');
        hiddenInput.type = 'hidden';
        hiddenInput.name = 'affiliatebase_referral';
        hiddenInput.value = referralId;
        form.appendChild(hiddenInput);
      }
    });
  });
</script>
4

Test Your Integration

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

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

Why Use AffiliateBase with Squarespace?

AffiliateBase is the perfect solution for Squarespace users who want to add affiliate marketing without leaving the platform.

No-Code Integration

Add affiliate tracking using Squarespace's code injection feature without complex development.

Form Integration

Track conversions from Squarespace forms, including contact forms and newsletter sign-ups.

Stripe Integration

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

Easy Setup

Simple code injection setup that works with any Squarespace template.

Frequently Asked Questions

Do I need to know how to code to use AffiliateBase with Squarespace?
No! Just copy and paste the script into Squarespace's code injection settings. No coding knowledge required.
Can I track conversions from Squarespace forms?
Yes! You can add a script to automatically inject the referral ID into form submissions.
Does AffiliateBase work with Stripe on Squarespace?
Yes, the tracking script automatically integrates with Stripe Payment Links and Buy Buttons embedded on Squarespace.
What tracking parameters does AffiliateBase support?
AffiliateBase automatically detects ?via=, ?ref=, ?affiliate=, and ?a= URL parameters.

Ready to Launch Your Squarespace Affiliate Program?

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