WordPress powers over 40% of the web, making it the most popular content management system. If you're running a WordPress 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 WordPress, from adding the tracking script to integrating with WooCommerce and membership plugins.
Whether you're running a blog, membership site, or WooCommerce store, an affiliate program can help you grow your audience and increase revenue.
Follow these steps to integrate AffiliateBase with your WordPress site:
Add the Tracking Script
<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/@relay-capital/affiliatebase-tracking@1.0.9/dist/track.min.js" data-account-id='YOUR_ACCOUNT_ID'></script>
Add via functions.php (Alternative)
// Add to your theme's functions.php
add_action('wp_head', function() {
?>
<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/@relay-capital/affiliatebase-tracking@1.0.9/dist/track.min.js" data-account-id='YOUR_ACCOUNT_ID'></script>
<?php
});
Integrate with Stripe
// WooCommerce: Add referral ID to order meta
add_action('woocommerce_checkout_create_order', function($order) {
if (isset($_COOKIE['affiliatebase_referral'])) {
$order->update_meta_data('_affiliatebase_referral',
sanitize_text_field($_COOKIE['affiliatebase_referral']));
}
});
// For Stripe Checkout: Pass as client_reference_id
// This requires custom Stripe integration code
Use Stripe Payment Links or Buttons (Optional)
<!-- Keep Stripe checkout elements on the same page as the AffiliateBase script. -->
<a href="https://buy.stripe.com/xxxxx">Buy now</a>
<stripe-pricing-table
pricing-table-id="prctbl_xxx"
publishable-key="pk_live_xxx"
></stripe-pricing-table>
<!-- For custom or redirected Stripe-hosted links, opt in explicitly. -->
<a data-affiliatebase href="https://link.payment/xxxxx">Buy now</a>
Test Your Integration
// Visit your site with a test affiliate link:
// https://yoursite.com?via=test123
// Check browser console:
console.log(window.AffiliateBase?.referral); // Should show a generated referral ID
Why Use AffiliateBase with WordPress?
AffiliateBase is the perfect solution for WordPress site owners who want to launch an affiliate program quickly.
Easy Installation
Add a single script tag to your WordPress site. No plugin required.
WooCommerce Compatible
Works with WooCommerce for tracking affiliate sales and commissions.
Membership Plugin Support
Integrates with popular membership plugins like MemberPress, Restrict Content Pro, and more.
Stripe Integration
Track conversions from Stripe payments on your WordPress site.
Ready to get started?
Get started with AffiliateBase today and start growing your WordPress site with affiliate marketing.
Start for freeFrequently Asked Questions
Do I need a WordPress plugin for AffiliateBase?
Does AffiliateBase work with WooCommerce?
Can I use AffiliateBase with membership plugins?
What tracking parameters does AffiliateBase support?
Related Platform Guides
Create an Affiliate Program with Next.js
Complete guide to setting up an affiliate program in Next.js. Step-by-step integration with code examples and best practices for Next.js developers.
Create an Affiliate Program with Nuxt
Complete guide to setting up an affiliate program in Nuxt. Step-by-step integration with Nuxt 3, server routes, and composables for Vue developers.
Create an Affiliate Program with Webflow
Complete guide to setting up an affiliate program in Webflow. Step-by-step integration with Webflow CMS, custom code, and forms for no-code developers.
Create an Affiliate Program with React
Complete guide to setting up an affiliate program in React. Step-by-step integration with React hooks, context, and components for React developers.
Create an Affiliate Program with Vue
Complete guide to setting up an affiliate program in Vue. Step-by-step integration with Vue 3, composables, and plugins for Vue developers.
Ready to Launch Your WordPress Affiliate Program?
Get started with AffiliateBase today and start growing your WordPress site with affiliate marketing.