Facebook conversion API for ClickFunnels using server GTM

Jul 22, 2022
Jul 19, 2022
Also available in

Landing page builders like ClickFunnels were created to allow users to see everything their customers do along the conversion funnel. Such tools provide detailed insights into how your customers interact and what works best for them along each stage of their journey until they finally purchase from you. 

ClickFunnels was created so their clients are never left guessing about which marketing campaigns or offers will bring users closer to a purchase. 

If you're advertising on Facebook or using any other source of paid traffic on ClickFunnels landers, tracking and reporting conversions during each stage of the funnel — down to dollars and cents—is a must-have to make your campaigns profitable and go the highest ROAS.

How can you ensure that Facebook receives enough data so its algorithms work better toward ad optimization? Well, this is not an easy task considering recent tracking restrictions. But what can definitely help to improve ClickFunnels tracking accuracy is server-side tracking. If we focus on FB, it's implementing Facebook conversion API.

In this article, I will show the stape team approach to setting up Facebook conversion API for ClickFunnels. 

ClickFunnels built-in Facebook conversion API integrationCopy link to this section

ClickFunnels offers a fantastic website builder, but I was surprised that it doesn't have a complete Facebook Conversion API built-in integration.

ClickFunnels Facebook CAPI integration does not offer all of the best practices that Facebook recommends. Here are some most essential drawbacks:

1. No event deduplication.Copy link to this section

FB documentation says deduplication is necessary if you share the same events from the browser and server. If redundant browser and server events aren’t deduplicated, you will see two conversions in your FB events and Ads manager, which leads to inaccurate reporting. 

In most cases, Facebook deduplication uses two parameters to identify redundant events: the event name (for example, PageView, Lead, Purchase, etc.) and the event ID. Events are considered redundant when web and server events have identical event names and event IDs. 

Two other parameters may be helpful for event deduplication fbp and/or External ID. 

The best and easiest way to ensure you've set up deduplication correctly is using the Facebook event testing tool. Test events should appear in the FB Test Events tool within 30 seconds when configured correctly. 

2. Low event match quality.Copy link to this section

With ClickFunnels native integration, the event match quality score you will get will be less than 5. The highest event match quality score you can get on Facebook is 10. So is 5 out of 10 good or bad? Well, it depends on the event. 

As you may have guessed from their name, an event match quality score measures how accurately FB matches events on your site to actual FB user profiles. Quality score depends on three main factors: the number of user parameters you send for every event (such as first name, last name, email, phone, etc.), the number of events that include user data, and the quality of the user parameters.

Say you report two events to Facebook: page view and purchase. When a user visits your site, there is little information about the user. It can be some technical data like the user's IP or browser. On the other side, when a user purchases on your site, most likely they add billing details like the first name, last name, email, city, etc. 

So having a match quality 5 on a page view event is good since no additional information can be sent unless the user is logged in or you use Firestore (or any other database) to enrich user data. At the same time, an event match quality of 5 might be considered low for a purchase event since you have additional user data that might be shared with FB.  

Facebook encourages sending as many user parameters as you have, such as first name, last name, email, country, etc. They say the more information you provide about users, the better. Curious why they ask so? It's all to get a better conversion attribution and quality audience, which might lead to a better ROAS and lower cost/conversion. 

Before sending any user's data to Facebook or any other third-party tool, ensure it complies with your companies privacy policy, terms of use, or any regulations in your country.

3. No server event customization.Copy link to this section

There is no way to control what events ClickFunnels send to FB servers and no way to customize server data. Let’s say you want to track button clicks, specific product views, or scrolls  - all these custom events are impossible to add to ClickFunnels' built-in FB CAPI integration. 

So, to sum up, with a native ClickFunnels integration, you might get events overreporting with lousy attribution. These may lead to an incorrect conversion attribution, low-quality retargeting audience, and a lookalike audience. 

There are several ways to improve FB conversion tracking on ClickFunnels. Stape approaches it by setting up Facebook conversion API using the server Google Tag Manager. In this article, I will describe how we do it. 

How to set up Facebook conversion API for ClickFunnels using server Google Tag ManagerCopy link to this section

Here are things you need to have before setting up Facebook conversion API for ClickFunnels:

  • Facebook pixel tracking using web Google Tag Manager.
  • Server Google Tag Manager container created and set up.

Let’s get started with setting up FB CAPI for ClickFunnels.

1. The first step would be to send data from web GTM to server GTM. We highly recommend using Data Tag since requests sent by Data tag are more resistant. Open a web GTM container and add a Data Tag from the Template Gallery. If you decide to use GA4 for sending data from the web to sGTM, I suggest adding Data Tag to your web GTM templates anyway because later, we will use it to store user data. 

2. I will set up page_view and lead events using FB CAPI in this example. To make FB CAPI work correctly, I need to send user data and event ID for these two events. Adding an event ID is a simple step. We will start with this one. I will use the Stape Unique event ID variable template for web GTM. 

Add a unique event ID variable template to your web GTM container -> Create a unique event ID variable and add it to your FB pixel tags. In my case, I’m using custom HTML for setting up FB pixel events because I need to use trackSingle to send event data to one FB pixel. In this case, adding an event ID should look like the screenshot below.

Facebook event ID custom HTML

If you use the FB tag template, scroll to more settings and add the event ID variable to the corresponding field. 

Facebook event ID Facebook tag web GTM

3. This step will show how I extract user data from ClickFunnels. User data helps FB match users on your site to FB profiles. I need three things to extract user data:

  • JS variable that scrapes user data from the page.
  • Data Tag that stores user data in cookies or local storage.
  • Data Variable that extracts user data stored.

Create a Data Tag that triggers whenever a user submits a contact form. Data Tag stores users' data (first name, email, and phone number) in local storage and cookies when triggered. 

store user data in cookies
store user data in local storage

To scrape user data, I’ve used a custom JavaScript variable that returns each of the needed parameters. It looks like this:

function() {     if (document.querySelector('input[name = "email"]')) {         return document.querySelector('input[name = "email"]').value;     }     return ""; }

4. In the previous step, we successfully extracted user data from the site and stored it. The ability of Data Tag to store user data helps to add user data when they are not available on the site. For example, when there is a redirect after successful contact form submission. In this scenario, user data is available on one page but lead event triggers on another. 

To extract user data that was stored using Data Tag, I will use Data Variable that’s available in the web GTM template gallery. 

Create a data variable for every user parameter you’ve stored using a data tag. 

data variable

5. Now, let’s set up a Data Tag to send data from web GTM to server GTM. Create a new tag, select tag type Data Tag, add event name and set server GTM URL. In the event data, I will add the event_id we’ve set up in step #2. Inside the user data, I will add all user parameters that we’ve stored using Data Tag and extracted using Data Variable. 

data tag send lead data

6. For event deduplication to work correctly, you should use the same trigger for matching events sent by the Data tag and FB pixel tag. 

7. You may also want to add user parameters to the FB pixel tag. Why so? Because when FB sees two identical events from web and server, they remove the server event and keep only the web. If you send user data in the server event, these user parameters will also be removed. If no user parameters are added to the FB pixel tag, you will lose some additional information that might be helpful for FB algorithms. 

In my case, I’ve added user data to the custom HTML tag I use to send lead events to FB pixel. 

Facebook lead event custom html

8. Let’s finally move to the server GTM container and set up FB CAPI. I will use  Data Client to retrieve information sent to sGTM by Data Tag. Unfortunately, no Client templates are available in sGTM, so you’ll need to import Data Client from GitHub manually. Open this link and download the zip file from GitHub. Go to the Clients template section in sGTM -> Click new client -> Import Data Client.

stape data client

9. Open the Clients section and create a Data Client.

set up data client

10. Inside the sGTM container, add the FB CAPI tag template from Template Gallery. Create a new FB CAPI tag. Select the event name method -> Add FB pixel, FB access token, and FB test ID. I suggest enabling the checkbox Generate _fbp cookie if it does not exist. This will help with FB attribution -> Add event ID and user data. To extract user data, I will use the event data variable. This tag should trigger every lead event claimed by Data Client.

Facebook Conversion API tag
Facebook Conversion API trigger
event data sgtm

11. Set up a Facebook Conversion API tag for every event you want to track on the server side. Once done, open web and server GTM debuggers and the FB test tool and test the configuration. If everything is done correctly, you should see FB pixel triggered in web GTM, FB CAPI tags triggered in sGTM, and deduplicated events and event parameters in the event testing tool. 

12. After a couple of days, you should see something similar to what I show on a screenshot below in the FB events manager. Events are sent from both browser and server. The event has a decent quality score and no deduplication errors. 

Facebook conversion api clickfunels

Conclusion:Copy link to this section

Clickfunnels, by design, is a tool for people who spend money on paid advertising. Since the era of manual CPC bidding is going away, and we are highly reliant on machine learning algorithms that decide to whom they should show our ads and for what price, relevant conversion tracking is crucial for successful marketing campaigns. 

Since the rise of tracking restrictions, accurate conversion tracking is no longer possible with browser tracking only. Unfortunately, Clickfunnels' native FB CAPI solution does not give FB server-side tracking good accuracy. The best way to approach FB CAPI for ClickFunnels is to set it up manually using the server GTM container. 

I hope this article helped you to set up FB CAPI for your Clickfunnels landings. If you need help setting up ss tracking for your site, do not hesitate to contact us. 

Need help with setting up server-side tagging?

All it takes is a few simple questions. Click Get A Quote, fill-up the form, and we will send you a quote.

Get a Quote
Tagged with:Facebook

Relevant posts

Updated Oct 24, 2022

Sending Data From the Google Tag Manager Web Container to the Server Container

In this article, I want to show you how to use Data Tag. This custom tag sends parameters from the Google Tag Manager Web Container to the Server Container. When used together with the Data Client for the Google Tag Manager server container, it allows sending data layer variables, custom parameters, and other data from the web to the server container. As a result, Data Client retrieves information from the Data Tag into the Google Tag Manager Server Events.

Updated Feb 29, 2024

How to set up Facebook event deduplication in Google Tag Manager

Using Facebook server-side tracking (Facebook Conversions API) is getting more popular due to its ability to prevent tracking pixel blocking by ITPs and AdBlockers. Another massive benefit of Facebook conversion API is that it increases FB cookie lifetime. If you haven’t yet implemented FB Conversions API on your site, follow this guide. In this article, I will describe how to set up Facebook events deduplication if you are using both browser and server tracking methods for your site.

Updated Mar 21, 2024

How to set up Google Tag Manager Server Container

Collecting data about your website visitors is critical for analyzing and improving the online business presence, reaching users, and converting them into customers. However, collecting data is becoming more problematic because of Intelligent Tracking Prevention, AdBlockers, and a decrease in cookie lifetime. Google Analytics and other similar tools will start seeing fewer data about your website visitors and giving you less information to analyze.

Host your GTM server at Stape