How do I add a UET tag to my website?

How do I add a UET tag to my website?

Once you've created a UET tag, you'll need to add it to your website. Learn how to do this in JavaScript, using a tag manager, or for single-page application (SPA) websites.
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. The benefit of using a tag manager is that it allows you to manage your website tags in one place. 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 tab, 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).

See more videos...