This is an old revision of the document!


type:
integration
supports-foxycart-version-from:
2.0
name:
Bing Conversion Tracking
description:
Track sales within Bing Ads
tags:
bing ads, microsoft
date:
2017-06-26

Bing Ads Conversion Tracking

Please note: The code on this page is submitted by members of the FoxyCart community, and may not verified by FoxyCart.com LLC in any way, shape, or form. Please double check the code before installing. If you need help with it please post in our forum, but if we cannot offer assistance (due to unfamiliarity with this particular system or language) we apologize in advance.

Adding Bing Ads tracking to your store

  1. Firstly, create a UET tag as detailed on this page: http://help.bingads.microsoft.com/#apex/3/en/56682/2
  2. When you get to the last step, copy the javascript code to your clipboard
  3. Login to your store's FoxyCart administration, and head to the “configuration” section
  4. Look for the “Add custom header and footer code to your templates” option and enable it if it isn't already
  5. Within the “footer” textarea, below anything that is already there, enter the code {% if cart_is_fullpage or context == “checkout” or context == “receipt” %}
  6. On the next line paste the code you copied earlier into the “footer” textarea.
  7. Then after the code you just pasted, enter the code {% endif %}
  8. Finally, paste the following code right below what you just pasted in the previous step:
{% if first_receipt_display %}
<script>
window.uetq = window.uetq || [];
window.uetq.push({ 'gv': {{ total_order }}, 'gc': '{{ locale_info.int_curr_symbol|trim }}' }); 
</script>
{% endif %}

After all of those steps, you should have something that looks like the following:

{% if cart_is_fullpage or context == "checkout" or context == "receipt" %}
<script>(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[] ,f=function(){var o={ti:"TAG_ID_HERE"}; o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")} ,n=d.createElement(t),n.src=r,n.async=1,n.onload=n .onreadystatechange=function() {var s=this.readyState;s &&s!=="loaded"&& s!=="complete"||(f(),n.onload=n. onreadystatechange=null)},i= d.getElementsByTagName(t)[0],i. parentNode.insertBefore(n,i)})(window,document,"script"," //bat.bing.com/bat.js","uetq");</script><noscript><img src="//bat.bing.com/action/0?ti=TAG_ID_HERE& Ver=2" height="0" width="0" style="display:none ; visibility: hidden;" /></noscript>
{% endif %}
{% if first_receipt_display %}<script>
window.uetq = window.uetq || [];
window.uetq.push({ 'gv': {{ total_order }}, 'gc': '{{ locale_info.int_curr_symbol|trim }}' }); 
</script>
{% endif %}

Only use the above as a reference of what your resulting code should look like. Make sure you copy the UET tag code from Bing Ads management interface to ensure your tag ID is correctly included.

Creating a conversion goal

  1. Follow the instructions on the following page for creating a goal for Bing Ads: https://help.bingads.microsoft.com/#apex/3/en/56689/2
  2. In step 5, select Destination URL as the goal type
  3. In step 6, select Begins with from the dropdown, and your store's receipt URL into the text input. If your store domain is a FoxyCart subdomain, that will look like YOURSTORE.foxycart.com/receipt or if you have a custom store domain that will look something like ''secure.yourstore.com/receipt. You'll need to update either approaches to ensure it's your own FoxyCart store domain.
  4. In step 8, select The value of this conversion action may vary (for instance, by purchase price) and enter a default price and currency as directed. This default value will be overwritten by the total order price and currency that is passed to the UET tag we created earlier.

Site Tools