← All Guides

Microsoft Ads UET Tag Setup with GTM: Conversion Goals, Variable Revenue, Enhanced Conversions and Consent Mode

How to install the Microsoft Advertising UET tag through Google Tag Manager, create event-based conversion goals that fire from your dataLayer with revenue, enable enhanced conversions with hashed email and phone, pass consent signals, and verify with the UET Tag Helper.

Atiqul Islam
Written by Atiqul Islam

Tracking & analytics specialist. 278+ GTM, GA4 and server-side tracking projects for clients in the US, UK and Australia.

Rather not do this yourself? I set this up for clients every week. Free 15-minute audit, no obligation.

Book a Free Audit

Microsoft Advertising runs on the UET tag, the Universal Event Tracking tag, which works much like the Google tag: a base tag on every page, events pushed from the page, conversion goals defined in the account. Through GTM, it reuses the dataLayer you already have. This guide covers the base tag, event goals with revenue, enhanced conversions and consent.

Step 1: Create the UET Tag

In Microsoft Advertising, open Tools, then Conversion tracking, then UET tags, and create a tag. Copy the tag ID. Keep one UET tag per account unless you have a specific reason for more.

Step 2: Base Tag in GTM

Add the Microsoft Advertising UET template from the Community Template Gallery. Configure it with the tag ID, event type Page load, a consent requirement for ad_storage, and the All Pages trigger plus the consent update event.

Raw snippet for reference:

<script>
(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:"YOUR_TAG_ID", enableAutoSpaTracking: true};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>

The enableAutoSpaTracking option handles single page app route changes.

Step 3: Event Goals

In Conversion tracking, then Conversion goals, create a goal of type Event. Set the category such as Purchase or Lead, and define the match: event action equals purchase for ecommerce, generate_lead for leads, with revenue from the event's value. Set Count to Unique for leads and All for purchases. Save.

Create one goal per outcome, matching the names you will send.

Step 4: Fire Events From the dataLayer

Create a UET template tag per event with event type Custom, event action set to the goal's action such as purchase, and parameters: event_category, event_label, event_value, plus revenue_value and currency for purchases. Trigger on the dataLayer event. With raw code:

<script>
window.uetq = window.uetq || [];
window.uetq.push('event', 'purchase', {
  event_category: 'ecommerce',
  event_label: {{dlv - ecommerce.transaction_id}},
  revenue_value: {{dlv - ecommerce.value}},
  currency: {{dlv - ecommerce.currency}}
});
</script>

For leads:

<script>
window.uetq = window.uetq || [];
window.uetq.push('event', 'generate_lead', {
  event_category: 'lead',
  event_label: {{dlv - form_name}},
  revenue_value: {{LT - lead value}},
  currency: 'USD'
});
</script>

Step 5: Enhanced Conversions

In the UET tag settings in Microsoft Advertising, enable enhanced conversions and accept the terms. In GTM, pass the hashed identifiers before the conversion event. The template has fields for email and phone; with raw code:

<script>
window.uetq = window.uetq || [];
window.uetq.push('set', { pid: { em: {{dlv - user_email}}, ph: {{dlv - user_phone}} } });
</script>

The UET script hashes the values. Fire this on the user data dataLayer push and before the conversion event.

Hold the base tag and all event tags until ad_storage is granted through GTM consent settings. Additionally, pass Microsoft's consent signal so the tag behaves correctly if it loads before the choice:

<script>
window.uetq = window.uetq || [];
window.uetq.push('consent', 'default', { ad_storage: 'denied' });
</script>

And on acceptance:

<script>
window.uetq = window.uetq || [];
window.uetq.push('consent', 'update', { ad_storage: 'granted' });
</script>

Fire the default on Consent Initialization and the update on your consent platform's update event.

Step 7: Verify

  1. Install the UET Tag Helper browser extension. Load the site: the base tag reports a page load with the tag ID.
  2. GTM Preview: complete a conversion; the event tag fires once with the action and revenue. Inspect the request to bat.bing.com in a tag debugger such as the Insighter Debugger extension.
  3. In Microsoft Advertising, UET tags page: status Tag active. Conversion goals page: status Recording conversions after a test, usually within a few hours.
  4. Confirm revenue appears on the purchase goal.

Common Problems

Outcome

Microsoft Advertising gets the same clean conversions as your other platforms, with revenue, hashed identifiers and consent handled, so automated bidding works and the channel can be compared honestly with Google.

Frequently Asked Questions

Is Microsoft Ads worth tracking properly for a small account?

If you run it, yes. Bing and the Microsoft network reach an older, higher-income audience on desktop, and clicks are often cheaper than Google. Without conversion goals, you cannot use automated bidding or compare it fairly to Google.

URL goal or event goal?

Event goal. URL destination goals have the thank-you page weakness. Event goals fire from your form success or purchase event with revenue, through the same dataLayer you use for everything else.

Does Microsoft support enhanced conversions?

Yes. Enhanced conversions let the UET tag send hashed email and phone number with the conversion so Microsoft can match it when cookies are missing. Enable it in the UET tag settings and pass the values in the tag.

Does Microsoft respect Google Consent Mode?

Microsoft has its own consent mode. The UET tag reads an ad_storage style consent signal you set through the tag, and GTM's consent settings can hold the tag until consent. Treat it like Meta: block until ad_storage is granted, and pass the consent state.

Can I import Google Ads conversions instead?

Microsoft can import Google Ads campaigns, not conversion data. Track conversions with UET directly.

Want This Done Right the First Time?

Book a free 15-minute audit call. I'll review your setup, show you what is broken, and tell you exactly what it takes to fix it.

Chat Now