How to Set Up Facebook Conversion API Using Zapier with Code for Accurate Meta Ads Tracking

If you are running Meta (Facebook) ads, tracking accuracy is everything. Without clean, reliable data, you cannot scale confidently or optimise effectively. That is why Facebook’s Conversion API (CAPI) has become an essential tool for advertisers who want to get the most out of their campaigns.

In this guide, we are going to walk you through how to set up Facebook Conversion API using Zapier with code. This method is ideal if you are using Unbounce, JotForm, or any form tool that integrates with Zapier. You will learn how to:

  • Capture important data from your form submissions

  • Hash personal details into the SHA-256 format that Facebook requires

  • Send conversion data directly to Meta using an API request

  • Ensure your tracking matches actual conversions

We are currently spending upwards of $2,000 per day on Meta ads and have our Zapier setup pushing conversions to Meta in real time. This tutorial is the exact process we use.

Why Set Up Facebook CAPI?

The Facebook Conversion API lets you send events directly from your server to Meta’s servers, bypassing potential tracking issues caused by browser limitations, ad blockers, or iOS privacy updates. When used alongside the Meta Pixel, you get more accurate tracking and a clearer picture of your campaign performance.

By setting up CAPI with Zapier, you can automate the process and feed Meta the exact data it needs, in the right format, every single time a lead converts.

Step 1: Prepare Your Form Page

In this tutorial, we are using Unbounce as the form platform. If you are using JotForm, Leetook, or any other form builder, the process is similar.

First, add a small piece of JavaScript code to your form page to capture the User Agent. This identifies the browser and device of the user. Here is what to do:

  1. Open your form page.

  2. Add the GetUserAgent script before the closing body tag.

  3. Create a hidden field in your form named user_agent.

  4. The script will automatically populate this field when someone lands on the page.

This ensures that when the form is submitted, the User Agent value is passed along to Zapier and eventually to Facebook CAPI.

Step 2: Test Your Form Submission with a Facebook Click ID

Before building your Zap, it is important to test with a Facebook Click ID (FBC) so you can verify tracking later.

  1. Go to one of your active Meta ads.

  2. Click on the ad and copy the URL.

  3. Append ?fbclid=XXXX to the end, replacing XXXX with the click ID you copied.

  4. Submit your form using this link to ensure the click ID and other parameters are captured.

Step 3: Build Your Zap in Zapier

  • Trigger Step – In Zapier, select your form tool as the trigger app. For Unbounce, choose “New Form Submission.”

  • Connect your account and select the correct form.

  • Run a test to pull in a sample submission. You should see the User Agent, Click ID, and any other hidden fields you have set up.

Step 4: Hash Personal Data with JavaScript

Facebook requires certain personal data (email, first name, last name) to be SHA-256 hashed before sending. This keeps the data private and compliant.

  1. Add a “Run JavaScript” action in Zapier (Code by Zapier).

  2. In the input data fields, map:

    • first_name → First Name from your form

    • last_name → Last Name from your form

    • email → Email from your form

  3. Paste in your JavaScript hashing code.

  4. Test the step and confirm you see the hashed values and a Unix epoch timestamp (required by Facebook CAPI).

Step 5: Send Data to Facebook via Webhook

Now it is time to send your data to Meta.

  1. Add a “Webhooks by Zapier” action.

  2. Set the method to POST.

  3. In the URL field, paste your Facebook Conversion API endpoint along with your Pixel ID.

  4. Add your Access Token:

    • Go to Facebook Business Manager > Events Manager.

    • Select your Pixel.

    • Under “Settings,” find the Conversions API section and generate an access token.

    • Paste it into your Zap.

Step 6: Map All Required Facebook Parameters

You will need to map the following:

  • event_time → Unix timestamp from JavaScript step (no quotes)

  • event_source_url → The page URL (either hard-coded or from the form)

  • user_agent → From the hidden field you created

  • client_ip_address → Captured from the form or via additional script

  • fbc → Facebook Click ID from form data

  • fbp → Facebook Browser ID from form data

  • email, first_name, last_name → From your hashed JavaScript step

Optional fields you can add:

  • currency – For example, GBP or USD

  • value – Monetary value of the conversion

  • content_name, content_category, content_ids – For categorising events

Step 7: Test Your Setup

Before going live:

  1. Go to Test Events in Events Manager.

  2. Copy your Test Event Code.

  3. Add it to your webhook request body in Zapier.

  4. Send a test and confirm the event appears in Events Manager.

  5. Once confirmed, remove the test code from your Zap.

Step 8: Publish Your Zap

Once you have verified everything works, publish your Zap. Your Facebook Conversion API is now connected via Zapier and will automatically send events every time a form is submitted.

Why This Method Works

By combining your form platform, Zapier, and a little JavaScript, you are able to:

  • Avoid browser tracking issues that hurt your data quality

  • Send events directly to Meta’s servers in the exact format they require

  • Maintain privacy compliance with hashed personal data

  • Customise and expand your tracking to include more parameters as needed

For lead generation advertisers, this method is particularly powerful. You can track exactly which ad clicks lead to form submissions, even if the user’s browser blocks cookies or JavaScript.

Final Tips

  • Always run CAPI alongside the Meta Pixel for event deduplication.

  • Regularly test your setup to make sure no parameters are missing.

  • Consider building additional Zaps for other conversion events in your funnel.

If you found this tutorial helpful, you will love The Instant AI Agency. How small agencies use AI & SMS to run lead-reactivation campaigns and keep a performance-share of the revenue…

With your CAPI properly set up, you are ready to run highly optimised Meta ads with confidence that your data is accurate.

Recent posts

Learn the AI-Powered Lead Reactivation System for Marketing Agencies, Without Ads, Funnels, Sales Bros, Or SEO

A repeatable campaign framework used by agencies in the Brick & Mortar, Finance, E-Comm, B2B & Info-Product niches. No tech background required.

Can't Find What You're Looking For? Search Our Posts!

Search

How small agencies use AI & SMS to run lead-reactivation campaigns and keep a performance-share of the revenue…

How small agencies use AI & SMS to run lead-reactivation campaigns and keep a performance-share of the revenue…

I Wrote A Book...

How small agencies use AI & SMS to run lead-reactivation campaigns and keep a performance-share of the revenue…

How small agencies use AI & SMS to run lead-reactivation campaigns and keep a performance-share of the revenue…