Summer promotion background
1 July – 31st August 2026 *extended

AI Agents at Zero Cost

Get your

33% off

+ free AI Agent

Use code for monthly and for yearly subscription

General solution - Asynchronous

AffiliateMarketing Integration Tracking JavaScript
PostAffiliatePro Logo

Launch your affiliate program today

Set up advanced tracking in minutes. No credit card required.

General solution – Asynchronous integration

Put an invisible Asynchronous JavaScript code anywhere in the “thank you for order” or order confirmation page that is displayed to the customer after an order is placed or payment is processed.

Post Affiliate Pro is compatible with nearly ALL merchant accounts, payment gateways, shopping carts and membership systems.

What does integration mean?

Integration is a way to connect the affiliate system to your current website, shopping cart or payment gateway in a way the affiliate system will be notified about purchases. When notified, the affiliate system registers the sale, identifies the referring affiliate (if any) and creates an appropriate commission for them

This particular method presented here is about putting an invisible Asynchronous JavaScript code anywhere in the “thank you for order” or order confirmation page that is displayed to the customer after an order is placed or payment is processed.

Asynchronous JavaScript version of general sales/leads tracking code

JavaScript version of integration code is generally recommended, because it allows using advanced tracking techniques. The Asynchronous JavaScript version of general sales/leads tracking code loads only after your site has been fully loaded, so it won’t cause any delay in the load time of your web site.

Open your order confirmation or “thank you for order” page template, and put the following code somewhere into the page:

<div id='papSaleTrackingPlaceholder'></div>

<script type="text/javascript">
  (function(d,t) {
    var script = d.createElement(t); script.id= 'pap_x2s6df8d'; script.async = true;
    script.src = '//URL_TO_PostAffiliatePro/scripts//trackjs.js';
    script.onload = script.onreadystatechange = function() {
        var rs = this.readyState; if (rs && (rs != 'complete') && (rs != 'loaded')) return;

        PostAffTracker.setAccountId('Account_ID');
        var sale = PostAffTracker.createSale();
        sale.setTotalCost('120.50');
        sale.setOrderID('ORD_12345XYZ');
        sale.setProductID('test product');
        
        
        try { PostAffTracker.track(); } catch (e) {}

    }
    var placeholder = document.getElementById('papSaleTrackingPlaceholder');
    placeholder.parentNode.insertBefore(script, placeholder);
    placeholder.parentNode.removeChild(placeholder);
  })(document, 'script');
</script>

where the parameters in setTotalCost(), setOrderID() and setProductID() should be replaced with correct values.

  • Total Cost -(mandatory for % commissions) – price of the product
  • Order ID – (optional) – can be your unique generated order ID to cross-check the sale.
  • Product ID – (optional) – the ID of the product bought.

All fields are optional, but without Total Cost the system will not be able to compute percentage commissions. Also, Product ID is required if you want to take advantage of campaign recognition based on product IDs .

If you need to set total sale cost and order id, but you don’t have access to their values in your “Thank you” page, the situation is more complicated. There is no general solution for this. If you know that you can register the sale at some other place where those values (total cost and order id) are available, you can put the tracking code there. Otherwise, you may contact the creator of your shopping cart for some advice regarding the possibility of placing a conversion tracking code into your e-commerce site (shopping cart) or you may contact us and we would try to help you to find a possible solution (if any).

Frequently asked questions

Lucia is a talented content editor who ensures the seamless publication of content across multiple platforms.

Lucia Halašková
Lucia Halašková
Content Editor

Start Tracking Affiliates with Ease

Integrate Post Affiliate Pro asynchronously and streamline your affiliate sales tracking with advanced JavaScript techniques.

Learn more

General Solution
General Solution

General Solution

Learn how to integrate General Solution Software with Post Affiliate Pro using JavaScript or hidden image tracking for advanced commission tracking across vario...

3 min read
AffiliateMarketing Integration +3
NetSuite
NetSuite

NetSuite

Would you like to improve your affiliate software even more? Check out the NetSuite integration for Post Affiliate Pro.

6 min read
NetSuite Integration +4
1ShoppingCart Integration Guide
1ShoppingCart Integration Guide

1ShoppingCart Integration Guide

Learn how to integrate Post Affiliate Pro with 1ShoppingCart to enhance your eCommerce store's affiliate tracking, automate commissions, and streamline sales pr...

6 min read
E-commerce Integration +3

You will be in Good Hands!

Join our community of happy clients and provide excellent customer support with Post Affiliate Pro.

Capterra
G2 Crowd
GetApp
Post Affiliate Pro Dashboard - Campaign Manager Interface