Microsoft Advertising Event Tracking | Blue Frog Docs

Microsoft Advertising Event Tracking

Complete guide to Microsoft Advertising (Bing Ads) UET and conversion tracking

Microsoft Advertising Event Tracking

Overview

Microsoft Advertising (formerly Bing Ads) uses Universal Event Tracking (UET) tags to measure conversions and user behavior across Bing, Yahoo, AOL, and Microsoft Audience Network. UET provides conversion tracking, remarketing capabilities, and automated bidding optimization. Microsoft Advertising also supports offline conversion imports and enhanced conversions for improved attribution.

Standard Events

Microsoft Advertising UET supports predefined event types and custom events:

Commerce Events

  • Purchase - Completed transaction with revenue
  • Add to cart - Product added to shopping cart
  • Add to wishlist - Product saved for later
  • Begin checkout - Checkout process initiated

Lead Generation Events

  • Contact - Form submission or contact request
  • Submit application - Application completed
  • Request quote - Quote or estimate requested
  • Sign up - Account registration or newsletter signup
  • Download - File, whitepaper, or app download
  • Book appointment - Appointment or demo scheduled

Engagement Events

  • Page view - Specific page visit
  • Video complete - Video watched to completion
  • Find location - Store locator used
  • Subscribe - Subscription started

Standard Conversion Actions

Create conversion goals without custom events:

  • Destination URL - Visit to specific page (e.g., thank you page)
  • Duration - Time spent on site
  • Pages/visit - Number of pages viewed
  • Event - Custom UET event fired

Custom Events

Creating Custom Events

Track business-specific actions with custom UET events:

// Basic custom event
window.uetq = window.uetq || [];
window.uetq.push('event', 'custom_event_name', {
  'event_category': 'category',
  'event_label': 'label',
  'event_value': 25.00
});

Event Implementation Examples

// Lead submission
window.uetq.push('event', 'contact', {
  'event_category': 'lead_generation',
  'event_label': 'contact_form',
  'event_value': 50.00  // Lead value
});

// Product view
window.uetq.push('event', 'view_item', {
  'event_category': 'product_interaction',
  'event_label': 'product_SKU_123',
  'revenue_value': 99.99,
  'currency': 'USD'
});

// Video completion
window.uetq.push('event', 'video_complete', {
  'event_category': 'engagement',
  'event_label': 'product_demo_video'
});

Variable Revenue Tracking

Track dynamic revenue values:

// Variable revenue event
window.uetq.push('event', '', {
  'revenue_value': parseFloat(orderTotal),
  'currency': 'USD'
});

Event Parameters

Available parameters for UET events:

  • event_category - Grouping for similar events
  • event_label - Specific identifier or details
  • event_value - Numeric value (non-revenue)
  • revenue_value - Transaction revenue
  • currency - 3-letter ISO currency code (USD, EUR, GBP, etc.)
  • transaction_id - Unique order identifier for deduplication

Ecommerce Events

Purchase Tracking

Comprehensive ecommerce conversion tracking:

<!-- UET Base Tag (on all pages) -->
<script>
(function(w,d,t,r,u){
  var f,n,i;
  w[u]=w[u]||[],f=function(){
    var o={ti:"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>

<!-- Purchase Event (on confirmation page) -->
<script>
window.uetq = window.uetq || [];
window.uetq.push('event', 'purchase', {
  'revenue_value': 149.99,
  'currency': 'USD',
  'transaction_id': 'ORDER_12345',
  'event_category': 'ecommerce',
  'items': 'SKU_123,SKU_456'  // Optional product IDs
});
</script>

Shopping Cart Events

Track the complete purchase funnel:

// Add to Cart
window.uetq.push('event', 'add_to_cart', {
  'event_category': 'ecommerce',
  'event_label': 'SKU_123',
  'revenue_value': 99.99,
  'currency': 'USD'
});

// Begin Checkout
window.uetq.push('event', 'begin_checkout', {
  'event_category': 'ecommerce',
  'revenue_value': 149.99,
  'currency': 'USD'
});

// Purchase
window.uetq.push('event', 'purchase', {
  'revenue_value': 149.99,
  'currency': 'USD',
  'transaction_id': 'ORDER_12345'
});

Microsoft Shopping Campaigns

For Microsoft Shopping ads, ensure proper product tracking:

window.uetq.push('event', 'purchase', {
  'revenue_value': 99.99,
  'currency': 'USD',
  'transaction_id': 'TXN_67890',
  'items': [
    {
      'id': 'SKU_001',
      'quantity': 1,
      'price': 99.99
    }
  ]
});

Conversion Tracking

Implementation Methods

1. UET Tag (JavaScript)

Standard UET tag implementation:

<!-- Step 1: Install UET tag on all pages -->
<script>
(function(w,d,t,r,u){
  var f,n,i;
  w[u]=w[u]||[],f=function(){
    var o={ti:"YOUR_TAG_ID", // Replace with 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>

<!-- Step 2: Add conversion events on conversion pages -->
<script>
window.uetq.push('event', 'purchase', {
  'revenue_value': 99.99,
  'currency': 'USD'
});
</script>

2. Google Tag Manager

Deploy UET via GTM:

Base Tag:

  • Tag Type: Custom HTML
  • Tag: Full UET script
  • Trigger: All Pages

Event Tracking:

// GTM Custom HTML Tag for events
<script>
window.uetq = window.uetq || [];
window.uetq.push('event', 'purchase', {
  'revenue_value': {{Transaction Value}},
  'currency': 'USD',
  'transaction_id': {{Transaction ID}}
});
</script>

3. Conversion Goals

Create conversion goals in Microsoft Advertising:

Goal Types:

  1. Destination URL - Conversion when URL is visited
  2. Duration - Conversion based on time on site
  3. Pages per visit - Conversion based on page depth
  4. Event - Conversion when UET event fires

Creating Event-Based Goal:

  1. Navigate to Tools > Conversion Goals
  2. Select Event goal type
  3. Configure:
    • Event action (e.g., "purchase")
    • Event category (optional)
    • Event label (optional)
    • Value (fixed or variable)
    • Conversion window

4. Enhanced Conversions

Improve conversion attribution with first-party data:

// Enhanced conversion with user data
window.uetq = window.uetq || [];
window.uetq.push('set', {
  'pid': {
    'em': 'user@example.com',  // Will be hashed
    'ph': '15551234567',
    'fn': 'John',
    'ln': 'Doe',
    'ct': 'New York',
    'st': 'NY',
    'zp': '10001',
    'country': 'US'
  }
});

window.uetq.push('event', 'purchase', {
  'revenue_value': 99.99,
  'currency': 'USD',
  'transaction_id': 'ORDER_12345'
});

Single Page Applications

Enable automatic SPA tracking:

var uetq = window.uetq || [];
window.uetq = new UET({
  ti: "YOUR_TAG_ID",
  enableAutoSpaTracking: true  // Enable SPA tracking
});
window.uetq.push("pageLoad");

// Manual virtual page view
window.uetq.push('event', 'page_view', {
  'page_path': '/virtual-page'
});

Offline Conversions

Import Methods

1. Manual Upload via UI

Upload offline conversions through Microsoft Advertising UI:

CSV File Requirements:

  • Microsoft Click ID (MSCLKID) - Click identifier from URL parameter
  • Conversion Name - Must match existing conversion goal
  • Conversion Time - When conversion occurred
  • Conversion Value - Revenue (optional)
  • Conversion Currency - Currency code (optional)

CSV Format:

MicrosoftClickId,ConversionName,ConversionTime,ConversionValue,ConversionCurrency
abc123def456,Purchase,2025-01-15 10:30:00,99.99,USD
xyz789ghi012,Lead,2025-01-15 14:20:00,25.00,USD

Upload Steps:

  1. Navigate to Tools > Conversions > Offline conversion goals
  2. Create offline conversion goal
  3. Upload CSV file
  4. Map columns to required fields
  5. Review and complete import

2. Microsoft Advertising API

Automate offline conversion uploads:

from bingads.v13.bulk import *
from bingads.service_client import ServiceClient
from bingads.authorization import *

# Authenticate
authorization_data = AuthorizationData(
    account_id='YOUR_ACCOUNT_ID',
    customer_id='YOUR_CUSTOMER_ID',
    developer_token='YOUR_DEVELOPER_TOKEN',
    authentication=OAuthWebAuthCodeGrant(
        client_id='YOUR_CLIENT_ID'
    )
)

# Upload offline conversions
conversion_upload_service = ServiceClient(
    service='CampaignManagementService',
    version=13,
    authorization_data=authorization_data
)

offline_conversions = {
    'OfflineConversions': [
        {
            'MicrosoftClickId': 'abc123def456',
            'ConversionName': 'Purchase',
            'ConversionTime': '2025-01-15T10:30:00',
            'ConversionValue': 99.99,
            'ConversionCurrency': 'USD'
        }
    ]
}

response = conversion_upload_service.ApplyOfflineConversions(
    OfflineConversions=offline_conversions
)

3. Click ID Capture

Capture MSCLKID for offline conversion attribution:

// Capture MSCLKID from URL
function getMSCLKID() {
  const urlParams = new URLSearchParams(window.location.search);
  return urlParams.get('msclkid');
}

// Store in form or session
const msclkid = getMSCLKID();
if (msclkid) {
  // Store in hidden form field
  document.getElementById('msclkid_field').value = msclkid;

  // Or store in localStorage/cookie
  localStorage.setItem('msclkid', msclkid);
}

4. CRM Integration

Connect CRM for automated offline conversion tracking:

Supported Integrations:

Implementation:

  1. Enable auto-tagging in Microsoft Advertising
  2. Capture MSCLKID in CRM records
  3. Export conversions from CRM with MSCLKID
  4. Upload via API or manual import

Attribution

Attribution Models

Microsoft Advertising supports multiple attribution models:

Last Click (Default)

  • 100% credit to last clicked ad
  • Most common for direct response campaigns

First Click

  • 100% credit to first interaction
  • Useful for awareness campaigns

Linear

  • Equal credit across all clicks in conversion path
  • Balanced view of customer journey

Time Decay

  • More recent clicks receive more credit
  • Good for longer sales cycles

Position Based

  • 40% to first click, 40% to last click, 20% to middle clicks
  • Balances acquisition and conversion

Configure: Tools > Conversion Goals > Attribution Settings

Conversion Windows

Set lookback periods for conversions:

  • Click conversion window: 7, 30, or 90 days (default: 30)
  • View conversion window: 1, 7, or 30 days (default: 1)

Configure per conversion goal in goal settings.

Cross-Device Conversions

Track conversions across devices:

  • User clicks ad on mobile
  • User converts on desktop
  • Both counted in conversion path

Enabled automatically for signed-in Microsoft users.

Assisted Conversions

View conversions that had multiple touchpoints:

Navigate to Reports > Attribution > Assisted Conversions to see:

  • Keywords that assisted conversions
  • Campaigns with indirect impact
  • Time lag between first click and conversion

Debugging & Validation

UET Tag Helper

Browser extension for validating UET implementation:

  1. Install UET Tag Helper Chrome extension
  2. Visit page with UET tag
  3. View tag status:
    • Tag ID detected
    • Events fired
    • Parameters passed
    • Errors and warnings

Tag Status in UI

Check UET tag health in Microsoft Advertising:

  1. Navigate to Tools > UET Tags

  2. Review Tag Status column:

    • Verified - Tag firing correctly
    • Unverified - Tag not detected
    • Inactive - Tag not installed
  3. Click View Details for:

    • Recent page loads
    • Events tracked
    • Configuration issues

Conversion Goal Tracking Status

Verify conversion goals are recording:

Tools > Conversion Goals > Tracking Status:

  • Recording - Conversions tracked successfully
  • No recent conversions - Goal created but no conversions yet
  • Unverified - UET tag not detected

Test Conversions

Generate test conversions to verify setup:

  1. Ensure UET tag is installed
  2. Click your own ad (or use test account)
  3. Complete conversion action
  4. Wait 1-2 hours
  5. Check All Campaigns > Columns > Conversions

Note: Conversions may take up to 24 hours to appear in reporting.

Debug Console

Use browser console to verify UET events:

// Check UET queue
console.log(window.uetq);

// Verify tag loaded
if (typeof UET !== 'undefined') {
  console.log('UET tag loaded successfully');
} else {
  console.error('UET tag not found');
}

Common Issues

Tag not detected:

  • Verify Tag ID is correct
  • Check script placement in <head> section
  • Ensure no JavaScript errors blocking execution
  • Clear browser cache and test again

Events not tracking:

  • Verify event name matches conversion goal
  • Check event fires after UET tag initialization
  • Confirm page remains loaded long enough for event to send
  • Review UET Tag Helper for event confirmation

Conversions not appearing:

  • Check conversion window settings
  • Verify user clicked Microsoft ad before converting
  • Ensure conversion goal is active
  • Wait up to 24 hours for reporting delay

Best Practices

Implementation

  1. Install UET tag on all pages for complete user journey tracking
  2. Use Google Tag Manager for easier tag management
  3. Enable auto-tagging to capture MSCLKID automatically
  4. Implement enhanced conversions for improved attribution
  5. Enable SPA tracking for single-page applications

Conversion Strategy

  1. Create multiple conversion goals for different actions
  2. Set appropriate conversion values reflecting business worth
  3. Use event-based goals for flexible tracking
  4. Track micro-conversions (add to cart, sign up) for remarketing
  5. Configure primary conversions for automated bidding

Data Quality

  1. Use transaction_id to prevent duplicate purchase conversions
  2. Pass revenue_value for all ecommerce events
  3. Include currency code for international campaigns
  4. Implement enhanced conversions for better match rates
  5. Regular audit of UET tag functionality

Attribution

  1. Choose attribution model matching business model
  2. Set conversion windows based on typical sales cycle
  3. Review assisted conversions to understand full funnel
  4. Use time lag reports to optimize bidding strategies
  5. Enable cross-device tracking for complete attribution

Privacy & Compliance

  1. Respect user consent for GDPR/CCPA compliance
  2. Implement consent management platform if required
  3. Hash PII before sending (automatic with enhanced conversions)
  4. Update privacy policy to disclose Microsoft Advertising tracking
  5. Honor opt-out requests via Microsoft's privacy controls

Optimization

  1. Use conversion-based bidding (Target CPA, Maximize Conversions)
  2. Exclude converted users from acquisition campaigns
  3. Create conversion-based audiences for remarketing
  4. Import offline conversions within 90 days
  5. Review conversion reports weekly for optimization insights

Testing

  1. Test UET tag with UET Tag Helper before launch
  2. Verify conversion goals fire correctly on test conversions
  3. Check all event parameters pass accurate data
  4. Test across browsers and devices
  5. Monitor tag status daily for first week after implementation

Reporting

  1. Add conversion columns to campaign reports
  2. Segment by device to understand conversion patterns
  3. Use conversion funnel reports to identify drop-off points
  4. Review time lag reports to optimize conversion windows
  5. Export offline conversions for external analysis

Shopping Campaigns

  1. Track all ecommerce events for Shopping optimization
  2. Pass product IDs in conversion events
  3. Use variable revenue tracking for accurate ROAS
  4. Implement cart abandonment events for remarketing
  5. Monitor product performance by conversion metrics
// SYS.FOOTER