Facebook Conversion Tracking
10 September 2020
You can use the Facebook pixel to track your website visitors' actions. This is called conversion tracking. Tracked conversions appear in the Facebook Ads Manager and the Facebook Analytics dashboard, where they can be used to analyze the effectiveness of your conversion funnel and to calculate your return on ad investment. You can also use tracked conversions to define custom audiences for ad optimization and dynamic ad campaigns. Once you have defined custom audiences, we can use them to identify other Facebook users who are likely to convert and target them with your ads.
There are three ways to track conversions with the pixel:
• standard events, which are visitor actions that we have defined and that you report by calling a pixel function
• custom events, which are visitor actions that you have defined and that you report by calling a pixel function
• custom conversions, which are visitor actions that are tracked automatically by parsing your website's referrer URLs
The pixel's base code must already be installed on every page where you want to track conversions.
Standard events are predefined visitor actions that correspond to common, conversion-related activities, such as searching for a product, viewing a product, or purchasing a product. Standard events support parameters, which allow you to include an object containing additional information about an event, such as product IDs, categories, and the number of products purchased.
Tracking Standard Events
All standard events are tracked by calling the pixel's fbq('track') function, with the event name, and (optionally) a JSON object as its parameters. For example, here's a function call to track when a visitor has completed a purchase event, with currency and value included as a parameter:
If our predefined standard events aren't suitable for your needs, you can track your own custom events, which also can be used to define custom audiences for ad optimization. Custom events also support parameters, which you can include to provide additional information about each custom event.
Tracking Custom Events
You can track custom events by calling the pixel's fbq('trackCustom') function, with your custom event name and (optionally) a JSON object as its parameters. Just like standard events, you can call the fbq('trackCustom') function anywhere between your webpage's opening and closingtags, either when your page loads, or when a visitor performs an action like clicking a button.
Each time the pixel loads, it automatically calls fbq('track', 'PageView') to track a PageView standard event. PageView standard events record the referrer URL of the page that triggered the function call. You can use these recorded URLs in the Events Manager to define visitor actions that should be tracked.
For example, let's say that you send visitors who subscribe to your mailing list to a thank you page. You could set up a custom conversion that tracks website visitors who have viewed any page that has /thank-you in its URL. Assuming your thank you page is the only page with /thank-you in its URL, and you've installed the pixel on that page, anyone who views it will be tracked using that custom conversion.
Once tracked, custom conversions can be used to optimize your ad campaigns, to define custom audiences, and to further refine custom audiences that rely on standard or custom events.
Since custom conversions rely on complete or partial URLs, you should make sure that you can define visitor actions exclusively based on unique strings in your website URLs.
Creating Custom Conversions
Custom conversions are created entirely within the Events Manager. Refer to our Advertiser Help document to learn how.
Parameters are optional, JSON-formatted objects that you can include when tracking standard and custom events. They allow you to provide additional information about your website visitors' actions. Once tracked, parameters can be used to further define any custom audiences you create.
To include a parameter object with a standard or custom event, format your parameter data as an object using JSON, then include it as the third function parameter when calling the fbq('track') or fbq('trackCustom') functions.
If our predefined object properties don't suit your needs, you can include your own, custom properties. Custom properties can be used with both standard and custom events, and can help you further define custom audiences.
Now that you're tracking conversions, we recommend that you use them to define custom audiences, so you can optimize your ads for website conversions.