Delivery Options
- Direct embed: Paste UET tag code directly in website HTML
- Google Tag Manager: Deploy via GTM Custom HTML tag
- Content Management Systems: Use plugins or theme integration
- Server-side tagging: Advanced implementation with server container
Create UET Tag
Before implementation, generate your UET tag in Microsoft Advertising:
Step 1: Navigate to UET Tags
- Sign in to Microsoft Advertising
- Click Tools in top menu
- Select UET tag under Tracking section
Step 2: Create New Tag
- Click Create UET tag button
- Enter Tag name (e.g., "Main Website Tag")
- (Optional) Enter Tag description
- Click Save
Step 3: Copy Tag Code
Microsoft Advertising generates a unique tag code:
<script>
(function(w,d,t,r,u){
var f,n,i;
w[u]=w[u]||[],f=function(){
var o={ti:"TAG_ID_HERE"};
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>
Tag ID: The unique identifier (e.g., 12345678) appears in the tag code as ti:"TAG_ID_HERE"
Direct Embed Implementation
Recommended Placement
Add UET tag to the <head> section of your HTML, before the closing </head> tag:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Your Website</title>
<!-- Microsoft Advertising UET Tag -->
<script>
(function(w,d,t,r,u){
var f,n,i;
w[u]=w[u]||[],f=function(){
var o={ti:"12345678"}; // Your unique tag ID
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>
<!-- End UET Tag -->
</head>
<body>
<!-- Your page content -->
</body>
</html>
Alternative Placement
UET tag can also be placed before the closing </body> tag, though <head> placement is recommended for earlier data collection:
<!DOCTYPE html>
<html>
<head>
<title>Your Website</title>
</head>
<body>
<!-- Your page content -->
<!-- Microsoft Advertising UET Tag (Alternative Placement) -->
<script>
(function(w,d,t,r,u){
// ... tag code here ...
})(window,document,"script","//bat.bing.com/bat.js","uetq");
</script>
</body>
</html>
Implementation Notes
- Tag loads asynchronously (won't block page rendering)
- Should be on every page of your website
- Only one UET tag needed per website
- Same tag used for conversion tracking, remarketing, and analytics
Google Tag Manager Deployment
Step 1: Create Custom HTML Tag
- Sign in to Google Tag Manager
- Click Tags in left sidebar
- Click New button
- Click tag configuration area
- Select Custom HTML tag type
Step 2: Configure Tag
- Tag name: "Microsoft Advertising - UET Base Tag"
- HTML: Paste your complete UET tag code
- Tag firing options:
- Select Support document.write (usually not needed)
- Ensure Once per page is checked
Step 3: Set Trigger
- Click Triggering section
- Select All Pages trigger
- Click Save
Step 4: Test and Publish
- Click Preview button in top right
- Navigate to your website in the preview tab
- Verify tag fires on all pages using Tag Assistant
- If working correctly, click Submit to publish
- Add version name and description
- Click Publish
Complete GTM Configuration Example
Tag Configuration:
- Tag Type: Custom HTML
- Tag Name: Microsoft Advertising - UET Base Tag
- HTML:
<script>
(function(w,d,t,r,u){
var f,n,i;
w[u]=w[u]||[],f=function(){
var o={ti:"12345678"}; // Replace with your tag ID
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>
- Triggering: All Pages
- Tag firing priority: Default (or higher if needed before other tags)
CMS-Specific Implementation
WordPress
Option 1: Theme Header/Footer Editor
- Go to Appearance > Theme File Editor
- Select header.php
- Paste UET tag before
</head> - Click Update File
- Install plugin like "Insert Headers and Footers" or "Head, Footer and Post Injections"
- Navigate to plugin settings
- Paste UET tag in "Scripts in Header" section
- Save changes
Option 3: Google Tag Manager Plugin
- Install "Google Tag Manager for WordPress" plugin
- Enter GTM container ID in plugin settings
- Add UET tag to GTM container (see GTM deployment above)
Shopify
- Go to Online Store > Themes
- Click Actions > Edit code
- Open theme.liquid file
- Paste UET tag before
</head> - Click Save
Note: UET tag will automatically appear on all pages after saving.
Wix
- Go to Settings > Tracking & Analytics
- Click + New Tool > Custom
- Paste UET tag code
- Select All Pages under "Add Code to Pages"
- Choose Head for placement
- Click Apply
Squarespace
- Go to Settings > Advanced > Code Injection
- Paste UET tag in Header section
- Click Save
Note: Header injection adds code to all pages automatically.
Magento
- Navigate to Content > Design > Configuration
- Select your store view
- Expand HTML Head section
- Paste UET tag in Scripts and Style Sheets field
- Click Save Configuration
Drupal
- Install "Google Tag Manager" module (can be used for any tag manager code)
- Or use "Custom JavaScript" module
- Navigate to module configuration
- Paste UET tag code
- Select "Add to all pages"
- Save configuration
Server-Side Tagging Implementation
For advanced implementations using Google Tag Manager Server-Side:
Step 1: Set Up Server Container
- Create server-side GTM container
- Deploy to Cloud Run, App Engine, or custom server
- Configure server-side client
Step 2: Create Microsoft Advertising Server Tag
- In server container, create Custom tag
- Use Microsoft Advertising API endpoint
- Map event data from client to server
- Include MSCLKID parameter for attribution
Note: Server-side UET implementation requires custom development. Microsoft does not provide official server-side tag template yet.
Benefits of Server-Side Tagging
- Reduced client-side JavaScript
- Enhanced data privacy and control
- Server-side event validation
- Bypass ad blockers (partially)
- Lower page weight
Considerations
- Requires backend development expertise
- Additional infrastructure costs
- More complex debugging
- Attribution may require additional configuration
Validation Checklist
After implementing UET tag, verify:
- Tag appears in HTML source on all pages
- No JavaScript errors in browser console
- Network request to
bat.bing.com/bat.jsreturns 200 OK - UET Tag Helper extension detects tag (see Testing section below)
- Tag ID matches Microsoft Advertising account
- Tag appears as "Verified" in Microsoft Advertising (within 24 hours)
- Only one UET tag per page (no duplicates)
Testing with UET Tag Helper
Install Extension
- Open Chrome Web Store
- Search for "UET Tag Helper"
- Click Add to Chrome
- Confirm installation
Verify Tag Installation
- Navigate to your website
- Click UET Tag Helper extension icon in browser toolbar
- Look for green checkmark and tag ID
- Verify page URL is captured
- Check that no errors are displayed
Tag Helper Status Indicators
- Green checkmark: Tag detected and firing correctly
- Yellow warning: Tag detected with warnings (e.g., multiple tags)
- Red X: Tag not detected or critical error
Troubleshooting Installation
Tag Not Loading
Check 1: HTML Source
- View page source (Ctrl+U or Cmd+U)
- Search for "bat.bing.com"
- Verify tag code is present
Check 2: Browser Console
- Open DevTools (F12)
- Look for JavaScript errors
- Check if Content Security Policy (CSP) is blocking
Check 3: Network Tab
- Open DevTools > Network tab
- Filter by "bat.bing.com"
- Verify request is sent and returns 200 status
Tag Not Verified in Microsoft Advertising
Wait time: Microsoft takes up to 24 hours to verify tags
Common issues:
- Tag only on localhost or staging (must be on public URL)
- Website requires authentication
- Robots.txt blocking Microsoft crawler
- Tag removed or modified after initial verification
Solution: Check tag is on publicly accessible page and wait 24 hours
Multiple Tags Detected
Issue: UET tag loaded more than once on page
Causes:
- Hardcoded tag + GTM tag
- Tag in multiple GTM tags
- Theme and plugin both adding tag
Solution: Remove duplicate implementations, use GTM for centralized management
Content Security Policy Errors
Error: Refused to load the script 'https://bat.bing.com/bat.js'
Solution: Add to CSP header:
Content-Security-Policy: script-src 'self' https://bat.bing.com;
Or in HTML meta tag:
<meta http-equiv="Content-Security-Policy"
content="script-src 'self' https://bat.bing.com;">
Post-Installation Steps
After successful UET tag installation:
- Create conversion goals - Navigate to Conversions in Microsoft Advertising
- Set up remarketing audiences - Use UET data for audience targeting
- Enable auto-tagging - Append MSCLKID to destination URLs
- Test conversions - Complete test transactions to verify tracking
- Monitor tag health - Regularly check UET tag status in Microsoft Advertising
Migration from Legacy Tracking
If upgrading from older Microsoft Advertising tracking:
From Old Universal Event Tracking
- Create new UET tag in interface
- Deploy new tag alongside old tag temporarily
- Verify both tags firing with UET Tag Helper
- Monitor conversions for 1-2 weeks
- Remove old tag once confident new tag working
From Microsoft Conversion Tracking (Deprecated)
- Note conversion IDs from old tracking
- Create equivalent conversion goals with UET
- Deploy UET tag to all pages
- Create new conversion goals in Microsoft Advertising
- Archive old conversion tracking after migration
Important: Keep old tracking for 30 days during transition for attribution window.
Security Best Practices
- Use HTTPS protocol for bat.bing.com requests
- Don't modify Microsoft-provided UET tag code
- Store tag configuration in version control
- Limit access to tag management tools (GTM, CMS)
- Regularly audit tag implementation
- Use Tag Manager for easier updates and rollbacks
Performance Optimization
- UET tag loads asynchronously by default
- Average impact: under 50ms page load time
- Loads in parallel with other resources
- Consider using GTM for centralized tag management
- Defer non-critical conversion events to reduce initial page weight
Next Steps
After installing UET tag:
- Configure event tracking for custom conversions
- Set up data layer for revenue tracking
- Implement cross-domain tracking if needed
- Create remarketing audiences in Microsoft Advertising
- Enable automated bidding strategies