Post Affiliate Pro have a plugin for Shopify and a handy guide here ->

There are a few issues with their plugin though. Firstly there’s no option to include a Campaign ID, so your clicks will default back the default campaign. Not too much of a problem if you don’t have any commissions on clicks, but it is an issue if you do (and a big issue if your rates are different between campaigns).

I’ve made a feature request (this is a bug imo though) to Quality Unit Support, maybe it’ll get fixed by the time you read this.

In this case you’d have to add the click tracking script into the theme, which is a shame because Shopify does a nice job of enqueuing and running scripts asynchronously.

In terms of the sales tracking script snippet they have forgotten a couple of things;

  • Remember to replace the track.js with the obfuscated version from your PAP dashboard (Tools -> Integration -> Clicks Tracking)
  • There’s no Campaign ID in the Sales Tracking script either, you’ll need to add one in (see below).

I found that the code provided by Quality Unit not only had key things missing, it was full of mistakes which threw JS errors.

Here’s the one I am using instead, I got rid of all the discount stuff as it wasn’t relevant to me;

<script id="pap_x2s6df8d" src="https://YOUR_PAP_INSTALL/scripts/YOUR_OBFUSCATED_CODE" type="text/javascript"></script>
<script type="text/javascript">
if (window.location.href.indexOf('/thank_you') > 0) {

{% for line_item in line_items %}

  var sale{{ forloop.index }} = PostAffTracker.createSale();
  sale{{ forloop.index }}.setTotalCost('{{ line_item.final_line_price | money_without_currency | replace: ',', '' }}');
  sale{{ forloop.index }}.setOrderID('{{order_number}}({{ forloop.index }})');
  sale{{ forloop.index }}.setProductID('{{ line_item.sku }}');
  sale{{ forloop.index }}.setCampaignID('YOUR_CAMPAIGN_ID');
  sale{{ forloop.index }}.setCurrency('GBP');
{% endfor %}


Write a comment