Microsoft Bing Cashback is a program that allows you to offer a cash rebate on products purchased via Bing Shopping. Someone asked on the Shopify Forums how to integrate, so here we go… (Note: If you do a search on “Microsoft Bing Cashback” in the forums the question that prompted this post doesn’t show up for some reason. For future reference, you can find it here.)

Integration of the Bing Cashback tracking code into Shopify is straightforward. It basically involves replacing variables in the script with their Shopify equivalents. The variables you need are:

  • Order number
  • Item SKU
  • Item price
  • Item quantity

To find out what variables are available, consult the Order page in the Shopify Wiki. Unfortunately it can be a little confusing because unlike other liquid templates, you do not preface the variable name with the object name. For example, instead of {{ order.shipping_method }} it is {{ shipping_method }}.

Once replaced, the script will look like this:


<!–Begin cashback Tracking Pixel Code -->
<script type='text/javascript'>
<!--
  var jf_merchant_id = '12345';
  var jf_merchant_order_num = '{{ order_number }}';
  var jf_purchased_items = new Array();
  // adding cart items for each purchased item
  {% for line in line_items %}
    // add cart item
    var jf_item = new Object();
    jf_item.mpi = '{{ line.sku }}';
    jf_item.price = '{{ line.price | money_without_currency }}';
    jf_item.quantity = '{{ line.quantity }}';
    jf_purchased_items.push (jf_item);
  {% endfor %}
//-->
</script>
<script type='text/javascript' src= 'https://ssl.bing.com/cashback/javascripts/1x1tracking.js'>
<!--End cashbackTracking Pixel Code -->

This code goes in the “Additional Content & Scripts” textbox in the “Checkout & Payment” section under Preferences in Admin. Simply replace the merchant id in the script above and you are good to go.