Ads and pixels
Microsoft UET
Configure Microsoft UET
Copy your UET tag ID from Microsoft Advertising. Remove the UET snippet and
any tag-manager entry that loads the same tag, because the helper creates the
uetq queue and constructs UET itself.
Register the scripts
Complete your framework quickstart first. Keep its Inth endpoint, policy, styles and consent UI. Remove the vendor's original script, SDK initializer or tag-manager entry, so the vendor loads only through c15t.
The vendor pages put the helper in src/consent-scripts.ts. If your framework
quickstart already has a scripts array, such as the one in c15t.config.ts
in the Next.js guide, add the helper to that array instead of creating a
second file.
The scripts export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
point for your framework below. These are edits to that provider, not a second
provider.
Add the configuration to scripts in c15t.config.ts, next to
next.config.ts:
Keep the rest of your config, such as mode and routePrefix, in the
same call. ConsentRoot reads the config in the browser, so the layout
keeps passing only state. App Router, Pages Router and static export all
read the same file. See
Next.js scripts and embeds.
Options
| Option | Default | Behavior |
|---|---|---|
id | Required | UET tag ID, passed to UET as ti. The helper trims it. Empty or whitespace-only values log an error and the script does not load. |
scriptSrc | //bat.bing.com/bat.js | Loader URL override. A blank value falls back to the default. |
Loading and revocation
microsoftUet uses the marketing category and alwaysLoad, so bat.js
loads on every page whether or not marketing is allowed. Before the script
loads, the helper calls uetq.push('consent', 'default', { ad_storage }) with
granted or denied from the current marketing permission. After bat.js
loads, it constructs UET with enableAutoSpaTracking: true and pushes
pageLoad. This is consent signaling, not a request gate. Microsoft's consent
mode decides what UET does while ad_storage is denied.
The helper never removes UET. When marketing changes, it calls
uetq.push('consent', 'update', { ad_storage }) with the new value. Automatic
SPA tracking sends page loads on client-side navigation, so do not push
pageLoad from your router.
Verify Microsoft UET
- In a private window with an opt-in policy, load the page. The
bat.jsrequest goes tobat.bing.combefore you choose, and UET sends its page load. - Click Reject, then reload.
bat.jsstill loads, and the page starts withad_storagedenied. - Open Privacy settings and allow marketing. No second
bat.jsrequest appears, because the helper sends a consent update to the running tag instead of reloading it. - Navigate to another route in a single-page app. UET sends one page load for the route change, not two.
- Turn marketing off again and save. c15t reloads the page, and the new page
starts with
ad_storagedenied.
See the consent verification guide for navigation and hosting checks.