Teachable Affiliate Program: Complete Integration Guide | AffiliateBase

The easiest way to add affiliate marketing to your Teachable school

Step-by-step guide to integrating affiliate tracking with your Teachable online course platform

Teachable is one of the leading online course platforms, powering thousands of course creators and educators. If you're using Teachable to sell online courses and want to grow your student base through affiliate marketing, AffiliateBase provides seamless integration.

This comprehensive guide will walk you through everything you need to know about setting up an affiliate program with Teachable, from webhook configuration to tracking course enrollments, subscription purchases, and student conversions.

Whether you're selling single courses, course bundles, or subscription-based access, an affiliate program can help you acquire new students while rewarding your partners for successful referrals.

Follow these steps to integrate AffiliateBase with Teachable:

1

Set Up Teachable Webhooks

Navigate to your Teachable admin dashboard and go to Settings > Webhooks. Create a new webhook endpoint pointing to AffiliateBase.
text
https://api.affiliatebase.com/webhooks/teachable
2

Select Webhook Events

Subscribe to the following Teachable events: enrollment.created, purchase.created, and subscription.created. These events will trigger affiliate tracking.
3

Add Webhook Secret to AffiliateBase

Copy your webhook secret from Teachable and add it to your AffiliateBase dashboard under Settings > Integrations > Teachable.
4

Configure Commission Rules

Set up your commission structure in AffiliateBase dashboard. You can configure different rates for different courses or course types.
5

Pass Affiliate IDs to Teachable

Add affiliate tracking parameters to your Teachable course URLs. AffiliateBase will capture these and attribute conversions correctly.
6

Test the Integration

Create a test purchase or enrollment in Teachable to verify that affiliate tracking is working correctly. Check your AffiliateBase dashboard for the conversion.

Teachable Webhook Handler Example

Here's an example of how to handle Teachable webhooks for affiliate tracking:

// Example: Next.js API route for Teachable webhooks
import { headers } from 'next/headers';
import crypto from 'crypto';
import { AffiliateBase } from '@affiliatebase/sdk';

const affiliateBase = new AffiliateBase({
  apiKey: process.env.AFFILIATEBASE_API_KEY!,
});

export async function POST(request: Request) {
  const body = await request.text();
  const signature = headers().get('x-teachable-signature')!;
  
  // Verify webhook signature
  const expectedSignature = crypto
    .createHmac('sha256', process.env.TEACHABLE_WEBHOOK_SECRET!)
    .update(body)
    .digest('hex');
  
  if (signature !== expectedSignature) {
    return new Response('Invalid signature', { status: 401 });
  }
  
  const event = JSON.parse(body);
  
  // Handle different event types
  switch (event.type) {
    case 'enrollment.created':
      await affiliateBase.trackConversion({
        affiliateId: event.data.enrollment.metadata?.affiliateId,
        type: 'course_enrollment',
        amount: event.data.enrollment.price,
        currency: event.data.enrollment.currency,
        customerId: event.data.enrollment.user_id,
        metadata: {
          course_id: event.data.enrollment.course_id,
          course_name: event.data.enrollment.course_name,
          enrollment_id: event.data.enrollment.id,
        },
      });
      break;
      
    case 'purchase.created':
      await affiliateBase.trackConversion({
        affiliateId: event.data.purchase.metadata?.affiliateId,
        type: 'course_purchase',
        amount: event.data.purchase.amount,
        currency: event.data.purchase.currency,
        customerId: event.data.purchase.user_id,
        metadata: {
          purchase_id: event.data.purchase.id,
          items: event.data.purchase.items,
        },
      });
      break;
      
    case 'subscription.created':
      await affiliateBase.trackConversion({
        affiliateId: event.data.subscription.metadata?.affiliateId,
        type: 'subscription',
        amount: event.data.subscription.amount,
        currency: event.data.subscription.currency,
        customerId: event.data.subscription.user_id,
        subscriptionId: event.data.subscription.id,
      });
      break;
  }
  
  return new Response(JSON.stringify({ received: true }), { status: 200 });
}

Why Use AffiliateBase with Teachable?

AffiliateBase is the perfect solution for Teachable course creators who want powerful affiliate tracking without complexity.

Native Teachable Integration

Built-in integration with Teachable webhooks. Automatically tracks course enrollments, purchases, and subscriptions without custom code.

Real-Time Tracking

Track conversions in real-time as students enroll or purchase courses. No delays or batch processing.

Subscription Support

Tracks subscription-based course access, including monthly and annual subscriptions. Ensures affiliates receive commissions for recurring revenue.

Multiple Course Support

Support for different commission rates based on course type, price, or category. Perfect for schools with multiple courses.

Affiliate Dashboard

Give your affiliates a professional dashboard to track their performance, view commissions, and generate affiliate links for specific courses.

Webhook Security

Built-in webhook signature verification ensures only legitimate Teachable events are processed, protecting your affiliate program from fraud.

Frequently Asked Questions

Does AffiliateBase work with Teachable?

Yes! AffiliateBase integrates seamlessly with Teachable through webhooks. It automatically tracks course enrollments, purchases, and subscription sign-ups.

How are course enrollments tracked?

AffiliateBase tracks Teachable enrollments through webhooks. When a student enrolls in a course via an affiliate link, the enrollment.created webhook triggers affiliate tracking and commission calculation.

Can I track subscription-based courses?

Yes! AffiliateBase tracks Teachable subscriptions through the subscription.created webhook. Affiliates receive commissions for subscription sign-ups and can be configured to receive commissions on renewals as well.

Can I set different commission rates for different courses?

Yes! You can configure different commission structures in AffiliateBase based on course, course category, or price. This gives you full control over your affiliate program.

How do I add affiliate tracking to my Teachable course URLs?

Add affiliate tracking parameters to your Teachable course URLs (e.g., ?ref=AFFILIATE_ID). AffiliateBase will capture these parameters and attribute conversions correctly when students enroll or purchase.

Do affiliates get their own dashboard?

Yes! Affiliates get access to a professional dashboard where they can view their conversions, commissions, performance metrics, and generate affiliate links for specific courses.

What happens if a student purchases multiple courses?

Each course purchase is tracked separately. If a student purchases multiple courses through an affiliate link, the affiliate receives commissions for each purchase.

Ready to Launch Your Teachable Affiliate Program?

Get started with AffiliateBase today and start growing your Teachable school through affiliate marketing.