Microsoft/Bing Pixel Implementation with Google Tag Manager
Implementation guide for creating microsoft advertising conversion goals and google tag manager tags
As an analytics engineer at a digital marketing agency, I am tasked with completing the setup and validation of numerous marketing pixels. I have noticed that one pixel, above all else, has a higher rate of being implemented incorrectly. I'm talking about the Microsoft UET pixel, otherwise known as Bing pixel. Continue reading to see how to implement this pixel successfully and troubleshoot any issue that you might run into.
First Things First: Platform Settings
The first part of any marketing pixel implementation is setting up the conversions you want to track within the corresponding advertising platform. In this case, you will be working out of your Microsoft Advertising account.
The first step for getting tracking up and running is using the platform to create your Universal Event Tag (UET). This is the foundation of your tracking for Microsoft as it will fire on every page AND will need to fire before any of you conversion tags.
Once you have your UET tag created in the Microsoft advertising platform, it is now time to set up your conversions. Naturally, the types of conversion you are setting up will depend on your tracking needs. For this article we will be talking about the most important conversion for any e-commerce store: the purchase event.
The first step here is to navigate to your conversion goals and click the nice blue button labeled “+ Create” to get the ball rolling.
The next page will ask you what kind of conversion you want to track and will provide with you three different options.
- Mobile App Install
Since we are focusing on a fictional e-commerce store for this guide, we will click on “Website”, but obviously this will change for you depending on the tracking you need to setup.
Once you pick the type, you will be asked to pick the goal category.
There are a lot of options here, so don't get overwhelmed. Depending on your business needs, your option could be different here, but we are going to click on “Purchase” under the “Sales” category and go from there.
As you can see, after selecting the purchase goal category, we now have three different options for how we want to configure this particular goal. This is probably the most important part of this process as it will directly determine what kind of tag will need to be used when we get to our GTM part.
For this example, we are going to go with a simple setup and implement a destination URL. Go ahead and click the blue “next” button at the bottom of the page so we can see what goes into setting up a destination URL conversion goal.
So now we have gotten to the foundation of this conversion goal. What you set up here will directly affect the tag we will make later in GTM. This is a general example of what this type of conversion will look like. Usually clients will use a destination goal if they just want to track when a customer lands on a thank you page after creating a purchase.
If this is the approach you would like to go with, just be sure that someone can't navigate to a thank you page without having completed a transaction. That way, you won't have to worry about any conversions being inflated.
IMPORTANT: The revenue value is what will determine how revenue information gets counted in the Microsoft advertising platform. This will once again depend on the type of e-commerce store you are running. If you sell multiple products at different prices, then you are going to set this to the “value may vary” option. Whereas, if you are selling one product only, you will be able to define the value of the product. DO NOT SET THIS OPTION TO “DON’T ASSIGN A VALUE” IF YOU NEED REVENUE TO REPORT ON IN THE MICROSOFT PLATFORM.
Be mindful of the logic you choose when it comes to setting the URL for the destination. If you choose the “equals” match option then the URL will need to match EXACTLY with your thank you page URL. Watch out for trailing “/” that can throw off matches or if any of your pages end with a “.php”.
If you use the “contains” match option, make sure you don't have multiple URL's that contain the match statement you have defined.
The platform setup is almost done! All that's left is to do is decide which UET tag to use. After this step, you will be presented with different options on how to implement the tag. Here, we will switch over to GTM to see how the tag should look to match up with the conversion goal.
There are two ways to set up the actual tag that will send information to the Microsoft advertising platform. I will talk about both of them and the pros and cons of each approach. Your two options are a “Custom HTML” tag or to use the Microsoft UET tag template. Both options will work, however, I prefer the tag template as it makes thing easier to match up with the conversion goal set up in the advertising platform.
All Pages/Setup Tag
However, before you set up the conversion tag, make sure you have your all pages UET tag set up. This tag is required to fire before any conversion tags as it will define the function used to send information to the marketing platform. Your setup tag should look similar to the picture below (with the exception of the advertising ID as that should reflect your actual ID that can be found in the platform).
If you do not want to use the tag template you can always set up a custom HTML tag. You will find the code in the Microsoft Advertising platform. If you pull it directly from the platform then the “ti” parameter (first parameter on the second line) should already reflect the correct ID, but definitely double check it just in case
Now that you have set up/verified the setup tag is working properly, we can move on to the actual conversion tag.
Custom HTML Tag
The custom HTML conversion tag will look pretty simple, but there are some important things to point out here to make sure that everything will work correctly. Here is an example of the completed tag, and I will break down everything we see in it.
Luckily the advertising platform will do most of the work for you and there will only be a couple of things to keep in mind while putting this tag together. The first thing I will talk about it the code itself. This is why the setup tag needs to fire before any conversion tag on the website.
The conversion tag uses window.uetq function to keep track of the conversions. This is a similar object to the google tag manager “dataLayer”, which is an entire blog post on its own. The important thing to point out here is that if the setup tag does not fire before the conversion tag, then your website will still be able to fire this tag (which can drive you crazy when you QA because there won't be any errors). BUT if the setup tag does not fire, then this conversion tag will not know where to send this information and it will be sent out into the ether never knowing what account to find.
PRO TIP: Because we set our conversion to fire on a page load tag, it will fire on the same event as our setup tag. Sometimes this can result in a race condition where the conversion tag will fire before the setup tag, resulting in the issue described above. To fix this you can up the priority for the setup tag to make sure it always fires before the conversion tag. This is done by simply placing a number in the “Tag firing priority” box under the “Advanced Settings” box in GTM.
As you can see in the picture, the higher the firing priority, the sooner the tag will fire. This can help to make sure the setup tag will always fire before the conversion tag so the conversions will count correctly.
Now that we have the code setup for the conversion and we've made sure it's going to fire after the setup tag, we can focus on the trigger. Luckily this will mirror what we set up in the platform earlier.
Because GTM has a built in Page View trigger all you need to do is create a new trigger, click the “Page View” type, click the “Some Page Views” option and input the exact same options you used for you conversion in the advertising platform.
The last thing I want to point out is the revenue variable. Usually you will want a dynamic variable to accurately track the revenue. The best type of variable is a dataLayer variable. Unfortunately, setting up a dataLayer is another blog post on it's own. Here is an example of what the dataLayer variable would like in most cases utilizing a GA3 e-commerce dataLayer.
Usually the dataLayer will consist of a nested JSON object, so to select the correct variable you will need to use “dot notation”. This will most likely require some customization on your part to make sure the variable is being selected properly. You can always double check the value by navigating to your checkout page in the GTM preview mode and checking the variables tab.
Now that you have your conversion tag setup with the correct trigger and revenue variable, you can use the GTM preview mode to test the tag and verify it is working correctly. Once you are done, be sure to publish the work to a live version so your conversion tag can start counting in the advertising platform.
Now that we have covered the custom HTML version we can move on to the tag template. I prefer using tag templates as they look a million times better in GTM preview mode, and make checking the variables being passed into the tag much easier to verify.
There are couple of things to point out for this tag. As you can see, the purchase variable and trigger are the same. The track type for this tag needs to match exactly with what you set up in the platform. Because we set up the conversion goal as a destination URL, the tag needs to reflect that exact conversion.
Depending on the revenue type you chose in the conversion goal configuration, you can customize the purchase variable to whatever you need. However, that is it when it comes to setting up the tag with the tag template. Just verify that you have input the correct account ID in the initial tag setup (see trigger and variable setups in the custom HTML section) and you are good to go ahead and QA the tag with GTM Preview mode.
That is how you set up conversion goals and tags for Microsoft advertising. The important thing to remember is that the tag you use to send information to the platform needs to match up exactly with the conversion goal that was set up in the advertising platform.
Nine out of ten times this is the issue I see when I need to troubleshoot issues with conversions populating in the platform. In this article we mainly focused on the destination URL conversion goal. However, the same rule applies (even more so) to an event based goal.
NOTE: For event based conversions the category, action, and label that you define for your event need to match exactly with the category, action, and label you set up in the GTM tag. If they do not, then you may have issues with the conversion counting accurately in the platform.
However, if you have followed this guide to set up your Bing tracking, then you shouldn't have any problems with your conversions being tracked accurately. If you do, feel free to find me on LinkedIn and shoot me a message about about your tracking issues, and I'll be happy to take a look for you!
I currently work as an analytics engineer for a digital marketing agency where I implement custom tagging solutions for a variety of different clients.