Delivery Options
- Universal Pixel: Direct JavaScript implementation on all pages
- Google Tag Manager: Centralized tag management (recommended)
- Server-side tagging: Enhanced privacy and performance
- Conversion API: Server-to-server event transmission
- Mobile SDK: Native app tracking for iOS and Android
Tag Manager Deployment (Recommended)
Setup Steps
- Obtain Universal Pixel ID from TTD platform (Settings → Universal Pixel)
- Create Custom HTML tag in GTM for Universal Pixel base code
- Create separate Custom HTML tags for tracker events (conversion, page view, etc.)
- Configure triggers (all pages, purchase complete, form submit, etc.)
- Set up GTM variables for dynamic values (revenue, product ID, user attributes)
- Publish container and verify with GTM Preview mode and TTD Pixel Helper
GTM Tag Configuration
Universal Pixel Base Code (place on all pages):
<!-- The Trade Desk Universal Pixel -->
<script>
!function(t,r,a,c,k){
t[c]=t[c]||function(){(t[c].q=t[c].q||[]).push(arguments)};
var s=r.createElement(a),d=r.getElementsByTagName(a)[0];
s.async=1;s.src=k;d.parentNode.insertBefore(s,d);
}(window,document,'script','ttd','https://js.adsrvr.org/up_loader.1.1.0.js');
ttd.universal({
advertiser_id: 'YOUR_ADVERTISER_ID',
td1: 'YOUR_UNIVERSAL_PIXEL_ID'
});
</script>
Conversion Event Tag Example:
<!-- The Trade Desk Conversion Event -->
<script>
ttd.universal({
advertiser_id: 'YOUR_ADVERTISER_ID',
td1: 'YOUR_UNIVERSAL_PIXEL_ID',
event_name: 'purchase',
value: {{transactionRevenue}},
currency: 'USD',
items: [
{
item_id: {{productId}},
item_name: {{productName}},
quantity: {{quantity}},
price: {{price}}
}
],
order_id: {{transactionId}},
td2: {{customVariable1}},
td3: {{customVariable2}}
});
</script>
Page View Event Tag:
<!-- The Trade Desk Page View Event -->
<script>
ttd.universal({
advertiser_id: 'YOUR_ADVERTISER_ID',
td1: 'YOUR_UNIVERSAL_PIXEL_ID',
event_name: 'page_view',
page_url: {{Page URL}},
page_title: {{Page Title}}
});
</script>
Direct Embed (Alternative)
Base Universal Pixel (Required on All Pages)
Place this code in the <head> section or just before </body>:
<!-- The Trade Desk Universal Pixel -->
<script>
!function(t,r,a,c,k){
t[c]=t[c]||function(){(t[c].q=t[c].q||[]).push(arguments)};
var s=r.createElement(a),d=r.getElementsByTagName(a)[0];
s.async=1;s.src=k;d.parentNode.insertBefore(s,d);
}(window,document,'script','ttd','https://js.adsrvr.org/up_loader.1.1.0.js');
ttd.universal({
advertiser_id: 'abc123xyz',
td1: 'TTDPIXEL123'
});
</script>
Conversion Event (Place on Specific Pages)
<!-- Conversion Event -->
<script>
ttd.universal({
advertiser_id: 'abc123xyz',
td1: 'TTDPIXEL123',
event_name: 'purchase',
value: 99.99,
currency: 'USD',
order_id: 'ORDER123456'
});
</script>
UID2.0 Integration (Enhanced)
For improved identity resolution, integrate UID2 tokens:
<!-- Universal Pixel with UID2 -->
<script>
ttd.universal({
advertiser_id: 'YOUR_ADVERTISER_ID',
td1: 'YOUR_UNIVERSAL_PIXEL_ID',
uid2_token: 'UID2_TOKEN_FROM_SERVER',
event_name: 'page_view'
});
</script>
Generate UID2 tokens server-side and pass to page:
// Server-side UID2 token generation (example)
const uid2Token = await generateUID2Token(userEmail);
// Pass to page template for pixel inclusion
Mobile SDK Installation
iOS (Swift)
import TheTradeDesk
// Initialize SDK
TTD.shared.initialize(advertiserId: "YOUR_ADVERTISER_ID")
// Track event
TTD.shared.trackEvent(
name: "purchase",
value: 99.99,
currency: "USD",
orderId: "ORDER123"
)
Android (Kotlin)
import com.thetradedesk.sdk.TTD
// Initialize SDK
TTD.initialize(this, "YOUR_ADVERTISER_ID")
// Track event
TTD.trackEvent(
name = "purchase",
value = 99.99,
currency = "USD",
orderId = "ORDER123"
)
TTD Platform Configuration
- Navigate to Settings → Universal Pixel
- Create new pixel or select existing Universal Pixel ID
- Copy advertiser ID and Universal Pixel ID
- Configure tracker events (purchase, lead, signup, etc.)
- Set up conversion attribution windows (click and view-through)
- Provide pixel code to development team or implement in GTM
Validation Checklist
Pre-Launch
- Universal Pixel base code loads on all pages
- Event tags fire only on designated pages (conversion, form submit, etc.)
- Custom parameters populate correctly with dynamic values
- GTM container published to production (if using GTM)
- No JavaScript errors in browser console
- UID2 tokens generate and pass correctly (if implemented)
Post-Launch
- Test pixel using Chrome DevTools Network tab
- Verify with TTD Pixel Helper Chrome extension
- Check Universal Pixel event debugger in TTD platform
- Confirm conversions appear in TTD reporting within 24 hours
- Monitor pixel health dashboard for errors or missing events
- Validate attribution and conversion counting methodology
Troubleshooting
Pixel Not Firing
- Check for JavaScript errors in browser console
- Verify Universal Pixel ID and advertiser ID are correct
- Look for ad blockers or privacy extensions blocking script
- Confirm pixel script loads before page navigation
- Check Content Security Policy (CSP) headers aren't blocking TTD domain
Events Not Recording
- Verify event name matches tracker configuration exactly
- Check event parameters are properly formatted (value as number, etc.)
- Ensure Universal Pixel base code loads before event fires
- Review user consent status and privacy settings
- Confirm conversion lookback windows in platform settings
UID2 Integration Issues
- Verify email normalization (lowercase, trim whitespace)
- Check SHA-256 hashing on server side
- Review UID2 token generation API responses
- Ensure token refresh logic maintains persistent IDs
- Check opt-out transparency portal for user opt-outs
Best Practices
- Always use GTM for easier maintenance and version control
- Test in GTM Preview mode before publishing to production
- Document all custom variables (td2, td3, etc.) and their purposes
- Set up automated pixel health monitoring and alerts
- Implement consent mode for GDPR and CCPA compliance
- Use descriptive event names that align with business goals
- Keep base pixel separate from event-specific tracking
- Implement server-side backup tracking for critical conversions
- Regular audit of pixel configuration and event parameters
- Test across browsers and devices before full deployment