Facebook pixels allow you to track conversions and analyze how users interact with your website. One of the key events you’ll want to track is purchases – this allows you to see how well your Facebook ads are driving sales.
To create a purchase event on Facebook pixels, you’ll need to add a bit of code to your website to track when a purchase is made. When a user completes a purchase, the pixel will fire and send data back to Facebook so you can see your conversion metrics.
In this guide, we’ll cover everything you need to know to properly setup purchase events for Facebook pixels including:
- What Facebook purchase events are and why they matter
- How to add the purchase event code to your website
- Setting the value parameter to track revenue
- Best practices for implementation
With purchase events correctly configured, you’ll be able to see your most important ecommerce conversion data like revenue and return on ad spend in Facebook Analytics and Ads Manager.
What are Facebook purchase events?
Facebook purchase events allow you to track when a user completes a purchase on your website.
Some key things to know about purchase events:
- They are one type of conversion event you can track with the Facebook pixel.
- Other conversion events include Lead, ViewContent, AddToCart, etc.
- Purchase events fire when the transaction is completed, like when payment info is submitted.
- This allows you to track your revenue and return on ad spend driven by Facebook ads.
- The data shows up in Facebook Analytics, Ads Manager, and Facebook reports.
Without tracking purchase events, you are missing out on your most critical ecommerce data like how much revenue you’re earning from Facebook traffic.
Purchase events are part of Facebook’s Conversions API alongside other tracking like custom conversions. They give you the end-to-end view of how your ads perform through to revenue.
Why Facebook purchase tracking matters
There are a few key reasons properly tracking purchases with Facebook pixels is critical:
- See your return on ad spend (ROAS) – With purchase data, you can calculate revenue earned per amount spent on ads which is crucial for understanding profitability.
- Optimize for results – Know which ads drive purchases so you can double down on what’s working.
- Track ROI over time – Monitor how your Facebook marketing ROI evolves as you refine targeting and creative.
- Attribute revenue – Give credit to multiple touchpoints like Facebook that contributed to a purchase.
- Automate ads – Use rules like purchase ROAS to automatically control Facebook ad budgets and bids.
In short, you’re flying blind without clearly tracking purchases through Facebook pixels. Implementation may take some development work but is well worth the effort.
How to add the Facebook pixel purchase event code
To enable Facebook purchase tracking, you’ll need to add a few lines of code on your website to fire the event on transactions.
Here are the key steps:
- Install the base Facebook pixel code
- Add the purchase event snippet on your purchase confirmation or “thank you” page
- Customize the value parameter to capture order revenue (optional)
- Test event firing and data accuracy
Let’s look at how to actually implement this for proper purchase tracking.
1. Install base Facebook pixel
First you need the base Facebook pixel code installed on every page. If you don’t have this already implemented, see Facebook’s docs for detailed instructions on getting started.
The base code allows you to:
- Track basic page visits and events like Lead, ViewContent, AddToCart, etc.
- Enable detailed attribution reporting in Ads Manager and Analytics
- Sync audiences for retargeting like website visitors back to Facebook
You’ll paste a snippet similar to this on every page:
<script> !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', 'YOUR_PIXEL_ID'); fbq('track', 'PageView'); </script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=YOUR_PIXEL_ID&ev=PageView&noscript=1" /></noscript>
Be sure to replace YOUR_PIXEL_ID with your actual pixel ID provided in Facebook Ads Manager.
2. Add purchase event snippet
Once your base pixel is installed, you can enable purchase tracking by adding another snippet on your purchase confirmation or “thank you” page.
This code will fire the Purchase event when a transaction is completed:
<script> fbq('track', 'Purchase', { value: TRANSACTION_TOTAL, currency: 'USD' }); </script>
Place this code on your confirmation page where the purchase is finalized, often called “Order Confirmation”, “Thank You”, “Receipt”, etc.
Some important notes:
- The value parameter is optional but recommended to capture revenue amounts.
- You may need to dynamically insert the order total value from your ecommerce platform in place of TRANSACTION_TOTAL.
- For non-US stores, update the currency parameter.
Tip: Add the Purchase code right before the closing </body> tag for reliable tracking.
3. Set value parameter to track revenue
To track how much revenue you earn from Facebook ads, you need to pass the total transaction amount into the Purchase event.
Here is an example dynamically pulling the order total:
<script> // Pull order details const order = { currency: 'USD', value: 123.45 // Dynamically add order total } // Fire purchase event fbq('track', 'Purchase', order); </script>
This allows you to calculate your ROAS (return on ad spend) and see revenue data in Facebook reports.
Some tips for setup:
- Find the order confirmation variable like “orderTotal”, “receiptAmount” etc in your platform.
- For multi-currency stores, dynamically pull the “currency” value too.
- Use a decimal value like 123.45 for the total to support cents.
- The value field is required for revenue attribution – set to 0 if no order total available.
Capturing the value accurately is crucial for understanding your Facebook ads ROI over time.
4. Test purchase tracking implementation
Once you’ve added purchase events, it’s important to validate they are firing correctly before relying on the data.
Here are a few ways to test your Facebook pixel purchase tracking:
- Use the Facebook Pixel Helper browser extension to monitor firing.
- Verify the purchase event appears in Facebook Events Manager.
- Complete a test transaction and look for revenue in Ads Manager.
- Check for accuracy compared to your own order data.
Address any issues with firing or revenue discrepancies before making decisions based on the data.
Debug implementation problems early like missing values to ensure you collect accurate purchase information.
Best practices for Facebook pixel purchase tracking
To get purchase tracking setup optimally, keep these tips in mind:
Fire on final confirmation page
Add the Purchase code on your website’s final “thank you” page after the transaction is fully complete. This ensures you don’t overcount abandons as purchases.
Pass order value dynamically
Insert the order total value dynamically to capture revenue accurately. Map to a variable like Order.Total or use ecommerce plugin tracking.
Include all required parameters
Certain parameters are required – be sure to always pass the currency and set value to 0 if no order total available.
Enable server-side API for accuracy
For the most accurate order revenue, use Facebook’s server-side API which removes reliance on client-side JavaScript.
Check revenue daily
Review your Facebook revenue daily to catch any tracking issues early. Segment by traffic source and audit data.
Re-test with site changes
Any website changes like URL restructures can break tracking – retest purchasing after changes go live.
Following these best practices will get your Facebook pixel set to properly record purchases and revenue from your Facebook campaigns.
Conclusion
Implementing Facebook pixel purchase tracking is crucial to understanding the ROI of your Facebook ads and campaigns. By following the steps in this guide, you’ll be set up to accurately track revenue and optimize your ad strategy.
The key takeaways are:
- Add the base Facebook pixel code to enable conversion tracking
- Install the Purchase event snippet on your order confirmation pages
- Pass the order value dynamically to capture revenue
- Validate tracking fires correctly before relying on data
- Use best practices like server-side API for accurate attribution
With purchase events properly set up, you’ll gain visibility into your most important ecommerce KPI – return on ad spend. Avoid flying blind without this critical conversion tracking.
Setup purchase tracking as soon as possible to unlock revenue data and maximize the ROI of your Facebook ad campaigns.
Section | Key Points |
---|---|
Introduction |
|
What are Facebook Purchase Events? |
|
Add the Purchase Event Code |
|
Best Practices |
|
Conclusion |
|