Skip to main content
Cookbook Marketing PixelYourSite

Track Leads from a Thank-You Page with PixelYourSite and AI

A PixelYourSite custom event that sends Lead to Meta and generate_lead to Google when someone reaches your thank-you page.

Difficulty Beginner
Time ~10 min

Prerequisites

A site connected to WPVibe running PixelYourSite 11.4.4 or newer (tested on the free 11.4.4) on WordPress 6.9 or newer, with an administrator account. In PixelYourSite, open MCP and turn on Allow other MCP servers to use PixelYourSite tools; until then the AI sees only one PixelYourSite tool, or the tools refuse. Once on, PixelYourSite shows it as Critical because it opens these tools to any WordPress user with PixelYourSite access. Read-only mode in PixelYourSite, MCP must be off, or every change is refused. A Meta pixel or a Google Analytics ID set up in PixelYourSite, and a thank-you page your form sends people to.

The prompt
My site uses PixelYourSite. When someone reaches [thank-you page URL], send a Lead event to Meta and a generate_lead event to Google Analytics.

1. Run pixelyoursite/mcp-access-info. If external_access_enabled is false, tell me to open PixelYourSite, then MCP, and turn on Allow other MCP servers to use PixelYourSite tools, and stop.
2. Run pixelyoursite/get-platform-pixels and tell me which of Meta (facebook) and Google Analytics have a pixel ID and are enabled. Only set up platforms that do.
3. Run get_page_html for the page with selector #pys-js-extra. If staticEvents already has a custom_event entry (it carries a custom_event_post_id) that sends Lead or generate_lead, an event already fires there: tell me its id and ask what to do before going on. Then run pixelyoursite/get-custom-events; if feature_enabled is false, no custom event fires anywhere, so tell me and ask before going on.
4. Call pixelyoursite/set-custom-event without event_id (that creates the event) with title Lead: [page name], enabled true, platforms facebook with enabled true and event_type Lead, and google_analytics with enabled true and event_type generate_lead (only the ones from step 2), and one trigger: op add, type page_visit, rules with rule contains and the page's address path with slashes on both ends, like /thank-you/, delay 0. Contains matches any address with that text in it, so first run run_wp_cli post list --post_type=any --post_status=publish --fields=ID,post_name,post_type --posts_per_page=1000 (fetch more pages if it says results were truncated) and check that no other slug contains the page's slug; if one does, or the page sits under a parent page, tell me and use the longer path. The preview does not show the trigger's address, so tell me the rule and value you are sending. Every PixelYourSite change takes two calls. The first, without confirm, saves nothing and returns pending_changes and a confirmation_id: show me the changes and any notes in plain words and wait for my yes. If a note says a platform is disabled, add enabled true for it and preview again before asking me. If a note says the custom events feature is off, tell me and do not turn it on: that would switch on every custom event on the site. Only after my yes send the same arguments again with confirm true and that confirmation_id (it lasts 10 minutes; if it has expired, preview again). Pass a one-sentence mcp_note each time. If the answer is Read-only mode is enabled, tell me to turn off read-only mode in PixelYourSite, MCP, and stop.
5. Run get_page_html for the page with selector #pys-js-extra and confirm Lead appears under staticEvents facebook and generate_lead under staticEvents ga. If you use a page cache, it may need clearing first. Tell me the event_id and what fires where.
Already connected?

Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:

Run the “Track Leads from a Thank-You Page with PixelYourSite and AI” recipe from the WPVibe cookbook on my connected site.

A contact form or quote request that ends on a thank-you page is your conversion, but unless something tells Meta and Google when someone reaches that page, your ads cannot learn which clicks turned into leads.

The AI first checks the page for a PixelYourSite event that already sends a lead, so it does not make a second one, then sets up an event that fires Lead to Meta and generate_lead to Google Analytics when a visitor lands on the page you name. PixelYourSite shows a preview and saves nothing until you say yes. Afterwards the AI reads the page as a visitor sees it and confirms the events are there.

The free PixelYourSite allows one trigger per custom event, here a page whose address contains the text you give, so use text only that page has. Anyone who reaches the page counts, so keep it out of menus and search results. Check the first real leads in Meta Events Manager and Google Analytics.

Outcome

An active custom event that fires on your thank-you page, confirmed in the page's source.