Stape
SearchTry for free

Facebook Conversion API for WordPress sites

Ivanna Holubovska

Ivanna Holubovska

Author
Updated
May 27, 2025
Published
Mar 30, 2023
Also available in

If you run a WordPress site and advertise on Facebook or Instagram, you’ve probably seen data loss from browser restrictions or tracking blockers. That means Meta can’t always tell which campaigns actually drive sales or signups.

Meta Conversions API (CAPI) is a solution for that and it works best when you set it up server-side.

This guide shows how to install Meta CAPI on your WordPress site using server Google Tag Manager (sGTM) and WordPress plugin by Stape. You’ll learn how to collect more accurate event data, improve ad performance, and stay compliant with privacy rules without relying on cookies or pixels alone.

Why use Meta Conversions API on your WordPress site 

If you run Meta ads and use Pixel to measure results, you probably already see incomplete data. That’s because browser-based tracking can’t do the job right anymore. Browsers like Chrome, Safari, and Firefox limit cookies and use ad blockers to protect user privacy. Privacy updates like those in iOS 14 also keep a big part of user behaviors untracked. 

Basically, you risk paying for clicks or conversions Meta doesn’t see: someone clicks your ad and takes action on your site, but that action isn’t reported back to Meta because of the new browser features, so it looks like nothing happened.

To address this, Facebook launched the Conversions API. This technology brings back data accuracy by bypassing all new browser blockers and sending users’ data from a cloud server rather than from the user's browser. Unlike browser tracking, server-side tracking can include events that happen after the page loads or across sessions, and is not affected by user device settings.

This is how Meta Conversions API will help your business:

  1. With more accurate data, you will get better optimization. Meta uses conversion data to decide who to show your ads to. If the data is incomplete, Meta can't learn properly. CAPI gives the algorithm more information to work with.
  2. You’ll get better attribution. If someone clicks your ad but converts hours later or on another device, that second visit might look like a new, unrelated user, not someone who came from your ad if you use browser tracking. Meanwhile, with server tracking because the data is sent from a cloud server and includes things like user IDs and email hashes, CAPI helps Meta connect the dots. It knows the person who made the purchase is the same one who clicked the ad, even if they came back hours later or on a different device.
  3. It helps with privacy. You control what data is shared and don’t have to rely fully on third-party cookies, which makes it easier to comply with current and future privacy rules.

How to set up Meta Conversions API for WordPress

The most reliable way to track data for Facebook Ads from your WordPress site is to combine client-side tracking via GTM and server-side tracking via sGTM. This approach ensures better tracking accuracy.

1. Set up a server Google Tag Manager container and host it on Stape.

1. Go to https://tagmanager.google.com/ and log in to your Google Tag Manager account. Click on the "Admin" button, and under the "Containers" column, click the "+ Create Container" button.

Create container
Create container

2. Choose a name for your server container, select "server" as the type of container, and click the "Create" button.

Create server container in GTM
Create server container in GTM

3. Select the option to "Manually provision tagging server," and copy the container configuration that appears. Save this configuration in a text editor as you will need it later.

Manually provision tagging server
Manually provision tagging server

4. Log in to your account on our service or create a new account if you haven't already.

5. Once you're logged in, click on the "Create Container" button. Give your container a name, paste the Container Configuration that you copied from your Google Tag Manager Server Container, and select the server location. Click "Create Container."

Create container at Stape
Create container at Stape

6. Wait for around 5 minutes for the server container to deploy. Refresh the page to update the status. If the setup was done correctly, you should see the status "Running." If you see "Error," double-check that you've copied the correct container configuration. Contact support if the error persists.

7. In this step, you need to set up a tagging URL.

You have two options:

  • You can choose to use the tagging URL that was created for you and is hosted on our domain (stape.io)
Stape domain
Stape domain
  • Or use a custom domain. we highly recommend using this option because it will help to prevent tracking from being blocked and increase cookie lifetime.
Custom domain
Custom domain

If you choose to go with the first option, move to step 9.

If you want to configure a custom tagging URL, click “Add domain” under the Stape-provided tagging URL.

Then, log in to your domain registrar (like GoDaddy, Namecheap, etc.) and create a new CNAME record for the subdomain you want to use.

You can choose any subdomain (e.g., ss.yourdomain.com). Use the following settings:

  • Type: CNAME
  • Name: ss (or any other subdomain you want)
  • Target: ghs.stape.io
  • TTL: Auto
  • Proxy status: Disable (make sure it’s DNS only if you’re using Cloudflare)

Your CNAME record should look like this:

Type:    CNAME  

Name:    ss  

Target:  ghs.stape.io  

TTL:     Auto  

Proxy:   DNS only

Once the CNAME is saved and propagated, you can return to your Stape dashboard and finish the domain verification.

Example of DNS record
Example of DNS record

9. You can enable the Global CDN feature for the server container, which uses Cloudflare technology to load JavaScript files from a server closer to your site visitors. This can improve page speed and reduce latency.

!

Consider your country's privacy regulations before enabling this feature.

After enabling Global CDN, add a CNAME as instructed in your Stape account to complete the setup.

10. Add the tagging server URL to the Google Tag Manager Server container by going to "Admin," then "Settings," and selecting "Container Settings.”

2. Configure GTM server side plugin for WordPress

1. Log into your WordPress Admin, and go to the plugins. Then, click “Add New,” type “GTM Server-Side,” choose this plugin, and click install now. Once established, click Activate. 

WordPress plugin by Stape
WordPress plugin by Stape

2. Open the GTM server-side plugin you installed in the first step and paste the tagging URL inside the plugin settings. Next, select if you want to add web GTM to all site pages or just add plugin functionality without adding GTM script (this option should be used in case you are using any other plugin that inserts GTM script on the site). Next, add the WEB Google Tag Manager ID, tagging server URL, and Stape container identifier if you want to use a Custom Loader

Data tag
Data tag

3. If you have an eCommerce website and want to push ecommerce events and user data to the Data Layer, click on the second tab of the plugin and enable the two checkboxes. 

Push ecommerce events and user data to the Data Layer
Push ecommerce events and user data to the Data Layer

3. Set up Meta CAPI via server GTM using Data tag/Data Client

The most reliable way to implement Meta Conversions API for your WordPress website is by combining Data tag in web GTM with a Data Client in server GTM. This lets you track events on both the browser and server side and use event_id for deduplication.This setup lets you track events both in the browser and on the server side, and use event_id for deduplication.

1. Web container: send event data to the server and Meta

  • Create a Data tag to send event details like event_name, value, currency, item_id, and event_id to your server GTM container.

This tag should send event details like event_name, value, currency, item_id, and event_id to your server GTM container.

Important: in the tag’s settings, enter the GTM server-side URL. This is the custom subdomain you verified on Stape, such as:

https://ss.yourdomain.com

This URL sends event data from your web container to the server container.

  • Set up a Meta web tag to send the same event details (including event_id) directly to Meta from the browser.
  • Use variables to fetch each parameter from the Data Layer in both tags.
  • Make sure both the Data tag and the Facebook web tag have the same event_id and are triggered by the same custom event (for example, add_to_cart or purchase). This allows Meta to deduplicate events between the browser and server, ensuring accurate reporting.
  • Set up a custom event trigger for each event you want to track, and assign this trigger to both the Data tag and the Facebook web tag.

2. Server container: receive events and send to Facebook

- Install the Data Client in your server GTM container (from the Template Gallery).

- Create a trigger for the Data Client. The trigger name and event should match the custom event name used for the Data tag in your web container (for example, add_to_cart, purchase, etc.).

- Create a Meta Conversions API tag using:

  • Event Name (use the same name as in your web container, e.g., AddToCart);
  • API Access Token, Pixel ID, Test ID;
  • Event data variables (set up in server GTM using type: "Event Data");
  • event_id from the incoming Data tag (to support deduplication).

- Attach this tag to the Data Client trigger.

Verifying the setup is complete and correct

- Open both the web and server GTM preview modes.

- Trigger your test events (for example, add to cart) and check that all tags fire correctly:

  • The Data tag fires in the web container.
  • The Facebook (Meta) web tag fires in the web container.
  • The Data Client receives the request in the server container.
  • The Meta Conversions API tag fires in the server container, using the right parameters and event_id.

- Use the Meta Events Manager testing tool to confirm that both browser and server events are received correctly and that deduplication works as expected.

Events manager testing tool
Events manager testing tool

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

Facebook testing tool
Facebook testing tool

Wrapping up

Setting up Meta Conversions API on WordPress with server GTM may sound technical, but it’s one of the most reliable ways to improve how your Meta ads perform. 

With a precise server-side setup, your data stays accurate even when browsers limit tracking, helping Meta match conversions more reliably and show your ads to people who are more likely to convert. 

You’ll need a verified subdomain, the Stape plugin configured on WordPress, and specific tags, triggers, and variables set up in both your web and server containers in GTM.

When everything is done, you’ll be able to improve attribution and run campaigns based on what’s actually working.

author

Ivanna Holubovska

Author

Ivanna is a Lead Content Manager at Stape, a professional writer focused on creating high-quality content about server-side tracking to help businesses optimize their strategies and analytics.

Comments

Try Stape for all things server-sideright now!