Bing UET
Microsoft Advertising UET (Universal Event Tracking) lets you track conversions, build remarketing lists, and optimize your Microsoft Advertising campaigns.
Nuxt Scripts provides a registry script composable useScriptBingUet() to easily integrate Bing UET in your Nuxt app.
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.
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 = trueEnable automatic SPA page tracking.
Examples
Tracking Conversions
<script setup lang="ts">
const { proxy } = useScriptBingUet()
function trackPurchase() {
proxy.uetq.push({
ec: 'purchase',
ev: 49.99,
gc: 'USD',
})
}
</script>
Custom Events
<script setup lang="ts">
const { proxy } = useScriptBingUet()
function trackSignup() {
proxy.uetq.push({
ec: 'sign_up',
el: 'newsletter',
ea: 'engagement',
})
}
</script>