Ad Pixels
Fire Meta, TikTok, Pinterest, X, Google Ads, Snapchat, GA4 and Google Tag Manager from a web funnel, with one event id shared by the browser and the server so each conversion is counted once.
A web funnel can load your ad and analytics pixels in the visitor's browser and send the same conversions from Rovenue's server. Both halves carry one event id per conversion, so a vendor that receives the event twice counts it once.
Pixels are set up once per project under Apps → Ad pixels, and a funnel can switch any of them off for itself (see Per-funnel tracking). Consent is covered on its own page: Pixel consent. When something does not fire, see Pixel troubleshooting.
Server sends are off by default. While PIXEL_SERVER_OWNER_ENABLED is
false (the default), the server never sends a funnel conversion as a funnel
event: purchases keep going out through the existing revenue path, and a
channel saved as Both fires in the browser only. The Ad pixels page and the
event matrix show such a channel as Browser with a * marker; the stored
value is kept, so turning the flag on restores it
(apps/api/src/lib/env.ts:597-603, apps/api/src/services/funnel/tracking-snapshot.ts:200-203).
See Turning on server sends.
Vendors
| Vendor | Id you paste | Format | Server channel | Consent category |
|---|---|---|---|---|
| Meta | Pixel ID | digits | Meta Conversions API | ads |
| TikTok | Pixel code | upper-case letters and digits | TikTok Events API | ads |
| Tag ID | digits | Pinterest Conversions API | ads | |
| X | Pixel ID | lower-case letters and digits | none in this version | ads |
| Google Ads | Conversion ID | AW- + digits | none | ads |
| Snapchat | Pixel ID | a 36-character UUID | Snapchat Conversions API | ads |
| GA4 | Measurement ID | G-… | none | analytics |
| Google Tag Manager | Container ID | GTM-… | none | ads |
The id formats are in packages/shared/src/pixels/vendors.ts:57-66, the server
vendors in vendors.ts:31-36 and the consent categories in
packages/shared/src/pixels/consent.ts:61-70. A project has at most one row
per vendor: adding a second answers 409 (apps/api/src/routes/dashboard/tracking-pixels.ts:460).
Setting up each vendor
Open Apps → Ad pixels, pick the vendor, paste its id, choose a channel per
event and save. Every save is audited and bumps the project's tracking
revision, which the funnel page and its security policy both follow
(tracking-pixels.ts:50-56).
- Meta. Paste the Pixel ID. For server sends, add the
Meta Conversions API connection first: a
server channel is refused until an enabled connection exists whose
pixel_idequals this Pixel ID (server_connection_missing,server_pixel_mismatch;tracking-pixels.ts:102-113,:282,:305). - TikTok. Paste the pixel code. Server sends need the
TikTok Events connection with the same
pixel_code. - Pinterest. Paste the tag ID. Server sends need a Pinterest
Conversions API connection (ad account id and conversion access token,
apps/api/src/services/integrations/providers/pinterest-capi.ts:60-64). The connection names an ad account, not a tag, so only its existence is checked (tracking-pixels.ts:104-107). - Snapchat. Paste the Snap Pixel ID. Server sends need a Snapchat
Conversions API connection (
pixel_idandaccess_token,apps/api/src/services/integrations/providers/snapchat-capi.ts:56-60) whose pixel id matches. - X. Paste the pixel id, then give each conversion the event id you
created in X Ads (
tw-<pixel>-<event>). X is browser-only in this version; an event without an id is not sent (tracking-pixels.ts:86-101,apps/dashboard/src/runner/pixels/pixel-runtime.ts:31-32). - Google Ads. Paste the conversion id (
AW-…), then give each conversion its conversion label. The browser sendssend_to: '<AW-id>/<label>'(apps/dashboard/src/runner/pixels/pixel-loader.ts:300). Browser-only. - GA4. Paste the measurement id. Browser-only, and gated by the
analyticscategory, notads. - Google Tag Manager. Paste the container id. GTM has no event matrix: the
container decides what fires. The runner pushes each canonical event to
dataLayerasrovenue_<event>withrovenue_event_id,valueandcurrency(pixel-loader.ts:242,:307-321), so your container's tags can read the same event id.
Google Tag Manager widens the page security policy
A GTM container can load any script, so a funnel page that runs one must allow
scripts and connections from any https: origin. Enabling a GTM row therefore
needs an explicit acknowledgement (gtmCspAck: true), recorded with who gave
it and when. Without it the save is refused with gtm_csp_ack_required, and
the table's CHECK constraint enforces the same rule
(tracking-pixels.ts:74-75, :353-369). Only add GTM if you control what the
container loads.
If GTM and the Meta pixel both run in a funnel, and the container also carries
a Meta tag, Meta receives every event twice under different ids and cannot
deduplicate them. The builder warns about this pair
(apps/dashboard/src/components/funnel-builder/tracking-section.tsx:96-101).
Advanced matching and sandbox
- Advanced matching sends the visitor's hashed email (and an external id
derived from the visitor) with browser conversions, normalised per vendor
and SHA-256 hashed in the browser (
pixel-runtime.ts:188-196). GTM never receives it. - Fire in sandbox. A sandbox session dry-runs every browser pixel (logged
dry_run) unless the row has Fire in sandbox on (pixel-runtime.ts:185). On the server, a sandbox conversion is skipped assandbox_without_test_codeunless the connection carries a test event code (apps/api/src/services/integrations/providers/pixel-conversion.ts:18-20,:138-140).
Canonical events
A funnel reports nine canonical events. Each vendor receives them under its
own names, taken from one table (packages/shared/src/pixels/vendors.ts:128-211);
a name both sides send is identical, which is what lets the vendor dedup.
| Event | When | Meta | TikTok | Snapchat | GA4 | |
|---|---|---|---|---|---|---|
page_view | each forward arrival at a page | PageView | ttq.page() | pagevisit | PAGE_VIEW | page_view |
funnel_started | the session starts | ViewContent | ViewContent | — | VIEW_CONTENT | funnel_start |
lead | the first email is captured | Lead | Lead | lead | SIGN_UP | generate_lead |
checkout_started | the first payment object is created | InitiateCheckout | InitiateCheckout | initiatecheckout (server initiate_checkout) | START_CHECKOUT | begin_checkout |
trial_started | the purchase started a free or paid trial | StartTrial | StartTrial | signup | START_TRIAL | start_trial |
purchase | the purchase charged | Purchase | Purchase | checkout | PURCHASE | purchase |
upsell_purchase | a one-click offer charged | Purchase | Purchase | checkout | PURCHASE | purchase |
funnel_completed | the completion screen (browser only) | FunnelCompleted (custom) | FunnelCompleted | — | — | funnel_complete |
app_claimed | the buyer claims the purchase in the app (server only) | CompleteRegistration | CompleteRegistration | — | — | — |
X and Google Ads take the operator's per-event id or label for every
conversion from funnel_started (X) or lead (Google Ads) through
upsell_purchase; X's base code is its page view
(vendors.ts:167-188). Pinterest's page view is page_visit on the server
side, but page_view is browser-only, so that server name is never used.
Two events exist on one side only: page_view and funnel_completed in the
browser, app_claimed on the server. The other channel is never offered for
them (packages/shared/src/pixels/events.ts:48-53).
A paid trial's intro charge fires trial_started with the intro's amount; its
conversion to a full price fires purchase from the revenue path
(events.ts:97-102).
Channels
Each event of each vendor has a channel: Off, Browser, Server or
Both (events.ts:39-46). The API refuses a channel the vendor or the event
cannot have: a server channel for a browser-only vendor (X, Google Ads, GA4,
GTM), a server channel for a browser-only event, a browser channel for
app_claimed, or a cell the vendor's table has no name for
(channel_not_offered, tracking-pixels.ts:57-66, :229-246).
- Browser — the runner loads the vendor's script and fires the event.
- Server — Rovenue sends the event from the server. Ad blockers and ITP cannot drop it.
- Both — both send it with the same event id; the vendor keeps one.
The server owner is decided once per purchase
A web funnel purchase is one conversion that two outbox rows describe: the
funnel event (funnel.session.paid) and its revenue twin. For each server
vendor the API decides once, under a row lock on the purchase, who sends
it: the funnel path (funnel) or the existing revenue path (revenue). Both
rows carry that one answer, so each vendor gets exactly one server send
(apps/api/src/services/funnel/purchase-pixel.ts:1-38).
The answer is funnel only when all of these hold: PIXEL_SERVER_OWNER_ENABLED
is on, the vendor's row is enabled with a Server or Both channel for the
event, an active connection of the vendor's provider exists, and the
session's consent allows the vendor's category (or the policy is
Not required). Anything else is revenue, which never suppresses the
revenue send. A later config, consent or flag change does not change a
decision already made (purchase-pixel.ts:18-30). Non-purchase events
(funnel_started, lead, checkout_started, app_claimed) are stamped the
same way at emission; for them revenue means no server send, because they
have no revenue twin (apps/api/src/services/funnel/pixel-stamp.ts:6-27).
When the answer is revenue, the revenue twin is still the conversion the
browser fired: it carries the decision's event and pixel event id, and Meta
and TikTok send it under that event's server name (Purchase, StartTrial)
and that id, so the vendor deduplicates the browser and server pair
(purchase-pixel.ts, twinRevenueMetadata; pixel-conversion.ts,
revenueTwinConversion). A free trial's twin is a $0 row; it is still sent to
Meta and TikTok as trial_started with value 0, never dropped as a zero-value
charge (apps/api/src/services/integrations-fanout/consumer.ts,
isTrialStartTwin).
Renewals, trial conversions and refunds of a funnel purchase always stay on
the revenue path under their own outbox id (purchase-pixel.ts:34-37). An upsell gets its own decision,
shared by its funnel.upsell.charged event and its revenue row
(apps/api/src/services/funnel/upsell-pixel.ts:1-50).
Event ids and deduplication
Every conversion has one id, computed the same way by the browser (WebCrypto)
and the API (node:crypto):
input = "rovenue-pixel/v1|" + sessionId + "|" + event + "|" + discriminator
eventId = base64url(SHA-256(UTF-8(input))).slice(0, 32)(packages/shared/src/pixels/event-id.ts:5-6, :18-24). The session id never
leaves Rovenue; vendors only see the 32-character hash.
The discriminator always comes from the server, so the browser cannot
invent a different one (events.ts:56-81):
| Event | Discriminator |
|---|---|
page_view | <pageId>:<arrival number> — forward arrivals only, never a back move |
funnel_started, lead, funnel_completed, app_claimed | 0 (once per session) |
checkout_started, trial_started, purchase | primary:<funnel purchase id> |
upsell_purchase | upsell:<upsell attempt id> |
The browser fires a purchase only after the server's confirm or purchased
response hands it the discriminator, including when the Stripe webhook already
completed the purchase. Reloads and back moves do not re-fire: the runner keeps
the set of fired ids per session in sessionStorage
(pixel-runtime.ts:23-24, :86).
The same id goes into each vendor's dedup field:
| Vendor | Browser field | Source |
|---|---|---|
| Meta | eventID | pixel-loader.ts:95 |
| TikTok | event_id | pixel-loader.ts:135 |
event_id (and order_id on purchases) | pixel-loader.ts:166 | |
| Snapchat | client_dedup_id (and transaction_id on PURCHASE) | pixel-loader.ts:196-198 |
| X | conversion_id | pixel-loader.ts:234 |
| Google Ads | transaction_id | pixel-loader.ts:300 |
| GA4 | transaction_id on purchases | pixel-loader.ts:281 |
| GTM | rovenue_event_id in dataLayer | pixel-loader.ts:318 |
On the server, each Conversions API body carries the same id in the vendor's
matching field (apps/api/src/services/integrations/providers/pixel-conversion.ts:1-11).
What the server sends with a conversion
- Meta and TikTok web conversions are sent as website events with the
funnel's page URL. Meta also needs the visitor's user agent. A funnel
conversion without a published page URL is skipped as
no_page_url; a Meta one without a user agent (erasure removed it) is skipped asno_user_agent. - A funnel session whose visitor has not granted
ads(under Required) sends no user data to any ad vendor: every server event of it — funnel conversions and the revenue path's purchase, renewal and refund rows alike — is skipped asno_ads_consent, before any body is built, so not even the hashed external id or the subscriber's email leaves. A web purchase is never sent to Meta under the connection'sappaction source (apps/api/src/services/integrations/providers/meta-capi.ts:245-267,:325-340;tiktok-events.ts:401,:470). - Email and phone are normalised per vendor before hashing. A phone number
without an explicit country code is dropped, never guessed; TikTok, X and
Google Ads get E.164 with
+, Meta, Pinterest and Snapchat digits only (packages/shared/src/pixels/normalize.ts:8-23). - The external id is the same for the browser and the server: the visitor id
the runner started the session with is stored whenever it is sent
(
apps/api/src/routes/public/funnels.ts:785).
Per-funnel tracking
The funnel builder's Settings → Tracking section lists the project's
enabled pixels and lets you switch any of them off for this funnel only. The
choice is stored as settings.tracking.excludeVendors; an empty list means
every project pixel (tracking-section.tsx:13-41).
An excluded vendor sends nothing for a session of that funnel, browser
or server: the runner does not load it, the owner stamp never names it
funnel, and every server event of the session that would reach it — the
revenue path's purchase, renewal and refund rows included — is skipped as
excluded_by_funnel. The list is read from the version the session was
served, so republishing with a different list does not change sessions
already started (apps/api/src/services/funnel/pixel-stamp.ts,
sessionExcludedVendors).
Session pixel log and health
- Session pixel log. A funnel session's detail drawer (funnel builder →
Sessions) lists, per vendor and event id, what the browser logged and what
the server delivered. A pair is matched when the browser fired it and
the server delivery of the same id succeeded: that is the pair the vendor
deduplicates (
apps/api/src/routes/dashboard/pixel-log.ts:20-33). - Health strip. The Ad pixels page shows, per vendor over the last 24
hours, browser outcomes (fired, script failed, consent denied, …) and server
deliveries by status, with the newest failure (
pixel-log.ts:34-37,:52).
The browser half comes from ClickHouse (funnel_pixel_events, kept 30 days,
packages/db/clickhouse/migrations/0048_funnel_pixel_events.sql:7, :35).
Without ClickHouse the server half still answers and the page says the
browser log is unavailable. The log never holds identity: no visitor id,
email, IP or user agent (apps/api/src/routes/public/funnel-pixels.ts:235-237).
The outcomes a browser row can have are fired, consent_denied,
channel_server_only, not_configured, script_failed, dry_run,
embedded_suppressed, duplicate_suppressed and csp_revision_mismatch
(events.ts:119-129); Pixel troubleshooting
explains each.
Page security policy
Every funnel page is served under one of three Content-Security-Policy
profiles, chosen per project from the same snapshot as the funnel config
(packages/shared/src/pixels/csp.ts:12-29, deploy/caddy/Caddyfile.dashboard:23-57):
- strict — no pixel host; the default and the fallback for any error, missing or unknown answer.
- pixels — strict plus exactly the vendor hosts in
PIXELS_CSP_HOSTS(csp.ts:31-63). - gtm — script, connect and frame open to
https:(needs the GTM acknowledgement).
Every profile allows 'wasm-unsafe-eval' (the runner compiles its funnel
engine to WebAssembly) and never 'unsafe-eval'. The page head carries
<meta name="rovenue-tracking" content="<revision>:<profile>">; when it does
not agree with the config the runner loaded, no pixel loads and every event is
logged csp_revision_mismatch (pixel-runtime.ts:13-15, :120).
Erasure, export and retention
- The visitor's IP address and user agent are stored only encrypted
(AES-256-GCM), only when the project has an enabled pixel with a Server
or Both channel, and only with
adsconsent under Required (at session start under Not required). They are purged 7 days after the session started; the ad cookies (_fbp,_fbc,_ttp,_epik,_scid,_ga) and the rest of the ad context 30 days after it ended (apps/api/src/services/funnel/ad-context.ts:6-19,packages/shared/src/pixels/events.ts:143-146,apps/api/src/workers/retention-sweep.ts:1429-1435). - A subscriber export includes their pixel sessions:
the decrypted IP and user agent, cookies, consent, server deliveries and the
browser pixel log — never ciphertext, hashes or credentials
(
apps/api/src/services/gdpr/export-subscriber.ts:150-154). - Erasure clears the encrypted IP/UA, ad cookies and consent snapshot,
unlinks the server deliveries from the session and removes the plaintext
user agent and IP hash. It also reaches unpaid lead sessions whose email
digest is the subject's (
apps/api/src/services/gdpr/anonymize-subscriber.ts:240-261).
Limits
- Web funnels only. The Tracking section is drawn for web funnels alone
(
apps/dashboard/src/components/funnel-builder/settings-tab.tsx:200). A native funnel has no browser to fire in. - Native funnels refuse
excludeVendors. Publishing a native funnel whose settings carry a non-emptysettings.tracking.excludeVendorsis refused withTRACKING_SETTINGS_NATIVE; converting a funnel from web to native dropssettings.tracking(apps/api/src/services/funnel/draft-judgement.ts,apps/api/src/services/funnel/document-migration.tswithTargetSettings). - X server sends are not in this version, though X's table already names
the same operator ids for a follow-up (
vendors.ts:119-126). - GA4 never deduplicates with a server send; it has none.
- Pinterest
trial_startedis sent assignupuntil a live probe proves the tag's lower-caseStartTrialcode (vendors.ts:160-161). - Six pixel hosts could not be confirmed from an official vendor page and are
allowed pending a live probe (
csp.ts:66-74).
Turning on server sends
Self-hosted deployments run a rolling, two-step switch:
- Deploy the release with
PIXEL_SERVER_OWNER_ENABLED=false. Every decision isrevenue, so behaviour is unchanged, and every API and worker learns to read the stamp. - Once every API and worker instance runs that release, set
PIXEL_SERVER_OWNER_ENABLED=trueand roll again (.env.example:441-446).
Before step 2, a project with Both on a purchase gets the browser event
plus the revenue path's server event; the revenue twin carries the browser's
event id and name, so Meta and TikTok deduplicate the pair. The UI still shows
such a channel as Browser, because only the revenue path sends.
Pinterest and Snapchat have no revenue path, so before step 2 they get no
server sends at all (pinterest-capi.ts:6-8, snapchat-capi.ts:6-7).
Self-hosting notes
ENCRYPTION_KEYis required to store the IP and user agent; without it they are not written at all (ad-context.ts:14-16), and server sends lack them.- ClickHouse is needed for the browser half of the pixel log and health strip.
- Visitor country. Google Consent Mode's regional defaults need a trusted
country. With
GEOIP_SOURCE=off(the default) every visitor's country is unknown, so Google tags default to denied everywhere. See the country lookup. - Caddy. The
pixelsandgtmprofiles indeploy/caddy/Caddyfile.dashboardmirrorPIXELS_CSP_HOSTS; never edit them by hand.pnpm caddy:csp-checkcompares the two, andpnpm caddy:csp-check --printprints them (Caddyfile.dashboard:41-47). A page-head API that is down serves the strict profile.
Webhooks
funnel.session.lead_captured and funnel.session.checkout_started reach
outbound webhooks like
every funnel event. funnel.session.paid still carries no amount; the money
and the pixel owner live in a non-public payload key that no webhook, chat
message or analytics view reads
(apps/api/src/lib/funnel-event-shape.ts:244-252).
Cancellation Funnels
A hosted manage-subscription page for web subscribers — the manage link, the email form, link scanners, pause / discount / free-period offers, cancel at period end, the confirmation and receipt mails, pauses and churn, events, webhooks and rollout.
Pixel Consent
The consent policy, the three categories (analytics, ads, experiments), the consent sheet, rv_consent links, the host bridge and Google Consent Mode v2 regional defaults for web funnel pixels.