teachable

A platform that lets you easily create and sell online courses even with no design or coding experience.

Teachable lets you easily create and sell online courses even with no design or coding experience.

The integration requires you to edit thank you pages for all courses which you wish to track. It enables you to use per product tracking, lifetime commissions and multiple currencies.

1.

Thank you page integration

Teachable currently doesn't have one general thank you page and therefore it requires you to add tracking codes to every single course you wish to track with Post Affiliate Pro. To do this navigate in your teachable admin account to Courses, Edit a course, then on the left side go to Pages and edit the Thank You Page where you need to check the checkbox for Add Custom Code and enter there the following code:

<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script> <script type="text/javascript">
function getTokens(){
    var tokens = [];
    var query = location.search;
    query = query.slice(1);
    query = query.split('&');

    $.each(query, function(i,value){
        var token = value.split('=');
        var key = decodeURIComponent(token[0]);
        var data = decodeURIComponent(token[1]);
        tokens[key] = data;
    });    return tokens;
}

tokens = getTokens();
PostAffTracker.setAccountId('Account_ID');
var sale = PostAffTracker.createSale();
sale.setTotalCost(tokens['final_price']/100);
sale.setOrderID(tokens['sale_id']);
sale.setProductID(tokens['purchased_course_id']);

PostAffTracker.register();
</script>

If you wish to use Lifetime Commissions then you can save user's ID into the commission by adding the following function under the line with sale.setProductID:
sale.setData1(tokens['user_id']);

If you'd like to save user's email address and it is available on thank you page you will need to customize the code to scrape the email address from the thank you page's content.

If you are selling in multiple currencies and you want to correctly track the commissions using Multiple Currencies feature then also add this line:
sale.setCurrency(tokens['currency'];


Do not forget to insert the click tracking code into your landing pages.

Get the actual click tracking code from your Post Affiliate Pro merchant panel Tools->Integration->Clicks tracking and then navigate in your Teachable admin panel to Site->Code Snippets and insert the code to Head Code Snippets and Save the section.