Data Layer Overview
Floodlight custom variables (u1-u100) enable rich data capture for segmentation, reporting, and campaign optimization in DV360. A properly structured data layer ensures consistent, accurate data collection across your site.
Data Layer Architecture
Standard E-commerce Data Layer
// Push to dataLayer before Floodlight tag fires
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'purchase',
'transactionId': 'ORD-2024-12345',
'transactionTotal': 299.99,
'transactionProducts': [{
'sku': 'PROD-123',
'name': 'Wireless Headphones',
'category': 'Electronics',
'price': 149.99,
'quantity': 2
}],
'customerType': 'returning',
'shippingMethod': 'express'
});
Lead Generation Data Layer
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'lead_submission',
'formType': 'contact_sales',
'leadTier': 'enterprise',
'industry': 'financial_services',
'companySize': '1000+',
'region': 'north_america'
});
Custom Variable Configuration
In Campaign Manager 360
Navigate to Advertiser → Floodlight → Custom Variables
Click New Custom Variable
Configure settings:
Save and assign to relevant Floodlight activities
Custom Variable Types
String Variables (Text):
- Product categories
- User segments
- Geographic regions
- Campaign codes
- Device types
Number Variables (Numeric):
- Quantity
- Lifetime value scores
- Custom revenue amounts
- Engagement scores
Implementation Patterns
GTM Data Layer Variables
- Create Data Layer Variables in GTM for each custom parameter
- Reference in Floodlight tag configuration
- Map to u-variables
Example GTM Setup:
// Data Layer Variable: transactionId
// Variable Type: Data Layer Variable
// Data Layer Variable Name: transactionId
// Data Layer Variable: productCategory
// Variable Type: Data Layer Variable
// Data Layer Variable Name: transactionProducts.0.category
Mapping to Floodlight U-Variables
<!-- Floodlight tag in GTM -->
<script>
gtag('event', 'conversion', {
'allow_custom_scripts': true,
'value': {{transactionTotal}},
'transaction_id': {{transactionId}},
'u1': {{productCategory}},
'u2': {{customerType}},
'u3': {{shippingMethod}},
'u4': {{region}},
'u5': {{deviceType}},
'send_to': 'DC-XXXXXXXX/invmedia/purchase0+transactions'
});
</script>
Common Data Layer Patterns
E-commerce Purchase
// On purchase confirmation page
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'floodlight_purchase',
'ecommerce': {
'purchase': {
'actionField': {
'id': 'ORD-2024-67890',
'revenue': '459.99',
'tax': '35.00',
'shipping': '15.00',
'coupon': 'SUMMER20'
},
'products': [{
'name': 'Running Shoes',
'id': 'SHOE-456',
'price': '129.99',
'brand': 'BrandName',
'category': 'Footwear/Running',
'variant': 'Blue',
'quantity': 1
}]
}
},
'customerType': 'new',
'loyaltyTier': 'silver'
});
Lead Form Submission
// On form submit success
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'floodlight_lead',
'formId': 'contact-sales-form',
'formType': 'demo_request',
'leadSource': 'website',
'leadScore': 85,
'industry': 'technology',
'companySize': '500-1000',
'interestedProduct': 'enterprise_platform',
'timeline': '1-3_months'
});
Content Engagement
// On whitepaper download
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'floodlight_content',
'contentType': 'whitepaper',
'contentTitle': 'Digital Marketing Trends 2024',
'contentCategory': 'thought_leadership',
'userSegment': 'marketer',
'downloadFormat': 'pdf'
});
Video Interaction
// On video completion
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'floodlight_video',
'videoTitle': 'Product Demo',
'videoId': 'VID-789',
'videoDuration': 180,
'percentWatched': 100,
'playerType': 'youtube_embedded'
});
Advanced Implementations
Dynamic Remarketing
For dynamic remarketing campaigns, pass product data:
window.dataLayer.push({
'event': 'floodlight_product_view',
'ecommerce': {
'detail': {
'products': [{
'id': 'PROD-123',
'name': 'Wireless Mouse',
'price': '29.99',
'category': 'Electronics/Accessories'
}]
}
}
});
// Corresponding Floodlight tag
gtag('event', 'conversion', {
'allow_custom_scripts': true,
'u1': 'PROD-123', // Product ID
'u2': 'Electronics', // Category
'u3': '29.99', // Price
'send_to': 'DC-XXXXXXXX/invmedia/prodview0+standard'
});
User Authentication State
// Track logged-in user status
window.dataLayer.push({
'event': 'user_status',
'userAuthenticated': true,
'userId': 'USER-456789', // Hashed user ID
'membershipTier': 'premium',
'accountAge': 'over_1_year'
});
Cart Abandonment Tracking
// Track cart state
window.dataLayer.push({
'event': 'floodlight_cart',
'cartValue': 199.99,
'cartItemCount': 3,
'cartProducts': 'SKU123,SKU456,SKU789'
});
Data Quality & Validation
Pre-Launch Checklist
- All custom variables defined in Campaign Manager
- Data layer pushes before Floodlight tags fire
- Variable names consistent across site
- No undefined or null values passed
- GTM variables configured correctly
- Test conversions verify data capture
Ongoing Monitoring
- Weekly spot checks in Campaign Manager reports
- Monthly audit of custom variable usage
- Quarterly review of data layer implementation
- Monitor for data type mismatches (string vs. number)
- Track missing or malformed values
Common Issues
Problem: Custom variables showing as "(not set)"
- Solution: Verify data layer push happens before tag fires
Problem: Numeric values appearing as strings
- Solution: Configure variable as Number type in Campaign Manager
Problem: Inconsistent category values
- Solution: Implement data layer standardization and validation
Best Practices
- Define clear naming conventions for custom variables
- Document all u-variable mappings in a central location
- Use consistent category hierarchies (Category/Subcategory)
- Validate data types match Campaign Manager configuration
- Implement data layer on all relevant pages, not just conversion pages
- Test with GTM Preview mode and Campaign Manager test conversions
- Keep sensitive data (PII) out of custom variables
- Use hashed IDs for user identifiers if needed
- Version control data layer changes
- Create fallback values for optional parameters
- Monitor data quality in regular reporting reviews
Privacy Considerations
- Never pass personally identifiable information (PII) in custom variables
- Hash or pseudonymize user identifiers
- Implement consent management for EU users
- Document data retention policies
- Review custom variables for compliance with privacy regulations
- Use server-side processing for sensitive data
- Implement consent mode to respect user preferences