Microsoft UET Consent Mode with ConsentBit
Microsoft Advertising requires a consent signal for UET traffic from the European Economic Area, the United Kingdom and Switzerland. Without one, Microsoft stops tracking UET conversions and stops building remarketing lists for those visitors.
Microsoft accepts two kinds of consent signal: UET Consent Mode and the IAB Transparency and Consent Framework (TCF). It asks that a site never use both at the same time. ConsentBit picks the right one for your banner type automatically.
No configuration is required in ConsentBit. Add your UET tag to your site and ConsentBit handles the rest.
How it works
The consent method depends on which ConsentBit banner your site uses:
UET only enforces one permission, ad_storage, which controls whether UET can store cookies. ConsentBit maps it from your Marketing category. A visitor who allows Analytics but not Marketing keeps ad_storage denied.
On the IAB TCF banner, ConsentBit asks visitors for consent to Microsoft and Xandr for the purposes Microsoft requires: 1, 2, 3, 4, 7, 9 and 10. It does not send UET Consent Mode commands on that banner, as Microsoft requires.
What happens with and without consent
GDPR and CCPA banners
ConsentBit uses Microsoft's recommended Advanced Consent Mode. The UET tag loads straight away, and ConsentBit sets the consent default before UET runs.
- Consent denied: UET does not write the
MUID,_uetsid,_uetvid,_uetsid_exp,_uetvid_exporMSPTCcookies. Microsoft only collects anonymous data, which it uses for conversion modelling. - Consent granted: UET sets its cookies and tracks conversions and remarketing normally.
- Consent withdrawn: ConsentBit sends the updated decision straight away.
IAB TCF banner
The UET tag is held until the visitor makes a choice. When it loads, it reads the visitor's consent for Microsoft from the TC string. If the visitor rejects, the UET tag does not load and no Microsoft cookies are set.
Before you begin
You need a Microsoft Advertising account with a UET tag. You can find your tag in Microsoft Advertising under Tools → UET tag.
Don't add your own consent code
Remove any uetq.push('consent', …) or uetq.push('config', 'tcf', …) code you added yourself. ConsentBit already sends the right signal for your banner, and extra code can send UET Consent Mode and TCF at the same time, which Microsoft does not allow.
Setting up the integration
- Install ConsentBit
Install the ConsentBit script in the<head>of your site and publish your cookie banner. - Add your UET tag after the ConsentBit script
Add the UET tag exactly as Microsoft Advertising provides it, below the ConsentBit script:<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>
Replace YOUR_TAG_ID with your UET tag ID.
The order matters. UET treats consent as granted if it sees no consent default, so ConsentBit has to run first. Do not add a blocking attribute such as data-category to the UET tag. - Publish your site
Verifying the integration
Open your site in a private window and press F12 to open the browser console. The checks below use the uetConfig object, which is only available after the UET tag has loaded.
GDPR and CCPA banners
window.uetq.uetConfig.consent.enabled // true
window.uetq.uetConfig.consent.adStorageAllowed // see table
IAB TCF banner
Accept the banner first, since the UET tag loads after consent on this banner. Then run:
window.uetq.uetConfig.tcf.enabled // true
window.uetq.uetConfig.consent.enabled // false: Consent Mode is not used with TCF
To check the consent Microsoft receives in the TC string:
__tcfapi('getTCData', 2, d => console.log(
'Microsoft (1126):', d.vendor.consents[1126],
'Xandr (32):', d.vendor.consents[32]));
Both values are true after Accept All and false after Reject All.
Check the cookies
Open Application → Cookies in your browser's developer tools. Before the visitor consents, and after they reject, MUID, _uetsid and _uetvid must not be present. Microsoft checks for exactly this.
You can also use Microsoft's UET Tag Helper browser extension. With Consent Mode, the asc parameter on the page load event shows G when consent is granted and D when it is denied. With TCF, a granted page load includes &ms=G.
Troubleshooting
window.uetq.uetConfig is undefined.
The UET tag has not loaded. Check that the tag is on the page. On the IAB TCF banner this is expected until the visitor accepts.
Microsoft cookies appear before the visitor consents.
The UET tag is probably placed above the ConsentBit script, so UET ran before the consent default was set. Move the UET tag below the ConsentBit script.
Both tcf.enabled and consent.enabled are true.
Your site has its own UET consent code alongside ConsentBit. Remove it, so only one consent method is used.
adStorageAllowed stays false after the visitor saves preferences.
That is expected when the Marketing category is off. UET's ad_storage permission follows the Marketing category.

