Skip to main content

Integrating with Teachable

Learn how to integrate Tapfiliate with Teachable.

Integrating Tapfiliate with Teachable lets you track the course sales your affiliates refer, including the coupon code used at checkout. The setup takes two code snippets: one in your school's Head Code Snippets, and one on the Thank you page of each course you want to track.

Note: Be aware that adding custom code into Teachable schools might require a subscription plan.

Step 1: Add the tracking code to every page

  1. On your School dashboard, go to Site > Code Snippets.

  2. Paste the following code into the Head Code Snippets window:

<script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
<script type="text/javascript">
(function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){ (t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');
tap('create', 'YOUR_ACCOUNT_ID', { integration: "teachable" });
tap('detect');
</script>
  1. Click Save.

Step 2: Add the conversion code to the Thank you page

Repeat these steps for each course whose sales you want to track.

  1. In the left-hand menu, go to Courses and open the course.

  2. At the bottom of the page menu, click Thank you page.

  3. Hover over the first block, Purchase Confirmation, and click Insert new block.

  4. Choose </> Add Liquid/HTML Block and paste the following code into the box:

<script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
<script type="text/javascript">
(function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){ (t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');
tap('create', 'YOUR_ACCOUNT_ID', { integration: "teachable" });
function tapGetQueryParams(){var r={},t=function(r){return decodeURIComponent(r.replace(/\+/g," "))},n=location.search.substring(1).split("&");for(var e in n){var a=n[e].toString().split("=");a.length>1&&(r[t(a[0])]=t(a[1]))}return r}
var qParams = tapGetQueryParams();
if (typeof qParams.final_price !== 'undefined') {
var finalPrice = parseInt(qParams.final_price) / 100;
var options = {
customer_id: "{{ sale.user.email }}",
currency: "{{ sale.currency }}"
};
{% if sale.coupon.code %}
options.coupons = "{{ sale.coupon.code }}";
{% endif %}
tap('conversion', '{{ sale.id }}', finalPrice, options);
}
</script>
  1. Click Save at the top of the screen.

In both snippets, replace YOUR_ACCOUNT_ID with your Tapfiliate account ID. You can find it by following this guide.

The conversion code sends the sale amount, the customer's email as the customer ID, the currency and, if one was used, the coupon code. Coupon codes you have assigned to affiliates are therefore tracked too, see How to Use and Track Coupon Codes.

It's important to ensure the accuracy of your tracking setup before launching your program. To do this, perform a test conversion using the instructions described here.

Did this answer your question?