Tracking Script (zbp.js)
How to install the tracking script to capture browser data and improve the quality of events sent to Meta and Google Ads.
What is the Tracking Script?#
zbp.js is a lightweight script (~2KB) that you install on your client's website to automatically capture browser data that drastically improves the quality of events sent to Meta and Google Ads.
Each team receives a unique script with its identifier embedded (similar to the Meta Pixel). The tracking code is automatically generated on the Optimize Campaigns page.
Important: Zero Bad Leads only sends conversion events to Meta/Google when the lead reaches the minimum score defined in the integration's dispatch filters. This means ad platforms only receive signals from qualified leads, training the algorithm to find people with a profile similar to your best leads.
Without the script#
When a lead arrives via webhook, Zero Bad Leads sends only personal data (email, phone, name) to ad platforms. This results in:
- Meta CAPI: Event Match Quality (EMQ) of ~3-5/10
- Google Ads: match rate of ~30-50%
With the script#
zbp.js captures browser data that platforms need for precise matching:
- Meta CAPI: EMQ rises to ~7-9/10, with perfect deduplication with the Pixel
- Google Ads: match rate rises to ~90%+
The script is optional — your integrations work normally without it. zbp.js only improves the quality of sent data, resulting in better campaign optimization and lower cost per lead.
What does the script capture?#
| Data | Description | Impact |
|---|---|---|
| _fbp | Meta Pixel cookie (browser identifier) | Deduplication and match with Meta |
| _fbc | Facebook Click ID (from ad clicks) | Meta conversion attribution |
| gclid | Google Click ID (from Google ad clicks) | Google Ads conversion match |
| UTMs | source, medium, campaign, term, content | Origin tracking |
| Page URL | Page where the lead converted | Context for Meta |
| User Agent | Browser and device | Additional Meta match |
The script does not make any external requests — it only reads browser data and injects it as hidden fields in the page's forms. The data is only sent when the visitor submits the form.
Install the script#
Copy the code
Go to Optimize Campaigns in the sidebar. In the Tracking Script section, copy your team's unique snippet:
<script src="https://app.zerobadleads.com/zbp.js" data-team="YOUR_TEAM_ID" defer></script>
Each team has a unique code. Always copy the snippet from the Optimize Campaigns page — do not manually change the data-team value.
Paste on the client's website
Add the script before the </head> tag in the site's HTML. See below for instructions for each platform.
Verify
After installing, submit a test lead through the website form. In the lead detail view in Zero Bad Leads, you will see the "zbp.js active" badge in the UTM parameters section, along with the captured data.
Installation by platform#
WordPress#
With a plugin (recommended):
- Install the free WPCode plugin (or Insert Headers and Footers)
- Go to WPCode > Header & Footer
- Paste the script in the Header section
- Save
Without a plugin (in the theme):
- Go to Appearance > Theme Editor
- Open the
header.phpfile - Paste the script before
</head> - Save
Webflow#
- Go to Project Settings > Custom Code
- In the Head Code section, paste the script
- Publish the site
Wix#
- Go to Settings > Custom Code
- Click Add Code
- Paste the script, select Head and All Pages
- Save
Unbounce#
- Open the landing page in the editor
- Go to Javascripts & Stylesheets
- Paste the script in the Head section
- Save and publish
Others#
For any platform that allows adding custom code to the site's <head>, simply paste the snippet. The script works with any native HTML form, including:
- Elementor Forms
- Contact Form 7
- WPForms
- Gravity Forms
- RD Station Forms
Forms in iframes#
Forms that run inside iframes (such as Typeform and JotForm) are not compatible with zbp.js, because the script cannot access content inside the iframe. In these cases, tracking data will not be captured.
How to know if it's working?#
- Submit a lead through the website form
- Open the lead in Zero Bad Leads
- In the UTM Parameters section, look for the green "zbp.js active" badge
- The captured data (Meta Browser ID, Google Click ID, etc.) will appear below the UTMs
Signal Quality#
Each event sent to Meta or Google Ads receives a signal quality score from 0 to 100, based on the matching data present in the lead. The more data available, the higher the match rate on the platforms.
Meta CAPI#
| Field | Points |
|---|---|
| 20 | |
| Phone | 15 |
| Client IP | 15 |
| Meta Browser ID (_fbp) | 15 |
| Meta Click ID (_fbc) | 10 |
| User Agent | 10 |
| Name | 5 |
| External ID | 5 |
| Page URL | 5 |
Google Ads ECL#
| Field | Points |
|---|---|
| 25 | |
| Phone | 25 |
| Google Click ID (gclid) | 30 |
| Name | 10 |
| Consent | 10 |
Important: Events for Meta and Google Ads are only sent when zbp.js is installed. Without the script, dispatch jobs for these platforms will be marked as "Skipped". Integrations with CRMs (HubSpot, Pipedrive, RD Station, etc.) continue to work normally, regardless of the script.
Privacy and security#
- The script does not send data to any server — it only injects hidden fields in forms
- It only reads existing first-party cookies (_fbp, _fbc from Meta Pixel)
- URL parameters (gclid, UTMs) are public browsing data
- Size: ~2KB (gzip ~1KB) — zero performance impact
- Not blocked by ad blockers (makes no network requests)
- Compatible with GDPR/LGPD when the site already has cookie consent for the Meta Pixel
Troubleshooting#
"zbp.js active" badge does not appear on the lead:
- Check that the script is in the site's
<head>(use "View Source" in the browser) - Confirm the form is not inside an iframe (Typeform, JotForm)
- The form builder needs to send all form fields in the webhook, including hidden fields
gclid is not being captured:
- The gclid only appears in the URL when the visitor clicks a Google Ads ad
- To test, add
?gclid=test123to the site URL and submit the form
_fbp is not being captured:
- The
_fbpcookie is created by the Meta Pixel. Check that the Meta Pixel is installed on the site - The visitor needs to have accepted cookies (if there is a cookie banner)
Related articles
Connect Meta Conversions API (CAPI)
How to set up the Meta Conversions API to send qualified lead events and optimize your ad campaigns.
Dispatch Filters
How to configure filters to send only the right leads to each outbound integration.
How to Connect HubSpot
Step-by-step guide to integrate HubSpot CRM with Zero Bad Leads and automatically send qualified leads.