Partner
Easily sell digital as well as physical products with this plugin.
This integration method integrates Cart66 (WordPress plugin) receipt page.
Sale tracking
The integration is pretty easy. The only step you have to take is to edit file wp-content/plugins/cart66/views/receipt.php and to find a line with this code:
if(Cart66Setting::getValue('enable_google_analytics') == 1 && $order->viewed == 0)
Now, copy the code below and paste it just above the mentioned line:
<!-- Post Affiliate Pro integration snippet -->
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');
var sale = PostAffTracker.createSale();
sale.setTotalCost('<?php echo number_format($order->total, 2, ".", ""); ?>');
sale.setOrderID('<?php echo $order->trans_id; ?>');
sale.setProductID('<?php echo get_bloginfo("name"); ?>');
PostAffTracker.register();
</script>
<!-- /Post Affiliate Pro integration snippet -->
That’s it. Save your changes. Now your system is integrated.
Per product tracking
In case you want to track your orders per product, please use this code instead:
<!-- Post Affiliate Pro integration snippet -->
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');
<?php
$i = 1;
foreach ($order->getItems() as $item) {
?>
echo "var sale$i = PostAffTracker.createSale();";
echo "sale$i.setTotalCost('".$item->product_price * $item->quantity."');";
echo "sale$i.setOrderID('".$order->trans_id."(".$i.")');";
echo "sale$i.setProductID('".$item->product_id."');";
<?php
$i++;
}
?>
PostAffTracker.register();
</script>
<!-- /Post Affiliate Pro integration snippet -->
Coupon tracking
In case you want to support coupon tracking, add this code to your sale tracking code:
<?php
if (!empty($order->coupon) && !empty($couponCodeUsed)) {
$coupons = explode(" (",$couponCodeUsed, 2);
echo "sale.setCoupon('".$coupons[0]."');\n";
}
?>
If you want to use discount amount in your sale tracking code for something, you can use this variable:
$order->discount_amount
Cart66 on Cloud
In case you have the cloud-based Cart66 then the integration is possible too. You won’t be able to track per product orders, but still you can track order subtotal and order ID. Add the following HTML tracking code to your thank you page:
<img src="//URL_TO_PostAffiliatePro/scripts/{$ImageTrackUrl}&TotalCost={{order_subtotal}}&OrderID={{order_number}}" width="1" height="1" />
That’s it. Save your work and you are done.
Do not forget to integrate your WordPress with click tracking code.