Meta pixel
Sends six tracking events to the page's fbq as Meta Pixel standard events, fbq('track', name, params, { eventID }). The pixel's base code sends PageView itself. Vendor docs: Meta Pixel standard events.
Config
Off by default. On, with the store's name:
<script>
window.nextConfig = {
analytics: {
destinations: { meta: { enabled: true, storeName: 'shop' } },
},
};
</script>The 0.4.x analytics.providers.facebook.enabled: true turns it on too, and nextConfig.storeName is read when storeName is not set.
What loads
meta-*.js (about 2 KB), only when it is on. The SDK never loads the pixel: the page has its base code. Without fbq the SDK logs one warning and sends nothing.
Events
| Tracking event | Meta event |
|---|---|
page_viewed | Not sent |
product_viewed | ViewContent |
product_list_viewed | Not sent |
product_added_to_cart | AddToCart |
product_removed_from_cart | Not sent |
cart_updated | Not sent |
checkout_started | InitiateCheckout |
checkout_contact_info_submitted | Lead |
checkout_shipping_address_submitted | Not sent |
checkout_shipping_method_submitted | Not sent |
checkout_payment_info_submitted | AddPaymentInfo |
checkout_completed | Purchase |
upsell_completed | Purchase |
upsell_viewed | Not sent |
upsell_skipped | Not sent |
promotion_viewed | Not sent |
promotion_selected | Not sent |
eventID is the tracking event's event_id, so a Conversions API event with the same id is counted once. With storeName, an order's Purchase has eventID: '<storeName>-<order number>', the id the store's server-side events use.
ViewContent
A product the shopper sees. See the Meta reference.
From product_viewed.
The fields of MetaContents.
fbq('track', 'ViewContent', {
content_ids: ['1'],
contents: [
{
id: '1',
quantity: 1,
item_price: 49,
},
],
content_type: 'product',
content_name: 'Earbuds ×1',
value: 49,
currency: 'USD',
}, { eventID: '3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e' });AddToCart
A product added to the cart. See the Meta reference.
From product_added_to_cart.
The fields of MetaContents.
fbq('track', 'AddToCart', {
content_ids: ['1'],
contents: [
{
id: '1',
quantity: 1,
item_price: 49,
},
],
content_type: 'product',
content_name: 'Earbuds ×1',
value: 49,
currency: 'USD',
}, { eventID: '3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e' });InitiateCheckout
The checkout started. See the Meta reference.
From checkout_started.
The fields of MetaContents, and:
| Field | Type | |
|---|---|---|
num_items | number | How many units the cart holds. |
fbq('track', 'InitiateCheckout', {
content_ids: ['1'],
contents: [
{
id: '1',
quantity: 1,
item_price: 49,
},
],
content_type: 'product',
content_name: 'Earbuds ×1',
value: 49,
currency: 'USD',
num_items: 1,
}, { eventID: '3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e' });Lead
The shopper left their contact details. See the Meta reference.
From checkout_contact_info_submitted.
| Field | Type | Present | |
|---|---|---|---|
value | number | optional | |
currency | string | optional |
fbq('track', 'Lead', {
value: 49,
currency: 'USD',
}, { eventID: '3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e' });AddPaymentInfo
The payment details were submitted. See the Meta reference.
From checkout_payment_info_submitted.
The fields of MetaContents.
fbq('track', 'AddPaymentInfo', {
content_ids: ['1'],
contents: [
{
id: '1',
quantity: 1,
item_price: 49,
},
],
content_type: 'product',
content_name: 'Earbuds ×1',
value: 49,
currency: 'USD',
}, { eventID: '3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e' });Purchase
An order was paid: the order, or one accepted upsell. See the Meta reference.
From checkout_completed, upsell_completed.
The fields of MetaContents, and:
| Field | Type | |
|---|---|---|
value | number |
fbq('track', 'Purchase', {
content_ids: ['EB-2'],
contents: [
{
id: 'EB-2',
quantity: 2,
item_price: 44.5,
},
],
content_type: 'product',
content_name: 'Earbuds',
value: 89,
currency: 'USD',
}, { eventID: '1001' });With storeName: 'shop': { eventID: 'shop-1001' }.
Types
MetaContents
The parameters Meta's ecommerce standard events share.
| Field | Type | Present | |
|---|---|---|---|
content_ids | string[] | always | The lines' SKUs, else their package ids. |
contents | MetaContent[] | always | |
content_type | "product" | always | |
content_name | string | optional | The product name, when the event is about one product. |
value | number | optional | What the lines cost. |
currency | string | optional | ISO 4217, such as USD. |
MetaContent
One product of a Meta event's contents.
| Field | Type | Present | |
|---|---|---|---|
id | string | always | The line's SKU, else its package id. |
quantity | number | always | |
item_price | number | optional | What one unit costs, when the line is priced. |