How to set-up Bing Ads conversion tracking on Magento

Jack Wilkinson

Bing Ads Logo

Looking for more How To posts? Check out our How To Page for all the latest tips on Windows, Microsoft Teams, LinkedIn, and more!

Bing Ads is an often-forgotten platform when it comes to advertising online. When marketers are looking to promote a product or service, they generally look at Google AdWords and ignore the fact that Bing Ads even exists. This is a huge mistake.

Bing Ads provides access to a large market of people looking to make a purchase, so much so that advertisers can generally see their Cost per Click be up to 50% lower on Bing compared to Google, in addition to higher conversion rates, meaning that each sale is much cheaper to achieve on Bing.

To correctly analyse how much each conversion is costing you, it is important to implement conversion tracking using Bing’s Universal Event Tracking (UET). Bing provides a simple way of tracking conversions through its UET code, however, it can be a little tricky to implement if you’ve never done it before. Let’s take a look at how we go about integrating Bing’s conversion tracking into Magento, an e-commerce platform.

Creating a UET tag in Bing Ads

The first step to setting up conversion tracking is to create a UET tag and a tracking event. To do this, log in to Bing Ads then select the advertising account you want to track conversions for. You will now see at the side there is a menu, select Conversion Tracking.

Once there, select UET tags and then Create UET tag. It will ask for the UET tag name and a description. You can enter anything you want into this form, it is just so you know what it is.

After hitting Save, we’ve got the UET tag created. Now it is time to integrate it into Magento.

Integrating Bing Ads UET tag into Magento

While still on the UET tags page, take a look at the UET tag you’ve just created and at the end of the table click View tag. Select all of this code and copy it. This code will need to be placed into the Magento template files, so you’ll need access to edit the files or a developer who can do this for you.

In the Magento files, go to the following directory:

magento/app/design/frontend/[theme name]/default/template/page/html

From there, open up the header.phtml file. Towards the top of the file, paste the code you copied earlier – if there are any ‘meta’ tags in the file, paste it below those.

Once that is done, Bing can now track visits to the site, however, we still need to track when a visitor from Bing Ads makes a purchase, so let’s take a look at creating a Conversion Goal.

Creating and integrating a Conversion Goal in Bing Ads with Magento

This is the final piece to the puzzle, enabling the tracking of sales with Bing Ads. In Bing Ads, under Conversion Tracking, go to Conversion Goals, from there click Create conversion goal.

The form seems a little daunting at first. Firstly, for the name, choose something that describes what you’re tracking – in this case, we are tracking sales, so you can just call it “Successful purchase”. Set the type to Destination URL.

Suddenly the form becomes even more daunting, but fear not – we only need to enter a few details here. Firstly, change Destination URL to “Contains” and set the URL to checkout/onepage/success (or your success page after a purchase, if it is different). Revenue value should be set to “The value of this conversion action may vary” and Count should be “All”. Now you can hit Save.

Finally, back in the site files, go to the following directory:

magento/app/design/frontend/[theme name]/default/template/checkout/success.phtml

At the bottom of the file, paste the following code which will send the total order amount to Bing:

<?php
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
?>
<script>
var amount = <?php echo number_format($order->getGrandTotal(), 2); ?>;
window.uetq = window.uetq || [];
window.uetq.push({ 'gv': amount, 'gc': 'PUT YOUR CURRENCY CODE HERE' })
</script>

Save the file, upload all the changes to the site and that’s it.

Bing Ads will now be able to successfully track conversions for the adverts being run on your campaigns – allowing you to analyse the success and performance of each campaign, ad and keyword.