MadderHelp Request early access

Install Meta and Google tracking on WordPress

On WordPress, paste the snippet Madder gives you into a header plugin (or the official Meta plugin), fire Lead on your thank-you page, and clear the cache.

Checked 6 Sep 2026wordpress

On WordPress, paste the snippet Madder gives you into a header plugin or the official Meta plugin, fire Lead on your thank-you page, then clear the cache. About 15 minutes.

Madder already created the Meta pixel in your connected ad account and wrote the base code (step 2 of the tracking wizard). You only place it.

Before you start#

  • An Administrator login to WordPress (plugins need it).
  • The base code copied from Madder's wizard (Copy code).
  • Know which form plugin you use and where it lands people after a submission.

1. Choose plugin or theme header#

Paths as of September 2026. Two ways; pick one, never both.

Option A, a header plugin (recommended). Plugins → Add New Plugin, search "WPCode", Install Now, Activate. Then Code Snippets → Header & Footer, paste the snippet into the Header box, Save Changes. This survives theme updates.

Option B, the official plugin. Install "Meta pixel for WordPress". Open its settings page, click Get Started, and sign in; the connection flow lets you pick the existing pixel (use the ID from Madder's wizard, not a new one). It also turns on the Conversions API. Do not paste the snippet anywhere else afterwards.

Avoid editing header.php under Appearance → Theme File Editor (block themes: Tools → Theme File Editor): WordPress warns the editor keeps no backup and a theme update wipes the change.

2. Fire the Lead event#

Send people to a dedicated thank-you page after the form, then fire Lead only there:

  1. In your form plugin set the confirmation to redirect to /thank-you (Contact Form 7, WPForms, Gravity Forms and Ninja Forms all have a redirect confirmation).
  2. In WPCode go to Code Snippets → Add Snippet → Add Your Custom Code (New Snippet), type HTML Snippet, paste:
<script>fbq('track', 'Lead');</script>
  1. Under Insertion choose Auto Insert, location Site Wide Header, then in Smart Conditional Logic restrict to page URL contains /thank-you. Activate and Save Snippet.

If your form shows an inline success message instead, use the plugin's success event (Contact Form 7 emits wpcf7mailsent) to call fbq('track', 'Lead'); ask a developer if unsure.

3. The Google tag#

Paste the Google tag into the same WPCode Header box, below the Meta snippet. Which tag and which conversion action: Google tag and conversion tracking.

4. Clear the cache and verify#

  1. If you run WP Rocket, W3 Total Cache, LiteSpeed Cache, WP Super Cache or a host cache, purge it now; cached pages keep serving the old header.
  2. Install the Meta Pixel Helper Chrome extension (now listed as Meta Ads Data Advisor). Load any page: one pixel, status Active, your ID. Submit the form: Lead appears on the thank-you page.
  3. In Meta Events Manager: Data sources → your pixel → Test events, enter your URL, submit the form, confirm PageView and Lead.
  4. In Madder's wizard click I've installed it.

If it doesn't work#

  • Pixel Helper sees nothing — cache not purged, or you are logged in and the caching plugin serves admins uncached but the snippet is in a disabled snippet; check the snippet shows Active.
  • Two pixels, or PageView fires twice — snippet in both WPCode and the Meta plugin (or theme header). Keep one.
  • Lead fires on every page — the conditional logic is missing; restrict to the thank-you URL.
  • Lead fires but the pixel ID differs — the Meta plugin created a new pixel; reconnect using Madder's ID.
  • Cookie banner installed — the pixel loads only after consent; test after accepting.