For general Meta Pixel concepts, see the Meta Ads overview.
Prerequisites
- Meta Business Suite or Ads Manager account
- Meta Pixel ID (15-16 digit number)
- Duda site editing access
Installation Methods
Method 1: Native Duda Integration (Recommended)
Duda has built-in Meta Pixel support:
- Open your site in Duda editor
- Go to Site Settings (gear icon)
- Navigate to Site Settings > Facebook Pixel
- Enter your Pixel ID
- Click Save
- Publish your site
Benefits:
- Automatic PageView tracking
- Duda-optimized loading
- Works with ecommerce events
Method 2: Head HTML Injection
For custom configurations:
<!-- Meta Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=YOUR_PIXEL_ID&ev=PageView&noscript=1"
/></noscript>
<!-- End Meta Pixel Code -->
- Replace
YOUR_PIXEL_IDwith your actual Pixel ID - Publish your site
Method 3: Via Google Tag Manager
If using GTM:
- Install GTM: GTM Setup for Duda
- Create Custom HTML tag with Meta Pixel code
- Set trigger to All Pages
- Publish GTM container
Standard Events
PageView (Automatic)
Included in base code - fires on all pages.
ViewContent (Product Pages)
Using Duda's dmAPI:
<script>
document.addEventListener('DOMContentLoaded', function() {
if (window.dmAPI && window.dmAPI.getProductInfo) {
var product = window.dmAPI.getProductInfo();
if (product) {
fbq('track', 'ViewContent', {
content_name: product.name,
content_ids: [product.id],
content_type: 'product',
value: product.price,
currency: product.currency || 'USD'
});
}
}
});
</script>
AddToCart
<script>
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.add-to-cart-button').forEach(function(btn) {
btn.addEventListener('click', function() {
if (window.dmAPI && window.dmAPI.getProductInfo) {
var product = window.dmAPI.getProductInfo();
if (product) {
fbq('track', 'AddToCart', {
content_name: product.name,
content_ids: [product.id],
content_type: 'product',
value: product.price,
currency: product.currency || 'USD'
});
}
}
});
});
});
</script>
Lead (Form Submissions)
<script>
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('form').forEach(function(form) {
form.addEventListener('submit', function() {
fbq('track', 'Lead', {
content_name: form.id || 'contact_form'
});
});
});
});
</script>
Purchase
For order confirmation page:
<script>
// Get order data from URL parameters or Duda order API
fbq('track', 'Purchase', {
value: ORDER_VALUE,
currency: 'USD',
content_type: 'product'
});
</script>
Verification
Meta Pixel Helper
- Install Meta Pixel Helper extension
- Visit your live Duda site
- Click extension icon to verify pixel status
Events Manager
- Go to Events Manager
- Select your Pixel
- Check Test Events tab
- Browse your site and verify events appear
Conversion API (CAPI)
Server-side tracking sends events directly from your server to Meta, bypassing ad blockers and improving match rates after iOS 14+ privacy changes.
Duda does not offer native CAPI support. Use one of these approaches:
Option 1: Server-Side GTM via Stape.io
- Set up a Stape.io server-side GTM container
- Configure the Meta CAPI tag in your server container
- Forward browser-side pixel events to your server endpoint
- Stape handles deduplication between browser and server events
Option 2: Duda Webhooks + Custom Server
- In Duda, enable ecommerce webhooks for
order.createdevents - Build a small server endpoint (Node.js, Python, etc.) that receives the webhook
- Forward the purchase data to Meta's Conversions API with the required parameters (
event_name,event_time,user_data,custom_data) - Include
event_idmatching your browser-sidePurchaseevent for deduplication
Consent Management
<script>
// Initialize without firing PageView
fbq('init', 'YOUR_PIXEL_ID');
// Only fire after consent
function firePixelWithConsent() {
fbq('track', 'PageView');
}
// Call firePixelWithConsent() when user grants consent
</script>
Or use GTM Consent Mode with Meta Pixel tag.
Troubleshooting
Pixel Not Firing
- Check Pixel Helper extension
- Verify Pixel ID is correct
- Confirm site is published
- Clear Duda CDN cache
- Test in incognito mode
Events Missing
- Check event code syntax
- Verify dmAPI is available (ecommerce sites only)
- Adjust DOM selectors for your theme
- Test in browser console
Duplicate Events
- Check for multiple pixel implementations
- Remove manual code if using native integration
- Verify GTM isn't firing duplicate tags
Best Practices
- Use native integration when possible for reliability
- Implement CAPI for better accuracy
- Verify domain in Business Manager
- Set up Aggregated Event Measurement for iOS 14+
- Test all events before running ads