Integrating with Teachable

Out-of-the-box features:
  • Conversion tracking
  • Commission based on order amount
  • Track affiliate coupon code conversions
  • Supports lifetime commissions
  • Track order currency
  • Auto-handle recurring commissions
  • Auto-handle refunds and disputes

Note: Be aware that adding custom code to Teachable schools might require a paid plan.

The integration process will depend on which version of Teachable’s Page editor you are using. To find out which version you are using, you can consult this Teachable guide, which explains the core differences to look out for.

Please follow the steps relevant to your specific case or watch a quick video of the whole process:
Embedded content: https://www.loom.com/share/863b71a3e3cc4d32824e75c5863e0eb7

Page editor 1.0

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

  2. Place the following JavaScript code in 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>
    

    {{{{NO_ACCOUNT_ID_SET_MESSAGE}}}}

  3. Hit save.

  4. Next, go to the left-hand option ‘Courses’ and select the courses which conversions you want to track (if all, repeat the next steps for each course).

  5. Go to Pages > scroll down until you find the ‘Thank you page’ block. Click Edit.

  6. On the first block, called ‘Purchase Confirmation’, hover over and the pop up button ‘Insert new block’ will appear. Click on it to open the options menu.

  7. Click on the option </> Add Liquid/HTML Block.

teachable liquid 1

  1. Paste the following code in 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>
    

    {{{{NO_ACCOUNT_ID_SET_MESSAGE}}}}

  2. Hit the save button on the top of the screen, and you’re done!

  3. Repeat steps 4 to 9 for every course you want to track conversions for.

Pages editor 2.0

  1. Contact Teacheable’s customer support team and request that they enable the Custom HTML block option in your account. In your message, you can explain your use case as follows: “I would like to install affiliate marketing software in my school and track affiliate-driven conversions. However, I do not seem to have custom HTML block option available, so I can’t install tracking scripts. Can this be enabled for me?”

Note: Teachable will be happy to enable this for you so long as you have a paying Teachable account.
2. On your School dashboard, go to Site > Code Snippets.
3. Place the following JavaScript code in the ‘Head Code Snippets’ window.

```js
<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>
```
{{{{NO_ACCOUNT_ID_SET_MESSAGE}}}}
  1. Hit save.
  2. Go to Courses > click on course > Pages. scroll down until you find the ‘Thank you page’ block. Click Edit.
  3. A new tab will open with the Page editor 2.0. If Teachable has enabled the Custom HTML option, you will be able to find it after you click on Add new Block.
  4. In the box that opens, paste the following script.

    <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>
    

    {{{{NO_ACCOUNT_ID_SET_MESSAGE}}}}

  5. Click “Update” to save your changes.

  6. Repeat steps 5 to 9 for every course you want to track conversions for.

Important

Please remember to test a conversion before starting your program. This way you can verify that tracking has been set up correctly. You can create a test conversion by following the steps described here.

Start a 14-day free trial with all our features enabled