General solution - Asynchronous

Integrate Post Affiliate Pro by adding invisible Asynchronous JavaScript to your order confirmation page for efficient sales tracking. Ensure to set Total Cost for percentage commissions. Compatible with most merchant accounts and shopping carts.

General solution - Asynchronous

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

What is the General solution – Asynchronous integration for Post Affiliate Pro?

It’s a method of inserting invisible Asynchronous JavaScript code on your order confirmation or 'thank you for order' page, allowing Post Affiliate Pro to track sales and attribute commissions to referring affiliates without delaying your site’s load time.

Why use the Asynchronous JavaScript integration method?

The asynchronous JavaScript method loads the tracking code only after your website has fully loaded, preventing any delay in page load times and enabling advanced affiliate tracking techniques.

What parameters should be set in the tracking code?

You should set Total Cost (mandatory for percentage commissions), Order ID, and Product ID in the tracking code to ensure accurate sales tracking and campaign recognition.

What if I cannot access the sale or order values in my 'Thank you' page?

If you can't access total cost or order ID values in your 'Thank you' page, consider placing the tracking code where you do have access, or contact your shopping cart provider or Post Affiliate Pro support for further assistance.

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.

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