Stape

Facebook conversion API for Shopify

Published
Mar 20, 2023
Also available in

Facebook paid campaigns have been a go-to marketing channel for Shopify sellers, but in recent years achieving success with these adverts has become more complicated. With expanding tracking restrictions, it is more difficult to accurately target campaigns and track user acquisition costs - leaving businesses with less insight into their successes or failures than ever. However, with some creativity and new tracking technology, you can work around these issues for maximum benefit.

Facebook Conversion API is a relatively new way of tracking that helps advertisers measure and optimize their campaigns more accurately by sending server-side events directly to Facebook. It is handy in mitigating the impact of browser restrictions, such as ad-blockers or cookie policies, which may affect the accuracy of the Facebook Pixel. By combining client-side (Facebook Pixel) and server-side (Conversion API) events, advertisers can get a complete picture of their campaigns' performance.

Shopify users have several options on how to integrate Facebook conversion API. In this article, we will discuss all of them and show how to implement the Facebook conversion API for Shopify using the Stape Server GTM app

Benefits of setting up Facebook conversion API for ShopifyCopy link to this section

Understanding which ads drive conversions is critical to optimizing your ad spend and improving the overall effectiveness of campaigns. The Facebook Conversion API allows for precise attribution by using server-side tracking to capture and convey data that might be missed due to ad blockers or other client-side factors. By accurately measuring and attributing conversion events, businesses can invest in the most effective ads and channels while continuously optimizing their campaigns for better results.

Tracking conversions using traditional client-side methods, such as JavaScript or cookies, can contribute to slower site performance, impacting the user experience and potentially leading to lost sales. With server-side tagging, the Facebook Conversion API can reduce the load on your website, leading to faster load times and a more customer-friendly experience. A seamless and fast website improves the user experience and increases customer satisfaction and conversions.

Facebook Conversion API for Shopify also improves security by reducing the potential for third-party data breaches or manipulation. Server-side tracking restricts data access to a limited set of authenticated servers, making it more difficult for malicious actors to gain access or manipulate data for their benefit. This improved security translates to higher trust between your business and its customers, increasing sales and customer loyalty.

By leveraging the capabilities of the Facebook Conversion API, and Shopify, you can make more informed decisions, optimize your marketing efforts, and drive revenue growth.

Ways of implementing FB CAPI for ShopifyCopy link to this section

1. ZapierCopy link to this section

For those familiar with Zapier, it will be an easy way to integrate FB CAPI on Shopify. Though there are three main disadvantages: 

- lack of customization

- the complexity of the deduplication setup

- price

The setup is simple. You must select which action in Shopify should send the server event to Facebook. But there is no possibility of adding any custom events or tracking events like add to cart or product view. Besides, if you want to use a hybrid approach of FB pixel + FB CAPI as suggested in Meta documentation, sending the same event ID from the web and Zapier server will be hard. 

shopify app with zapier

2. Using native Shopify integrationCopy link to this section

This approach is also simple, but it usually comes with issues like low match quality score, not accurate event tracking. There are also some issues with consent management and cookie lifetime as well.

shopify integration with facebook

3. With server-side Google Tag ManagerCopy link to this section

By using server-side Google Tag Manager along with Facebook Conversion API, your Shopify store can gain a more holistic view of user activity across multiple channels, leading to better ad performance, higher conversion rates, and lower acquisition costs. 

All because setting up FB CAPI for Shopify using server Google Tag Manager allows customization, data enrichment, and setting up proper event deduplication. The following section will show how to set up FB CAPI for Shopify using the stape sGTM app

add shopify with stape server gtm app

How to set up Facebook conversion API for ShopifyCopy link to this section

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

Here are some of the key benefits of using Data Tag/Data Client to send data from Web to Server container instead of using GA4 or UA:

  • Data Tag/Data Client can work with arrays of data.
  • Data Tag tries to parse your DataLayer and send all information it can find to the server container.
  • The Data tag adds some options to modify data inside it.
  • If you are using server FB Tag to set up FB conversion API and combine it with Data Tag/Data Client FB Tag, it will take data from Data Tag, and you won't need to add product and user information manually.

Sending Data From the Google Tag Manager Web Container to the Server ContainerCopy link to this section

We will look at sending data from a Web GTM container to a Server GTM container based on the Data Tag and Data Client using the add_to_cart event as an example.

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

2. To ensure e-commerce events, product, and user data are set up correctly, open a web GTM container and check the data layer the stape server GTM app sends for each e-commerce event. You might need to configure a data layer variable for an event or user data you must send to Facebook. 

in web gtm container the data layer

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

4. 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 my case, a custom event add_to_cart.

data tag configuration

5. 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 this link -> 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.

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

data client configuration

7. Open the preview mode of the web and server container and check that the server container sees Data Tag information. If you don’t see any events, ensure you’ve published the Server container and check that the Preview header is correct. 

FB conversion API for ShopifyCopy link to this section

Now let me show you how to create a Facebook conversion API “Add To Cart” event with the help of Data Tag/Data Client.

1. 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 type event data

2. Create a new Tag. Go to the community template gallery and add Facebook Conversion 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. 

facebook conversion api tag

3. 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

Verifying the setup is complete and correctCopy link to this section

1. Open the web and server GTM containers debugger and click through your site. In the server GTM container, you should see requests claimed by Facebook conversion API Tag. 

facebook add to cart

2. You can test this event inside the Facebook testing tool as well. 

teste event in facebook testing tool

Conclusion:Copy link to this section

Overall, Shopify users have a variety of options when it comes to integrating Facebook’s conversion API. We’ve discussed each possibility thoroughly and explored how to deploy the Facebook conversion API for Shopify using the Stape Server Google Tag Manager app

Shopify users should take the time to review their own business needs and use cases before determining which integration is best for them. Then, whether you choose a manual solution or rely on automation, implementing the Facebook conversion API will provide your company with additional insights into customer behaviors, help optimize campaigns, and deliver more engaging experiences for your customers. 

To get started quickly and achieve the best results, we recommend trying the Stape Server GTM app for Shopify, which provides an easy-to-use implementation option.

Want to set up Facebook Conversion API for Shopify?

We can help you with the setup! Click Get help, fill-up the form, and we will send you a quote.

Get help
Tagged with:FacebookShopify

Host your GTM server at Stape