A Comprehensive Guide to Installing the Bing UET Tag and Conversion Tracking on a Shopify Site

Bing Ads, which has now re-branded to Microsoft Advertising, is a serious competitor to Google Ads. The Cost per Click is often much cheaper and I have seen some impressive conversion rates.

 

UET stands for Universal Event Tracking. The Bing UET tag sends campaign data back to Bing. Essential for managing, optimising and analysing your PPC campaigns.

 

It operates much in the same way as the Google Ads tag or the Facebook pixel. A base tracking script is injected into every page on the site and an additional tag is fired on conversion events, e.g. when a site visitors completes a transaction.

 

One common issue that I have noticed people struggle with, is setting up Bing revenue tracking for their Conversion Goal – we will go through all that step by step later in this guide.

 

Firstly, you need to set up the Universal Event Tracking and Conversion Goal tags inside the Bing dashboard and grab the scripts from there…

 

Setting up a Bing UET Tag

 

Log in to Bing and navigate to (1) Campaigns > (2) Conversion Tracking and click on the (3) ‘Get Started’ button if it is there. If you already have a tag set up in your account then click the ‘View UET tags page’ button.

 

Then create a new tag:

 

Setting up a Bing UET for Shopify

 

Give the tag a name and save it. The name of your website / business or something similar would be suitable.

 

 

The page that follows has a popup where you can copy your Bing UET tag from. 

 

Paste it into a plain text editor like notepad for now – we will use it later.

 

 

Ok, now we have our UET tag. Next we need to set up a Conversion Goal tag and get the corresponding script. 

Setting up a Bing Conversion Goal Tag

 

  1. Click on Conversion Tracking > Conversion Goals in the left side menu. 

  2. Then click the green ‘Create conversion goal’ button.

  1. Give your goal a name e.g. Checkout Event or Transaction Complete. 

  2. Then select ‘Destination URL’ as the Type.

  3. Press ‘Next’ to save it.

 

 

In this last step we will configure the conversion goal:

 

  1. Select ‘Regular expression’ from the drop-down.

  2. Then put


    .*thank_you

    in the URL field.

    The .* is the ‘RegEx’ (Regular Expression) for anything and the transaction confirmation page in Shopify has ‘thank_you’ in the URL.

    So this basic formula is a filtering rule and ensures that Bing will only count conversions that occurred on the checkout thank you page.

  3. For Revenue value choose: Conversion action value may vary (for example, by purchase price).

  4. Now copy the Bing conversion tracking script and paste it underneath the UET script that you pasted in notepad earlier.

 

Click the save button and let’s move on to getting the Bing tags onto your Shopify site.

 

Adding the UET Tag to Your Shopify Site

 

Add your UET tag to your theme:

 

  1. In your Shopify account, go to Online Store > Themes.

  2. Click the Actions drop-down menu.

  3. Then click Edit code.

 

Open the theme.liquid file and find the section.



Paste the UET tag you copied anywhere between the and tags, and then click Save.

The Bing UET script is now installed on every page of your site, except for the checkout… you need to set it up on the checkout pages separately.

 

Adding the UET Tag Code to the Checkout

So the next step is to add the Bing UET tag to your checkout and then we can add in Conversion Goal tracking.

 

  1. In the Shopify dashboard click Settings

  2. Once the Settings page has loaded, click on Checkout




Paste your Bing UET tag code in the Additional Scripts box and click save.



Adding the Conversion Tracking Code to the Checkout

While you are on the same page, paste the second script that you have in notepad (the Conversion Goal script that you copied from the Bing dashboard), into the Additional Scripts box. 

 

Wrap this tag in Shopify’s “Run Once” command. This is because the order confirmation page doubles in utility as a place where people can check their order status. And thus, if they refresh it, it could trigger our code to run multiple times.

The Shopify “Run Once” command starts with:

 

{% if first_time_accessed %} 

 

…and ends the snippet with:

 

{% endif %}

 

So your conversion tag should look like this:

 



Save your Settings page and then the last step is to amend the tag so that it includes your transaction (revenue) data.

 

Sending Revenue Data to Bing Ads

 

Next we need to make some small edits to the conversion script to ensure that the conversion value or revenue is sent back to Bing Ads and tracked alongside the rest of your campaign data.

 

In the previous screenshot, you can see two values highlighted in yellow. We need to edit these to dynamic variables that contain useful information to send to Bing Ads – see Bing’s guide for .

 

This is in fact the same for everyone who has a Shopify store, because we are using inbuilt Shopify variables. Bing actually have a short but useful guide on setting this up specifically for Shopify.

Replace the revenue_value and currency parameters with either one of the following sets of variables (not both!):

 

To exclude taxes and shipping:

 

 'revenue_value': {{ subtotal_price | money_without_currency }}

 ‘currency’: ‘{{ shop.currency }}’

To include taxes and shipping:

 

'revenue_value': {{ total_price | money_without_currency }}

‘currency’: ‘{{ shop.currency }}’

 

This snippet of code inserts the transaction value, so when the tag fires it can then pass it to Bing, where it can be linked up with the rest of the campaign data.

 

See the completed example below where I have chosen to use a revenue value that excludes taxes and shipping.

 

 

Here is a closer look at the revenue_value and currency variables that I edited to include Shopify’s dynamic values:

 

That completes the Bing UET and Conversion Goal tag setup. Press the save button and you are all done.