What is the biggest challenge to deploy Facebook CAPI using server-side GTM? The new Google Tag.

HomeInsightsBlogs | Last Updated January 10, 2025 - by ashish rajkumar chainani under digital analytics

Published onDecember 11, 2023

For the longest time, if you wanted to implement a Facebook (aka Meta) tag on your website, you would use the client-side browser pixel. However, as the need for privacy becomes more important and browsers introduce cookie limitations, advertising platforms like Facebook are shifting towards a server-side approach to allow for more robust data collection. This server-side data collection approach aims to enhance your conversion reporting despite browser restrictions. If you are not familiar, Facebook launched its own version of the server-side pixel called Conversions API aka CAPI.

According to Facebook, the Conversions API allows advertisers to send web events directly to their servers. These events will then be processed just like browser pixel events allowing them to be used in measurement, reporting, and optimization.

Apart from initiating web events through your client-side Google Tag Management platform using the browser pixel, this Conversions API will live on a server you manage with the help of Server-side GTM and send the same events to your Facebook account. This allows you to go around browser restrictions such as ad blocking and cookies. While it may seem redundant to have client-side and server-side tagging for the same events, you will send an event ID with both the client-side and server-side to de-dupe the same events.

While this might already sound like the best approach given the heavy browser restrictions, it is not without its challenges and Google-imposed limitations to overcome. In this blog post, we are going to see what challenges you may face while doing Facebook conversions API-specific events setup and how to solve the Google Tag limitations.

Perquisites you will need:

  1. GTM Client container – To send the events data from client(web) GTM to server GTM.
  2. GTM Server container – To get the server URL and to do server-side Facebook Conversions API configuration.

Requirement:

To track only a few e-commerce events from server-side META conversion API.

The Challenge:

The common mistake people make is using the existing Google Tag that deploys GA4 client-side, for deploying 3rd party pixels in GTM server-side.

Today if you are using only one Google Tag (Previously GA4 configuration tag) for both GA4 (client-side) and META Conversion API (server-side), you will face below impediments:

  • Pageviews and all other events data in GA4 will stop tracking as Google Tag only supports either client-side or server-side setups in the same tag. You cannot have both working at the same time through a single Google tag.
  • If you do add both Client-side and Server-side configurations for GA4 in the same Google Tag, the server setup will take precedence and GTM will not send client-side events to GA4 until you add a GA4 tag on the server container as well.
  • Which would then force you to make the entire GA4 tracking server side. It’s a wrong assumption that the client-side GA4 tracking would still work alongside just configuring the Google Tag for sending server-side events to Facebook CAPI.

Facebook Server-Side Conversion API events tracking with newly introduced Google-Tag Complications

Alternates:

  • 1st alternate is to use 2 Google tags separately one for Client side GA4 Tracking and one for Server-Side tracking with Dummy Measurement ID.
  • 2nd alternative is to use the GA4 event tag and send the page_view event on the “All Pages” Trigger which is not the recommended way to set up the GA4 page_view event.
  • 3rd alternative is to migrate GA4 completely server-side before deploying any 3rd party tag in sGTM using the Google Tag.
  • 4th alternative is to not use the Google Tag for sending data to the sGTM container. This is the solution we recommend.

Our Solution:

Since the server-side setup didn’t work out with the Google page_view tag simultaneously, we used the Stape data tag and data client to send the data from the web container to the server container.

But we have to send only a few events based on dataLayer and not all events. So, let’s dive into how we did that:

  1. Select the Stape data tag from the Web- GTM tag templates gallery and set your server URL which you got from your Server container.
    Facebook Server-Side Conversion API events tracking with newly introduced Google-Tag Complicationshover-icon
  2. Create a trigger with the below conditions to ensure the data call from web-GTM to server-GTM should only be sent on specific events to avoid sending all events data if not required.
    • In trigger configuration, select a custom event.
    • In the event name, use regex matching with the value “.*”. This makes sure it looks for all events which you will apply in the next steps.
    • In the trigger condition, select {{event}} variable and add all events that you need to send to server-gtm separated by “|” pipe.

    Facebook Server-Side Conversion API events tracking with newly introduced Google-Tag Complicationshover-icon

  3. Download the Stape Data Client from here – https://github.com/stape-io/data-client. Go to your Server Container and add the “template.tpl” file that you downloaded from GitHub.
    Facebook Server-Side Conversion API events tracking with newly introduced Google-Tag Complicationshover-icon
    Facebook Server-Side Conversion API events tracking with newly introduced Google-Tag Complicationshover-icon
  4. Once you added the Stape data client template. Add the Facebook Conversion API tag template by Stape from the Server GTM tag template gallery.
    Facebook Server-Side Conversion API events tracking with newly introduced Google-Tag Complicationshover-icon
  5. Now add a Facebook Conversions API tag and add your access token and Facebook pixel ID which is unique to your Facebook Business Manager account.
    Facebook Server-Side Conversion API events tracking with newly introduced Google-Tag Complicationshover-icon
  6. The final step is to create a custom event trigger like below. use regex matching with value “.*”. This makes sure it looks for all events that are coming from the web container. The Stape data tag from the Web container will make sure the tag fires only on the specific events data that is being sent to the server container.
    Facebook Server-Side Conversion API events tracking with newly introduced Google-Tag Complicationshover-icon
  7. To debug the server events in GTM preview mode, set both the Web and Server containers in preview mode to see whether the Stape data server calls and your Facebook conversion API tags are firing.
    Facebook Server-Side Conversion API events tracking with newly introduced Google-Tag Complicationshover-icon

If you followed all the steps outlined in this blog post, then your META CAPI should be set up without any issues. If you enjoyed this blog post, then you can read more from our Digital Analytics practice here.

Ashish RajKumar Chainani

Ashish Rajkumar Chainani is a Senior Consultant on our Digital Analytics team. He has expertise with both Adobe Analytics and Google Analytics and also Frameworks such as Vue.js, React, Angular.

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Start typing and press Enter to search