skills/marketing-growth/meta-ads-integration/SKILL.md
Set up and optimize Meta (Facebook/Instagram) ad campaigns with Conversions API server-side tracking, dynamic product ads, and catalog sync for ecommerce
npx skillsauth add finsilabs/awesome-ecommerce-skills meta-ads-integrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Meta (Facebook/Instagram) is the dominant paid social channel for ecommerce, but reliable attribution requires pairing the browser-based Meta Pixel with server-side Conversions API (CAPI). Post-iOS 14, browser signals alone under-report 30–60% of conversions; CAPI restores signal fidelity by sending purchase events directly from your server. For Shopify, WooCommerce, and BigCommerce, official integrations handle both Pixel and CAPI automatically — no custom code required. Custom code only belongs in the Custom/Headless section.
| Platform | Recommended Method | CAPI Support | Catalog Sync | |----------|--------------------|-------------|-------------| | Shopify | Native Meta Sales Channel | Yes (built-in) | Yes (automatic) | | WooCommerce | Facebook for WooCommerce plugin | Yes (built-in) | Yes (automatic) | | BigCommerce | Meta channel in Channel Manager | Yes (built-in) | Yes (automatic) | | Custom / Headless | Meta Pixel + facebook-nodejs-business-sdk | Manual CAPI implementation | Manual feed generation |
All three major platforms have official Meta integrations that install both the Pixel and CAPI in a single setup — use these rather than manually pasting Pixel code.
For headless stores, you must install both the browser Pixel and server-side CAPI manually.
Browser-side Pixel (add to <head> on every page):
// Replace YOUR_PIXEL_ID with your Pixel ID from Meta Events Manager
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
// Product page
fbq('track', 'ViewContent', {
content_ids: [product.sku],
content_type: 'product',
value: product.price,
currency: 'USD',
});
// Purchase — pass eventID for deduplication with CAPI
const purchaseEventId = `purchase-${orderId}`;
fbq('track', 'Purchase', {
content_ids: order.lineItems.map(i => i.sku),
value: order.subtotal,
currency: order.currencyCode,
order_id: order.id,
}, { eventID: purchaseEventId });
Server-side CAPI (send from your order webhook):
import { FacebookAdsApi, ServerEvent, UserData, CustomData, EventRequest } from 'facebook-nodejs-business-sdk';
FacebookAdsApi.init(process.env.META_CAPI_ACCESS_TOKEN!);
async function trackPurchaseCapi(order: Order, req: Request) {
const eventId = `purchase-${order.id}`; // MUST match the eventID passed to fbq()
const userData = new UserData()
.setEmail(order.customerEmail) // SDK hashes PII automatically (SHA-256)
.setPhone(order.customerPhone)
.setFirstName(order.customerFirstName)
.setLastName(order.customerLastName)
.setZip(order.shippingAddress?.zip)
.setCountry(order.shippingAddress?.countryCode)
.setClientIpAddress(req.ip)
.setClientUserAgent(req.headers['user-agent'] as string)
.setFbp(req.cookies['_fbp']) // _fbp cookie = browser identity signal
.setFbc(req.cookies['_fbc']); // _fbc cookie = click identity signal
const customData = new CustomData()
.setValue(order.subtotal)
.setCurrency(order.currencyCode)
.setContentIds(order.lineItems.map(i => i.sku))
.setContentType('product')
.setNumItems(order.lineItems.length)
.setOrderId(order.id);
const event = new ServerEvent()
.setEventName('Purchase')
.setEventId(eventId)
.setEventTime(Math.floor(Date.now() / 1000))
.setUserData(userData)
.setCustomData(customData)
.setActionSource('website');
await new EventRequest(process.env.META_CAPI_ACCESS_TOKEN!, process.env.META_PIXEL_ID!)
.setEvents([event])
.execute();
}
Product Catalog Feed for Dynamic Product Ads: Generate a CSV feed and serve it at a stable URL. Register it in Meta Commerce Manager → Catalog → Data Sources → Add Data Feed.
// Generate CSV with required columns: id, title, description, availability, condition, price, link, image_link, brand
// Schedule regeneration every 4 hours — serve at a stable /feeds/meta-catalog.csv endpoint
Build a three-tier campaign structure in Meta Ads Manager:
Campaign 1: Prospecting
Campaign 2: Retargeting
Campaign 3: Retention / LTV
For Shopify and WooCommerce, the official integrations auto-sync the product catalog. Verify setup:
In Meta Events Manager → Data Sources → [Your Pixel] → Overview:
| Signal | How to Improve | |--------|---------------| | EMQ below 6 | Send more user data (email, phone, fbp/fbc cookies) | | CAPI not firing | Check platform integration is set to Maximum data sharing | | Duplicate conversions | Verify deduplication — eventID must match between Pixel and CAPI | | ViewContent not firing | Check the platform integration is active and pixel is on product pages |
_fbp and _fbc cookies in CAPI — these are the strongest identity signals for iOS 14+ attribution; include them in every CAPI eventorder_id as the deduplication key — prevents duplicate conversion counting when both Pixel and CAPI fire for the same purchase| Problem | Solution |
|---------|----------|
| Duplicate purchase conversions in Ads Manager | Ensure eventID is identical in both Pixel and CAPI calls for the same event; Shopify's native integration handles this automatically |
| Conversions under-reported after iOS 14 | Set data sharing to Maximum in the Shopify Facebook channel settings or enable CAPI in WooCommerce Facebook plugin |
| Dynamic Product Ads show wrong price | Shopify/WooCommerce catalog syncs happen up to every 24 hours; for time-sensitive price changes, trigger a manual sync |
| Low EMQ score despite native integration | Go to Meta Events Manager → check that both browser and server events are showing; verify the integration is fully authorized |
| iOS 14+ campaign reach is low | Go to Meta Business Manager → Brand Safety → Domains → Verify your domain; enable Aggregated Event Measurement |
| Ad account disabled | Never send raw (unhashed) PII through the API; use the official SDK which hashes all data automatically |
tools
Let shoppers save products to a wishlist, share it with friends, and get notified when saved items come back in stock or drop in price
development
Build a themeable storefront with design tokens and CSS custom properties that supports white-labeling, multi-brand variants, and dark mode
development
Speed up product discovery with instant search suggestions, fuzzy typo matching, and category-aware results powered by Algolia or Elasticsearch
development
Build a mobile-first storefront with thumb-friendly navigation, sticky add-to-cart buttons, and touch-optimized components for high mobile conversion