To add the Facebook Pixel, you first should locate your Facebook Pixel ID, which is a series of numbers. You can find your current pixel ID or create one here.
Next, follow these steps from Shopify about how to install the Facebook Pixel in the backend.
There are some important notes:
- Turbo users should see this page for specific Facebook Pixel issues.
- If your store uses a popup, drawer, inline or mini cart option, you will not be able to track if a user adds an item to the cart via Facebook or other tracking methods such as Google Analytics.
- If you opt to send customers directly to the checkout process after adding an item to the cart, the "add to cart" event cannot be accurately tracked, but you should still be able to track the InitiateCheckout event.
- On all themes, tracking Facebook's InitiateCheckout, AddPaymentInfo and Purchase events is well supported (this may not apply to Shopify Plus customers who have customized the checkout pages).
- If you need to track when specific buttons or other elements on a page are clicked, or when features such as the mini cart, inline cart, popup cart or drawer cart are activated, you will need to use advanced event tracking. This requires more advanced programming knowledge and is not supported by Out of the Sandbox.
- When using Turbo in "Ludicrous" mode, tracking page loads with the Facebook Pixel and Google Analytics can be inconsistent due to the page preloading feature. Common issues include "double counting" of page views or page views not properly being recorded. To avoid this issue, you can disable the page preloading feature under Sales Channels > Online Store > Themes > Customize (indigo button) > General settings tab > Performance and switch to "Sport" mode.
Tracking the cart page
If tracking when users add an item to your cart is important for your marketing efforts, you should avoid using the popup, drawer, inline or mini cart option in favor of the "page" cart type.
- To set this option, go under Sales Channels > Online Store > Themes > Customize (indigo button) > General Settings tab > Cart).
- Then, create a custom audience using a URL pattern to place users who have visited URLs containing "cart" as the criteria. You can then use this audience to target your advertising.
- To avoid showing advertising to users who added an item to the cart but ultimately purchased, you can either exclude users with the "Purchase" event or create an additional custom audience with a URL pattern matching "thank_you" (the order confirmation page). When building your add, set the your targeting to "include" the the first audience while excluding the second.