Skip to main content
Rally can run and optimise paid ads on a connected Meta or TikTok ad account. Conversion ads need the platform’s own pixel on your site: it is what tells Meta or TikTok which clicks turned into signups and purchases, and what their optimisation learns from. This is separate from the Rally snippet: the snippet credits creators; the pixel trains the ad platform. Both run side by side. Set it up per ad account under Settings → Integrations → Ad accounts → Set up conversion tracking. The dialog gives you the fields below and a coding-agent prompt tailored to your stack.

1. Create the pixel and copy its id

In Events Manager → Connect data → Web, name the dataset, create it, choose Set up Meta Pixel → Add code yourself. The number in fbq('init', '…') of the base code Meta shows is the Dataset ID (Meta’s name for the Pixel ID since pixels became datasets). You can also find it under Datasets → the dataset → Settings. Paste it into Rally and pick the Purchase event Rally’s purchase-optimised ads should target (Purchase by default).

2. Install the base code

The base code goes on every page, in <head>. In Next.js or React, load it once in the root layout and fire the page event on every client-side route change.
An <img> is not valid inside <head>; if your build tooling rejects the <noscript> block there (Vite does), put it at the top of <body>.

3. Fire the two standard events

Fire each exactly once, when the thing happens. Never on page load of a generic page, on refresh, or for returning logged-in users: the ads optimise on these, so noise costs money.
Event names are case-sensitive standard events.
Fire the purchase event from the success page only if that page knows the amount and a payment reference to use as eventID; otherwise send it server-side only (next step), which is enough for Meta to optimise on.
Browser blockers drop a share of pixel events. Sending the same events from your backend with the same event_id recovers them; the platform deduplicates by id. Generate the token in the platform, store it as a server secret, and paste it into Rally’s dialog (Add to prompt) so the coding-agent prompt carries it.
Token: Events Manager → Datasets → the dataset → Settings → Conversions API → Generate access token. Store it as META_CAPI_TOKEN.POST https://graph.facebook.com/v19.0/<DATASET_ID>/events with the token in the Authorization header (never in a URL), sending the same event_name (Lead, Purchase), event_time, the same event_id as the browser event, action_source: "website", and hashed user_data (em, ph, client_ip_address, client_user_agent, the fbp and fbc cookies).

5. Verify from Rally

Open your site once (a page view), complete a test signup and, if you can, a test purchase. Then in Rally, Settings → Integrations → Ad accounts → the account → Conversion tracking → Verify. Rally reads back from the platform what arrived: The Meta Pixel Helper extension, and each platform’s Events Manager → Test events, show the same live.
Rally’s own click, signup and sale numbers do not depend on the pixel; they come from the tracking snippet and your lead and sale calls. The pixel only affects how well the platform can optimise the ads.