This article is a guide explaining how to modify your Meta Pixel to support dynamic ads campaigns. To learn about the modifications required to the app SDK, see Facebook app SDK modifications for dynamic ads.
Track the funnel (five Pixel events for dynamic ads)
By default, dynamic retargeting requires that three events are used in your Pixel. These events are labeled ViewContent, AddToCart, and Purchase, but they can also be used to represent other events, for example, product category page visits. However, you can also use custom events (ask your Account Manager to enable this feature). Events, their required parameters, and parameter values are presented below.
Event Name | Required Parameters | content_ids parameter value |
---|---|---|
Search | content_type , content_ids |
array of IDs that identify the top search results e.g. top product(s) on the search results page |
ViewCategory | content_type , content_ids |
array of IDs that identify the product(s) shown on the category page e.g. top products |
ViewContent | content_type , content_ids |
array of IDs that identify the product(s) viewed on the page |
AddToCart | content_type , content_ids |
array of IDs that identifies the product(s) that have been added to the cart |
Purchase | content_type , content_ids |
array of IDs that identify the product(s) that have been purchased. This event is typically fired on the checkout confirmation page. |
MyCustomEvent | content_type , content_ids |
array of IDs that identify the respective product(s). This can be any other product-related action, and you can even use custom parameters to filter. (Ask your Account Manager to enable.) |
Note that content_type and content_ids parameters are required for all events.
content_ids
must be an array of IDs even if there is only one product ID. These IDs are used to match the products the user has visited to IDs of products in your product feed.content_type
defines whether your content ID is a product, product_group or a field specific to another vertical. If you are matching the ID of a product, use product. If you are matching a product group, read more here.
Search: on the search results page
Send the product IDs of top search results
<script>
fbq('track', 'Search', {
search_string: 'running shoes',
content_ids: ['1234abc', '5678def', '9012ghi'],
content_type: 'product',
value: 0.00,
currency: 'EUR'
});
</script>
ViewCategory: on the product category page
Send the product IDs of the category's top products. Do note that the ViewCategory is a Custom Event, therefore the 'trackCustom' is used.
<script>
fbq('trackCustom', 'ViewCategory', {
content_name: 'Really Fast Running Shoes',
content_category: 'Apparel & Accessories > Shoes',
content_ids: ['1234abc', '5678def', '9012ghi'],
content_type: 'product',
value: 0.00,
currency: 'EUR'
});
</script>
ViewContent: on the product page
<script>
fbq('track', 'ViewContent', {
content_ids: ['1234abc'],
content_type: 'product',
value: 0.00,
currency: 'EUR'
});
</script>
AddToCart: on the shopping cart
<script>
fbq('track', 'AddToCart', {
content_ids: ['1234abc'],
content_type: 'product',
value: 0.00,
currency: 'EUR'
});
</script>
Purchase: on the thank you page
Send the product IDs of all products purchased in this order.
<script>
fbq('track', 'Purchase', {
content_ids: ['1234abc', '5678def', '9012ghi'],
content_type: 'product',
value: 100.00,
currency: 'EUR'
});
</script>
Troubleshooting
Error: Pixel is not Paired with any product Catalog
You might see an error when checking with Pixel Helper. The error says: Pixel is not Paired with any product Catalog
Two reasons:
Content_ids should be a string, replace Content_ids:[123] with Content_ids:["123"].
You might see this error even if content_ids value is sent as a string and this is completely NORMAL: the error will automatically go away once you have created a product catalog on Smartly. If you don't have any catalogs using this feed, Facebook is not yet able to match the product ID with any product.