Tracking Affiliate Sales with WooCommerce and Ontraport (Without a Pricey Plugin!)

If you’re looking for a quick and easy way to track affiliate sales from WooCommerce in Ontraport without shelling out a bunch of money for a plugin like WP-Fusion (though it’s a great plugin, it’s a bit pricey if tracking affiliates is your only real use for it) you can easily do it with the quick little function below:

This reports the following information back to Ontraport:

  • Order ID <– used to help make sure commissions are not tracked twice if some yahoo refreshes the confirmation page a few times. 
  • Customer Email
  • Products Purchased
  • Product Price
  • Quantity Purchased
  • Product SKU

Using it is pretty simple, the first thing you’ll want to do is make sure you have the Ontraport tracking pixel installed on your site already.

Then you’ll want to update YOUR-ACCOUNT-NAME-HERE with the name of your account in the snippet (you can find this from your tracking pixel code — it should be something like

Once you’ve done that, add the snippet to your functions.php.

The final thing you’ll need to do is match the Product SKU in WooCommerce to the corresponding Product ID in Ontraport (can be found in the URL when editing a product in Ontraport, it should look like id=#)

So, if it says id=5 you’d set the SKU in WooCommerce to 5.

Do that with all of the products you plan on using as affiliates, test and make sure it’s working, and you should be good to go!


  • Replace YOUR-ACCOUNT-NAME-HERE with your account name in snippet.
  • Install Tracking Script from Ontraport
  • Install into functions.php
  • Create Products in WooCommerce
  • Create Matching Products in Ontraport
  • Match WooCommerce Product SKU’s to Ontraport Product ID’s
  • Test, Test & Test!