This integration method is for Ecwid shopping cart. The integration is done with a special code inserted into the cart 'Thank you' page in Ecwid and a plugin in your Post Affiliate Pro merchant panel. The plugin works with ECWID API.

With the plugin you can track per order and per product commissions and you can track coupons. The plugin enables automatic affiliate registration, approval and declining. Additionally you can track Lifetime Commissions.

1.

Enabling the special section

Login to your Ecwid account and navigate to Settings> General> Cart. In the lower section Checkout Settings enable Tracking code on "Thank you for your order" page.

2.

Sale tracking

When tracking code section is enabled, you can easily insert the needed tracking code to your shopping cart:

<script id="pap_x2s6df8d" src="http://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
var orderId = '%order_id%';
var callBack = false;
PostAffTracker.setAccountId('Account_ID');
function getVisitorId() {
	return PostAffTracker._getAccountId() + PostAffTracker._cmanager.getVisitorIdOrSaleCookieValue();
}

function visitorCallBack() {
  if (callBack == false && "null" != getVisitorId()) {
    callBack = true;
    var pixel = document.createElement("img");pixel.width=1;pixel.height=1;
    pixel.src = 'http://URL_TO_PostAffiliatePro/plugins/EcwidAPI/ecwidapi.php?visitorId=' + getVisitorId() + '&orderId=' + orderId;
    document.body.appendChild(pixel);
  }
}

PostAffTracker._cmanager.loadHttpCookies();
if (getVisitorId().indexOf('null') != -1) {
	PostAffTracker._cmanager.readAllFlashCookies();
	setTimeout(function() {visitorCallBack();}, 1800);
	PostAffTracker.executeOnResponce.push(function() {visitorCallBack();});
}
else {
	visitorCallBack();
}

try {
  PostAffTracker.track();
}
catch(e){}
</script>

Save the code.

3.

Enable the tracking plugin

The final step is to activate your Ecwid plugin in your Post Affiliate Pro merchant panel. The plugin needs an authorization first, so navigate to More Info section of the plugin. When it is authorized, you can then configure the plugin and start tracking your sales.

4.

Auto-approval of orders

In case you use a payment gateway which approves transaction payments after customers left the thank you page (wire transfer) you will need to approve commissions with a delay too. To achieve this, you can use ION Cannon function of Ecwid. Simply set the plugin URL (below) into the ION Cannon endpoint URL and PAP will be automatically notified about order status changes. You can find the ION Cannon section in your Ecwid System settings> Apps> Legacy API keys.

http://URL_TO_PostAffiliatePro/plugins/EcwidAPI/ecwidapi.php

For Wix users this section is hidden, so if you want to use ION Cannon, you can access the section directly at https://my.ecwid.com/cp/CP.html#legacy_api

5.

Ecwid used in WIX

In case you use ecwid in WIX, then you can't use the JavaScript version of sale tracking code, because WIX loads each part of the sale tracking code in a separate iframe and that breaks the code. 

Therefore you have to use the hidden pixel version of code:

<img src="https://URL_TO_PostAffiliatePro/scripts/sale.php?TotalCost=%order_subtotal%&OrderID=%order_id%" width="1" height="1" />

That's it.


Do not forget to integrate your site with the click tracking code so the sale tracking will work correctly.