Facebook Conversions API for Magento 2

Ivanna Holubovska

Ivanna Holubovska

Author
Updated
Aug 27, 2026
Also available in

Recognizing the power of data-driven marketing strategies, Facebook has developed the Conversions API, a powerful tool that enables businesses to send events from server to server and it means you can now seamlessly connect your Magento 2 -powered online store with the vast advertising capabilities of the social media giant. 

This article explores Facebook Conversion API for Magento 2 – what it does, why it matters, and how it helps boost marketing performance and online sales. Whether you're setting up Magento 2 Facebook Conversion API for the first time or looking to strengthen an existing Magento 2 Facebook integration, this guide walks through the full process.

Benefits of Facebook Conversion API for Magento 2

The Facebook Conversion API for Magento 2 offers a range of benefits that empower eCommerce businesses to maximize their marketing efforts and achieve higher conversions:

  • Provides seamless integration between Magento 2-powered online stores and Facebook's advertising platform, allowing businesses to track and optimize their advertising campaigns more effectively
  • Syncs data directly from the server side rather than relying solely on browser-based events, ensuring more accurate tracking of conversions even when cookies may be blocked or absent
  • Enables deeper insights into customers' actions and behaviors, facilitating better targeting and more personalized ad experiences
  • Enhances data privacy and security by keeping sensitive customer information within the server environment, reducing the risk of data breaches
  • Offers increased scalability and flexibility, allowing businesses to handle high volumes of traffic and transactions without compromising performance

With these benefits, the Facebook Conversions API for Magento 2 empowers businesses to optimize their advertising campaigns, drive more relevant and personalized experiences, and ultimately boost their online sales.

Facebook CAPI vs Facebook Pixel for Magento 2

Facebook Pixel and Facebook Conversions API both track what shoppers do on your Magento 2 store, but they collect that data very differently. Pixel is a script that runs in the visitor's browser, tracking add-to-carts, purchases, and other events client-side. Because it relies on third-party cookies, its accuracy is increasingly limited by ad blockers, Safari and Firefox's tracking prevention, and iOS restrictions – all of which can quietly erase a meaningful share of your conversion data.

Conversions API takes a different approach: events are sent server-to-server, bypassing the browser entirely. For a Magento 2 store, this means order and event data travels from your server (via your Stape tagging server) directly to Facebook, so ad blockers and cookie restrictions have nothing to intercept. CAPI also uses first-party cookies rather than third-party ones, which last far longer and improve how accurately conversions get attributed back to the ad campaigns that drove them. On top of that, CAPI can report offline conversions — useful if your Magento store takes phone or in-person orders that started with a Facebook ad click.

The two methods aren't mutually exclusive. Facebook recommends running Pixel and CAPI together on your Magento 2 store for the most complete picture of customer behavior, as long as event deduplication is configured correctly to avoid double-counting the same conversion from both sources.

Facebook PixelFacebook Conversions API
Tracking typeClient-sideServer-side
Offline event trackingNoYes
Resistance to ad blockersLowHigh
Cookie typeThird-partyFirst-party
Data controlLowHigh

Magento 2 Facebook extension explained

The Magento 2 Facebook shop integration extension by Stape plus Setup Wizard let you set up server-side GTM quickly, generate main eCommerce events, and import prepared tags for Google, Meta, TikTok, and more. Because events run through a cloud server hosted by Stape, you can regain up to 40% more conversions and improve ROAS.

Stape's Conversion Tracking extension is the easiest way to integrate Magento 2 Facebook shop tracking with Conversions API. Rather than manually editing your GTM script, it automatically adds your tagging server URL, so you can load a server GTM container from your own subdomain. It's also compatible with other extensions that already insert GTM on your site, so there's no need to rebuild your existing setup.

Behind the scenes, the actual data flow to Facebook happens through Data Tag/Data Client and the Facebook Conversions API tag inside your server GTM container – this part works independently of any Magento extension. So it's possible, in theory, to set things up manually by adding the GTM script yourself and building a custom data layer. The extension just takes care of that groundwork for you.

Beyond simplifying setup, this Magento 2 Facebook shop extension brings a few extras that help Facebook tracking accuracy specifically. It supports Custom Loader, which hides GTM and GA from ad blockers and tracking-prevention mechanisms – this is a Stape container-level Power-Up, so the extension is really just the easiest way to implement it on Magento rather than the only possible one. Combined with a custom domain, it also extends cookie lifetime, which strengthens the attribution benefits CAPI already has over Pixel. There's also Cookie Keeper, which restores marketing cookies in Safari 16.4+, and support for both the Luma and Hyva themes.

Setup itself is handled from the Magento 2 Admin: install the extension from the Marketplace, create a server GTM container with Stape, then enter your web container ID, custom domain, and custom loader details in the extension's configuration screen. From there, you can enable data layer support for ecommerce events (view item, add to cart, purchase, etc.) and user data (email, name, customer ID) – the same data layer used later to send events to Facebook via CAPI.

How to set up Facebook Conversions API for Magento 2

2. Add and configure the Facebook shop integration extension for Magento 2.

3. Send data to the server Google Tag Manager container. There are two most popular ways to do that:

3. In your Web Google Tag Manager go to the template gallery, find Data Tag, and add it to the Workspace.

4. To ensure eCommerce events, product, and user data are set up correctly, open a web GTM container and check the data layer the Stape extension sends for each eCommerce event. You might need to configure a data layer variable for an event or user data you must send to Facebook. 

data tag configuration

5. Go to Tags, and create a new Data Tag.

6. Inside the Data Tag in the Event Name, select Standard and choose Add To Cart. Add your tagging server URL. Add Event Data (such as product name, value, ID, etc.) and User Data manually or select Send all from DataLayer. You can leave all the other settings unchanged. Add a trigger, in our case, a custom event add_to_cart.

data tag configuration

7. Add Data Client inside the Google Tag Manager server container. This Client will listen to Data Tag, process all information, and convert it into events data inside the server container. Open Data Client on GitHub -> Click on the green button Code -> Download Zip file -> Go to the Templates tag in the Google Tag Manager Server container -> On the Client Templates, click New -> Import -> Click Save.

8. Create a Data Client in the server GTM container. Select Clients, click New, and choose Data Client

data client configuration

9. Create variables inside the Server container that will capture the request_data you sent from the Web container. Go to the Variables tab inside the Server container -> Create new variable -> Variable type Event Data -> Add Key Path.

variable configuration

10. Create a new Tag. Go to the community Template Gallery and add Facebook Conversions API Tag. In the Tag select override in Event Name Setup Method and choose AddToCart event. Fill in your FB API Access Token, FB Pixel ID, and Test ID to see events inside the FB testing tool. Add User Data and Custom Data that you wish to send to Facebook, including identifiers like fbp and fbc used for Facebook ID track and event matching.

facebook capi tag configuration

11. Add a trigger. Click on Triggers -> + in the top right corner-> Trigger settings and select a Custom Event trigger -> type add_to_cart to the Event Name, and this trigger will fire on Some Custom Events -> Client Name equals Data Client. Click Save.

trigger configuration

Conclusion

In this article, we've highlighted the advantages of Facebook Conversion API for Magento 2 and walked through the steps of implementation. With Stape's Magento 2 Facebook Conversion API extension, it's now much easier to get started with server-side tracking and a fully connected Magento 2 Facebook store integration. The same server-side approach applies to Bing server-side tracking if you run Microsoft Ads campaigns alongside Facebook. And if you have any questions, don't hesitate to contact us – our team of experts will guide you through or provide an excellent consultation!

Want to try the server side?Sign up now!

Ivanna Holubovska

Ivanna Holubovska

Author

Ivanna is a Lead Content Manager at Stape and a certified author on Clutch and KyivPost. She writes high-quality content on server-side tracking to help businesses optimize strategies and analytics.

Comments

Try Stape for all things server-side