Everything you need to know about setting up UET

Everything you need to know about setting up UET

Your one-stop shop for setting up UET: Creating the tag, adding it to your website, and modifying it for advanced features. Troubleshooting tips too!

This article will show you how to create a UET tag, add it to your website, modify it for advanced tracking and targeting features, and troubleshoot issues you may encounter.

Don't know what UET is? Check out What is UET and how can it help me?

Before you can track conversions or target audiences using a remarketing list, you need to create a UET tag in Bing Ads and then add the UET tag tracking code to every page of your website.

  1. Click the Campaigns page, and then on the left pane, click Conversion Tracking.
  2. Under Conversion Tracking, click UET tags.
    Note: If this is the first time you are creating a tag, you can also click Get Started on the Conversion Tracking page.
  3. Click Create UET tag and then enter a name.
  4. Optional: Enter a description that helps you identify the UET tag in the future. This could relate to the purpose the tag will serve or to the name or URL of your website.
  5. Click Save.
  6. In the View UET tag tracking code box, click either Copy, Download or Email, and then click Done.
Important

You need to be able to edit your website's code in order to add your UET tag tracking code. If you're not sure how to edit your website's code, contact your webmaster.

After you create a UET tag, the next step is to add the UET tag tracking code to your website. We recommend that you, or your webmaster, add it to every page of your website in the head or body section. Or, if your site has a master page, you can add it there just once and it will be included on every page of your site.

You have a few options when working with UET tags. You can either add the UET tag tracking code directly into your website's code using JavaScript or use a third-party tag manager. Additionally, if your website was built on a website platform (such as Shopify or WordPress), you can use that system to add your UET tag.

Note

You can add the UET tag tracking code anywhere in your webpage's head section (before the closing head tag: "</head>") or body section (before the closing body tag: "</body>").

Add the UET tag tracking code to your website directly expando image
If you have copied the tracking code, or have a downloaded or email version of it, you are ready to paste it to your website and can skip to step 5.
  1. Click the Campaigns page, and then on the left pane, click Conversion Tracking.
  2. Under Conversion Tracking, click UET tags.
  3. In the table, find the UET tag that you want to use and, in the Action column, click View tag.
  4. In the UET tag tracking code box, click Copy and then Done.
  5. Paste the UET tag tracking code on every page of your website or on the master page, either in the head or body section. In the image, the UET tag tracking code is pasted at the top of the body section of the webpage.
    UET tag
Add the UET tag tracking code using a tag manager expando image

Tag managers replace static tags with dynamic tags that are easier to implement and update. The dynamic tag is a container, a small snippet of code that allows you to dynamically insert tags into your website. You can think of the container tag as a bucket that holds other types of tags.

UET works with all major tag management systems. Here is the current list of (and links to instructions for) tested and supported tag managers:

Add the UET tag tracking code using your website platform expando image

UET is designed to work with all major website platforms. Here is the current list of (and links to instructions for) tested and supported platforms that allow you to install UET tags:

Notes
  • To see an example of a JavaScript UET tag tracking code installed in the body of a webpage, visit this webpage (English-only), right-click in the webpage, and then click View source or View page source depending on your browser.
  • As your webpage loads, it triggers the UET tag, resulting in a number of HTTP requests. The most important request is to "bat.bing" (the one that looks like "http://bat.bing.com/action/0?ti=..."). This request tells Bing Ads about the user visits to your webpage. You can use third-party tools such as Fiddler to monitor all the requests that your browser is making when your webpage loads.

Using UET tags with single-page application (SPA) websites

Although common, single-page application (SPA) websites are challenging to track. With SPAs, content is dynamically loaded without a typical navigation event occurring. In a sense, the page is only loaded once. However, from an analytics and goal-tracking standpoint, it is necessary to treat each separate navigation as a new page load.

Learn what you need to do to enable UET tags in SPAs expando image

SPA websites are required to use the JavaScript UET tag tracking code. SPA events are triggered using the same syntax as with custom events, with the action 'page_view' and at a required 'page_path' parameter ('page_title' is optional). The parameter 'page_path' must start with a '/'. Example:

window.uetq = window.uetq || []; 
window.uetq.push('event', 'page_view', { 'page_path': '/spa_page' });

Here are three different ways of triggering SPA events. Note that we recommend using the first way. For each option, we have a sample webpage that you can visit to see the appropriate code in action.

  • Content change: Trigger an SPA event any time your application loads dynamic content. In this case, the real URL is automatically sent in a standard pageLoad event on the first load. You can use this URL in your destination goals, and any custom events triggered on that first page will be associated with it. Each SPA event will generate a pageLoad event with the SPA URL, which is not required to be a loadable path. You can reference these URLs in your goals as well. Any custom events triggered after an SPA event will only be associated with the SPA pageLoad (in other words, not the original URL).
  • All pages: Trigger an SPA event on all pages, including the initial load. This scenario is the same as the preceding one, except the auto pageLoad event is not used. Because it still triggers, it is important to order your events so that the SPA event triggers before any other custom events. If they trigger out of order, some or all may be associated with the auto pageLoad event (and original URL), instead of the SPA pageLoad event (and SPA URL including page_path).
  • All pages, auto-disabled: Trigger an SPA event on all pages and additionally disable the auto page load. This is accomplished by adding 'disableAutoPageView: true' to the initialization parameters (Note: Do not modify the snippet code directly to disable). This is the same as the previous scenario but removes the requirement that the SPA event must be triggered first on the initial page load. However, subsequent SPA events are still required to be triggered before any custom events that are associated with them (or they will be attributed to the previous SPA event).

Some targeting and tracking features require you to modify your UET tag. The instructions below assume that you have already created a UET tag and added it to your website.

Modifying your UET tag...

To track custom events expando image

Once you've created a custom event conversion goal or remarketing list using custom events (see How to track custom events with UET), you need to add the custom event JavaScript to your UET tag tracking code. Let's say that the custom event you want to track on your webpage is people clicking a "Download now" button on one of your webpages.

  1. Add the following custom event JavaScript below the UET tag that you added to your webpage's code in Step 1:
    <head>Your page title 
    </head>

    <body>

     // Let's say this is where you pasted the UET tag in Step 1.


    <script>Your UET tag is here.</script>

     // Here is where to paste the following JavaScript:

    <script>
       window.uetq = window.uetq || [];
       window.uetq.push ('event', 'Replace_with_Event_Action', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value'});
    </script>



       ...
    <button>Download now</button>

       ...
    </body>
  2. Give this code snippet a function name. The function name can be anything, as long as it hasn't already been used in your website. In this example, we're naming it "GetCustomEvent()":
    <head>Your page title 
    </head>

    <body>
    <script>Your UET tag is here.</script>

    <script>

       function GetCustomEvent() {

       window.uetq = window.uetq || [];
       window.uetq.push ('event', 'Replace_with_Event_Action', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value'});

       }

    </script>

       ...
    <button>Download now</button>

       ...
    </body>
  3. You now need to customize your webpage's code to call this function when the appropriate action occurs. In our example, the custom event is a click of the "Download now" button, so we'd need to add a call in the button's code:
    <head>Your page title 
    </head>

    <body>
    <script>Your UET tag is here.</script>

    </script>

    <script>
       function GetCustomEvent() {
       window.uetq = window.uetq || [];
       window.uetq.push ('event', 'Replace_with_Event_Action', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value'});
       }
    </script>

       ...
    <button OnClick="GetCustomEvent()">Download now</button>

       ...
    </body>
  4. Note the four different parameters in the custom event JavaScript: 'event', 'event_category', 'event_label', and 'event_value'. These correspond to the parameters you had the option to define for your custom event conversion goal in Step 2. In the JavaScript you added, the parameters have placeholder values assigned to them:
    <head>Your page title 
    </head>

    <body>
    <script>Your UET tag is here.</script>

    </script>

    <script>
       function GetCustomEvent() {
       window.uetq = window.uetq || [];
       window.uetq.push ('event', 'Replace_with_Event_Action', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value'});
       }
    </script>

       ...
    <button OnClick="GetCustomEvent()>Download now</button>

       ...
    </body>
  5. The JavaScript you added needs to return a value to Bing Ads when the custom event occurs, and that value needs to match what you entered in Step 2. In our example, we are tracking button clicks, which are Action events as shown in Step 2 (and are represented by 'event' in the JavaScript). So we would need to modify the placeholder value of the 'event' parameter (and we can remove the other three parameters):
    <head>Your page title 
    </head>

    <body>
    <script>Your UET tag is here.</script>

    <script>
       function GetCustomEvent() {
       window.uetq = window.uetq || [];
       window.uetq.push ('event', 'downloadbuttonclick', {});
       }
    </script>

       ...
    <button OnClick="GetCustomEvent()>Download now</button>

       ...
    </body>
  6. Save and deploy your edited website code.

To see an example of a custom event UET tag tracking code installed in the body of a webpage, visit this webpage (English only), right-click in the webpage, and then click View source or View page source depending on your browser. On this page, you'll also see some buttons. Clicking each button will trigger a custom event. If you use a third-party monitoring tool like Fiddler, you can see the HTTP request generated to bat.bing.com to report each custom event.

Notes
  • As your webpage loads, it triggers the UET tag, resulting in a number of HTTP requests. The most important request is to "bat.bing" (the one that looks like "http://bat.bing.com/action/0?ti=..."). This request tells Bing Ads about the user visits to your webpage. You can use third-party tools such as Fiddler to monitor all the requests that your browser is making when your webpage loads.
  • For custom events, an additional HTTP request is triggered to report the same to Bing Ads. The request is similar to the bat.bing but it has different parameters to report custom event (as opposed to just page visit).
To track variable revenue expando image

Once you've created a variable revenue conversion goal (see How to report variable revenue with UET), you need to edit the UET tracking code to support it.

Let's look at how to pass variable revenue for a destination URL type goal in PHP pages. In the below example, it's reading a dynamic value for the variable revenue from a JavaScript function. You can just as easily send a static value or read from a JavaScript variable or HTML element.

To add the code to PHP pages using your webpage editor, see the sample UET tag tracking code below:

                  <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>

<script> function GetRevenueValue() { return 6; }
</script>
<script>
window.uetq = window.uetq || []; window.uetq.push('event', '', {'revenue_value': GetRevenueValue(), 'currency': 'Replace_with_Currency_Code'});
</script>
  1. Open your conversion confirmation page file. If multiple pages are generated from the same file, find the section in the file that generates your conversion page.
  2. Add or confirm that your site has a JavaScript function that defines variable revenue. In the above code, it is:
    <script>
       function GetRevenueValue()
    	  {
    		 return 6;
    	  }
    </script>

    You’ll need to replace this section with your own JavaScript function.

  3. Append the uetq.push code to the end of the UET tag tracking code to associate the revenue value with a conversion goal. Update the amount value for 'revenue_value' parameter with value defined in step 2. In the above code, it is:
    <script>
       window.uetq = window.uetq || [];
       window.uetq.push('event', '', {'revenue_value': GetRevenueValue(), 'currency': 'Replace_with_Currency_Code'});  
    </script>

    Notes
    • The command 'event' is always required, even if you're not reporting any Event action. When you're reporting variable revenue for a destination URL goal, you need to leave Event action empty (as in, 'event', '') and can only have revenue_value and currency parameters in the event.
    • To see the complete list of currency codes, see Conversion Goal Revenue Currencies. You can remove the 'currency' parameter if no currency is set in the conversion goal.

  4. Make sure you add the modified UET tag tracking code to the body of the conversion confirmation page, which is the page the customer sees after they complete the action you want to track (for example, the Purchase confirmation page).

    Tip: Search for the "</body>" tag and place the UET tag tracking code immediately above it.

  5. Save and upload the page to your web server.
Advanced: Code samples for event conversion goalsexpando image

Now that you know the code to append to the end of the UET tag tracking code for destination URL conversion goals, here are a few others you might want to try:

Event conversion goal

There is different code you need to append to report variable revenue for an event conversion goal. If you are using the same JavaScript function as in Step 2, it would look like this:

                        <script>
   window.uetq = window.uetq || [];
   window.uetq.push('event', 'Event action', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value', 'revenue_value': GetRevenueValue(), 'currency': 'Replace_with_Currency_Code'});  
</script>

Note: To see the complete list of currency codes, see Conversion Goal Revenue Currencies.

Notes
  • To see an example of a variable revenue UET tag installed in the body of a webpage, visit this webpage (English only), right-click in the webpage, and then click View source or View page source depending on your browser.
  • As your webpage loads, it triggers the UET tag, resulting in a number of HTTP requests. The most important request is to "bat.bing" (the one that looks like "http://bat.bing.com/action/0?ti=..."). This request tells Bing Ads about the user visits to your webpage. You can use third-party tools such as Fiddler to monitor all the requests that your browser is making when your webpage loads.
  • For variable revenue, an additional HTTP request is triggered to report this value to Bing Ads. It is similar to the bat.bing but it has different parameters to report revenue (as opposed to just page visit).
  • You can validate the variable revenue tag using UET Tag Helper.
To use product audiences expando image

Once you've created a product audience (see About product audiences), you need to add custom parameters to your UET tag tracking code to make it work.

Add the following JavaScript in each page of your website:

                  
                    <script>
                  
     window.uetq = window.uetq || [];
   window.uetq.push ('event', '', {'ecomm_prodid': 'Replace_with_Product_ID', 'ecomm_pagetype': 'Replace_with_Page_Type'});
</script>

In the above JavaScript, change the following parameters:

  • Replace_with_Product_ID : Replace this with one of the following product IDs:
    • The exact SKU ID that uniquely identifies a product. This is sometimes called a UPC (universal product code).
    • An item group ID representing a set of variants for the same product (such as color or size options).

    Important

    The product ID in your JavaScript code must match an ID in your Bing Merchant Center product feed.

  • Replace_with_Page_Type : Replace this with the one of the following values in the right-hand column of this table, depending on the page you will be using this JavaScript in:
    Product audience you're trackingRequired page type
    General visitorshome/category/other, purchase*
    Note: Any user not included in the page type for searchresults, product, cart, or purchase will be included in the general visitors audience.
    Product searcherssearchresults, purchase*
    Product viewersproduct, purchase*
    Shopping cart abandonerscart, purchase*
    Past buyerspurchase

    *The purchase page is required for all audiences to allow you to remove the customer from an audience after the customer makes a purchase.

To see an example of a product audiences UET tag tracking code installed in the body of a webpage, visit this webpage (English only), right-click in the webpage, and then click View source or View page source depending on your browser. On this page, you can also define a product ID and page type, and then click a button to trigger a custom event for this product audience. If you use a third-party monitoring tool like Fiddler, you can see the HTTP request generated to bat.bing.com to report each custom event.

Notes
  • As your webpage loads, it triggers the UET tag, resulting in a number of HTTP requests. The most important request is to "bat.bing" (the one that looks like "http://bat.bing.com/action/0?ti=..."). This request tells Bing Ads about the user visits to your webpage. You can use third-party tools such as Fiddler to monitor all the requests that your browser is making when your webpage loads.
  • For custom events, an additional HTTP request is triggered to report the same to Bing Ads. The request is similar to the bat.bing but it has different parameters to report custom event (as opposed to just page visit).
  • You can validate that your product audience UET tag tracking codes are working using the UET Tag Helper.
When implementing multiple features expando image

As discussed in the above sections, certain Bing Ads features require you to add and modify a JavaScript snippet to your existing UET tag:

  • Custom events: For conversion goals or remarketing lists based on custom events, you need to modify the following snippet to return the event action, event category, event label, and/or event value:
    <script>
       window.uetq = window.uetq || [];
       window.uetq.push ('event', 'Replace_with_Event_Action', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value'});
    </script>
  • Variable revenue: For conversion goals tracking variable revenue, you need to modify the following snippet to return the revenue value and currency code:
    <script>
       window.uetq = window.uetq || [];
       window.uetq.push ('event', '', {'revenue_value': 'Replace_with_Revenue_Value', 'currency': 'Replace_with_Currency_Code'});
    </script>
  • Product audiences: To target a product audience, you need to modify the following snippet to return the product ID and page type:
    <script>
       window.uetq = window.uetq || [];
       window.uetq.push ('event', '', {'ecomm_prodid': 'Replace_with_Product_ID', 'ecomm_pagetype': 'Replace_with_Page_Type'});
    </script>

If you are implementing more than one of these features, there are a couple things to keep in mind:

  • We recommend keeping each feature's JavaScript snippet separate in your webpage's code (in other words, in separate <script></script> sections) because each snippet sends out one event.
  • In specific, you can't use one JavaScript snippet to track both of the following on the same webpage:
    • Variable revenue for the Destination URL conversion goal
    • Custom events based on a conversion goal or remarketing list

    In this case, you will need to have two separate snippets in your webpage's code:

    • Snippet 1 — for variable revenue for the Destination URL conversion goal:
      <script>
         window.uetq = window.uetq || [];
         window.uetq.push ('event', '', {'revenue_value': 'Replace_with_Revenue_Value', 'currency': 'Replace_with_Currency_Code'});
      </script>
    • Snippet 2 — for custom events based on a conversion goal or remarketing list. However, note that, if you are tracking variable revenue for a custom event conversion goal (not a Destination URL conversion goal), you would include this in the custom event code snippet:
      <script>
         window.uetq = window.uetq || [];
         window.uetq.push ('event', 'Replace_with_Event_Action', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value', 'revenue_value': 'Replace_with_Revenue_Value', 'currency': 'Replace_with_Currency_Code'});
      </script>

UET Tag Helper

The easiest way to validate that your UET tag is working properly on any given webpage is to use UET Tag Helper (a Chrome extension):


Review the UET tracking status column in Bing Ads

You can also use Bing Ads to validate:

  1. Click the Campaigns page, and then on the left pane, click Conversion Tracking.
  2. Under Conversion Tracking, click UET tags.
  3. In the table, review the columns:
    Tag name
    What it is:
    The name of the UET tag.
    Why it's important:
    When you create a conversion goal or remarketing list, you select the name of the UET tag that you want to use.
    Tag description
    What it is:
    The optional description for the UET tag.
    Why it's important:
    It helps you identify the UET tag. We recommend adding the website page name or URL.
    Tag ID
    What it is:
    The ID Bing Ads associates with the UET tag.
    Why it's important:
    The Conversion goals page lists the UET tag ID associated with the goal and you can view the UET tag tracking code.
    Tracking status
    What it is:
    This is the status of the UET tag. It can be unverified, tag active, or tag inactive.
    Why it's important:
    Lets you know if your UET tag is working or not.
    Unverified: Bing Ads hasn’t received any user activity data from the UET tag on your website. It can take up to 24 hours for Bing Ads to verify. If you still see this status, you either have not added the UET tag tracking code to your website or there is an issue with the setup that you need to fix.
    Tag active: Your UET tag is working and sending user activity data to Bing Ads.
    Tag inactive: Bing Ads has not received any user activity data from the UET tag in the last 24 hours. Make sure that the UET tag tracking code is still on your website.
    • What to do if the UET tag is inactive: If the Tracking status column lists Tag inactive, then Bing Ads has not received any user activity data from the UET tag in the last 24 hours. Make sure that the UET tag tracking code is still on your website and, if it is not, add it again. You can also use UET Tag Helper to validate your tag.
    Goals
    What it is:
    This is the number of conversion goals that use this UET tag.
    Why important:
    It is a link that takes you to the Conversion goals page with only the goals associated with this tag displayed.
    Audiences
    What it is:
    This is the number of audiences that use this UET tag.
    Why important:
    It is a link that takes you to the Audience page with only the audiences associated with this tag displayed.
    Action
    What it is:
    A link that opens the UET tag tracking code box.
    Why important:
    It allows you to email, copy, or download the UET tag tracking code at any time.

Limitations of the tracking status column: While we believe the tracking status will help you validate your setup, we do want to call out that the following cannot be verified from the tracking status column:

  • Whether or not the UET tag has been installed across the site: Bing Ads reports status of the UET tag as Tag active as long as at least one UET event was logged (from any part of your website).
  • Whether or not custom events/variable revenue values are being reported: As explained above Bing Ads does not distinguish between page load events (logged by default) or custom events reported when the tracking status column.

Therefore, we recommend using UET Tag Helper to validate your tag on your individual webpages.

See more videos...