Skip to main content
Scripts

Microsoft Advertising UET tracks conversions and supplies audience data to Microsoft Advertising.

useScriptBingUet() loads the UET tag and exposes its event queue.

Bing UET

View source

Nuxt Config Setup

Add this to your nuxt.config.ts to load Bing UET globally. Alternatively you can use the useScriptBingUet composable for more control.

export default defineNuxtConfig({
  scripts: {
    registry: {
      bingUet: {
        id: '247021147',
        trigger: 'onNuxtReady',
      }
    }
  }
})

This config automatically enables first-party mode (bundle). See below to customise.

useScriptBingUet()

The useScriptBingUet composable lets you have fine-grain control over when and how Bing UET is loaded on your site.

const { proxy } = useScriptBingUet()

proxy.uetq.push({ ec: 'conversion', ea: 'purchase', ev: 1 })

Please follow the Registry Scripts guide to learn more about advanced usage.

First-Party Mode: Privacy Focused Proxy

No extra config needed. The script is bundled and served from your domain instead of a third-party CDN, eliminating an extra DNS lookup and improving load times. Learn more.

Mode
Bundle Partytown
export default defineNuxtConfig({
  scripts: {
    // ✅ First-party mode: bundled
    registry: {
      bingUet: {
        id: '247021147',
        trigger: 'onNuxtReady',
      },
    },
  },
})

Example

Using Bing UET in a component.

<script setup lang="ts">
const { proxy } = useScriptBingUet()

// noop in development, ssr
// just works in production, client
function handleAction() {
  proxy.uetq.push({ ec: 'conversion', ea: 'purchase', ev: 1 })
}
</script>

<template>
  <div>
    <button @click="handleAction">
      Send Event
    </button>
  </div>
</template>
idstring required

Your Bing UET tag ID.

enableAutoSpaTrackingboolean = true

Enable automatic SPA page tracking.

defaultConsentobject

Default consent state fired as `uetq.push('consent', 'default', ...)` before UET init.

Examples

Tracking Conversions

Microsoft recommends the newer event syntax, which replaces short parameters such as gv and gc with revenue_value and currency.

<script setup lang="ts">
const { proxy } = useScriptBingUet()

function trackPurchase() {
  proxy.uetq.push('event', 'purchase', {
    revenue_value: 49.99,
    currency: 'USD',
    transaction_id: 'ORDER-123',
  })
}
</script>

Custom Events

<script setup lang="ts">
const { proxy } = useScriptBingUet()

function trackSignup() {
  proxy.uetq.push('event', 'sign_up', {
    event_category: 'engagement',
    event_label: 'newsletter',
  })
}
</script>

Bing UET supports advanced consent mode. Only ad_storage is honored; set the initial state with defaultConsent and update it at runtime with consent.update():

<script setup lang="ts">
const { consent } = useScriptBingUet({
  defaultConsent: { ad_storage: 'denied' },
})

function grantConsent() {
  consent.update({ ad_storage: 'granted' })
}
</script>

Microsoft requires sites using consent mode to send either granted or denied on each page. Its current enforcement covers the EEA, United Kingdom, and Switzerland.

onBeforeUetStart remains available for any other pre-load setup.