signalq to pass your consent platform’s current decision to Signals and send business events. The examples below use the full advertising-consent path; eligible global policy has a separate legitimate-interest boundary. With a connected Meta dataset, one browser track call supplies the managed Pixel and server event with a shared ID.
Before you begin
- Install the generated Signals pixel once and keep its
initcall before consent and event calls. - Choose a consent source: a supported external signal, an explicit CMP adapter, or the configured Plainrouter fallback card. Verify the actual advertising choices on every page and after changes.
- Connect Meta if you want managed Meta delivery.
- Choose whether the browser, your backend, or Stripe owns each purchase. Follow Avoid duplicate Meta events before combining integrations.
undefined. It does not return the later command’s result. Run examples that read an event ID, identification result, or visitor ID only after the generated script’s load event; register that handler before the script can finish loading. Do not install a second snippet to wait for it.
How does the snippet choose a consent source?
The current v4 snippet sends its arrival first, then uses a queued explicitsignalq("consent", …) decision when present. Otherwise it checks supported TCF and Consent Mode signals during a 1.5-second detection window. A detected supported CMP without a usable decision suppresses the fallback; it does not grant consent. Keep the explicit adapter below when your CMP needs one.
If no external source takes precedence, the snippet can restore the saved Plainrouter choice or display the enabled fallback consent card. Accept all, Reject all, and Customize record different decisions. In the current card, Analytics controls analytics_storage; Marketing controls ad_storage, ad_user_data and ad_personalization. The consent-based advertising path requires all three advertising grants. Selecting only Analytics does not grant Marketing. Previously saved v1 choices keep their original meaning rather than being reinterpreted as new choices.
A later valid external decision dismisses the fallback. The pr_consent cookie stores the Plainrouter choice; it is separate from visitor measurement identifiers. To reopen the card from your own preferences control, use:
Set consent
Connectsignalq to your consent-management platform. Send the current advertising consent state after initialization and whenever the visitor changes it.
granted, denied, or unknown. Missing or unrecognized permissions remain unknown; Plainrouter never upgrades them to a grant.
You can provide one or more supported consent adapters:
When you provide more than one adapter, their derived permission states must agree.
On the consent-based path, conversion events, visitor-cookie access, identity transmission and managed Meta delivery require all three permissions to be
granted. Granting ad_storage alone is insufficient. The identity-free arrival sent once at document initialization is a separate request and does not wait for these permissions. See What happens on initialization.
A complete grant creates or refreshes the first-party identifiers used for session joins and eligible destination delivery. Leaving full consent stops event transmission and clears the current page’s consent-dependent identifiers. Explicit storage denial or withdrawal also discards the in-memory landing context. Send the latest structured state whenever the visitor’s choice changes.
On a returning page, the arrival is sent while your consent platform restores its decision. Plainrouter does not read visitor cookies or send conversion events during that undecided period. Existing cookies are not read or refreshed merely because the snippet initialized.
Connect Cookiebot callbacks
Install Cookiebot on the same page. This adapter uses Cookiebot’s consent properties and browser events. Use it only when your configured marketing choice covers all three Plainrouter advertising permissions. For separate choices, map each permission individually with the structured snapshot above. Place this code once after your generatedinit call. It handles an already-restored choice and later CMP events. Automatic or implied consent stays unknown; only an explicit response can grant permissions.
captured_at records when this adapter reads the current decision. Retain your CMP’s consent record separately. Do not replay purchases from these callbacks: restored consent and multiple CMP events can call the adapter more than once.
For a custom withdrawal button, notify Signals immediately as well as withdrawing in Cookiebot. Attach this function to your site’s existing consent-withdrawal control:
Verify grant, partial consent, and withdrawal
Use a development or test site and inspect its Network panel. Test the installed library, not just the pre-load queue. Include grant → denial while configuration is delayed, and grant → transmitted event → denial on an initialized page. After restoring network access, confirm the earlier grant does not resume event transmission. A successful arrival is a separate initialization check and can appear in every row below.
For a CMP with separate permissions, exercise a partial choice through its UI and confirm the transmitted snapshot preserves it. Do not replace partial choices with the Cookiebot adapter’s shared marketing value.
If the result differs, confirm
init ran first, inspect the actual three permission values, and check for conflicting adapters. Use Verify ingestion to separate a collection problem from consent gating; use Meta delivery checks for destination acceptance.
How landing click IDs are handled
The snippet captures supported landing query parameters in the current document’s memory:fbclid, gclid, gbraid, wbraid, ttclid, and msclkid. Unknown or partial consent keeps this temporary buffer available for a later complete grant. Explicit storage denial or withdrawal discards it.
Click IDs are sent with eligible events only after full consent. They never enter the identity-free arrival payload. The browser no longer reads or writes the legacy pr_click_ids value; it expires that cookie when full consent opens and when an active grant is withdrawn. A new document starts with its own landing context.
The Meta _fbc and _fbp cookies are separate from this retired click-ID map and remain subject to full consent. At event intake, Plainrouter drops invalid or unsupported click-ID entries individually while retaining valid entries. Do not rely on one malformed value to reject an otherwise valid event.
Track an event
Calltrack with an event name and an optional payload:
null when full consent is absent, consent changes stop the request, or collection is not accepted after the permitted attempts. Invalid calls, such as a missing event name or a call before init, can reject the promise.
The public track command generates its own event ID. An event_id in the payload or an extra positional argument does not override it. order_id is purchase data, not the deduplication key.
Send monetary
value as a decimal string, such as "49.00". This avoids floating-point ambiguity.Standard event names
Common names are normalized to Meta’s standard spelling. For example,page_view becomes PageView and initiate_checkout becomes InitiateCheckout.
Frequently used standard events include:
PageViewViewContentSearchAddToCartAddToWishlistInitiateCheckoutAddPaymentInfoPurchaseLeadCompleteRegistrationContactScheduleSubscribe
Payload fields
These convenience fields move into the event’s value data automatically:
You can also provide a
value_data object directly. Other custom fields remain on the event and are available to supported destinations.
Identify a consenting visitor
Callidentify only after your consent policy permits advertising identity use:
external_id for an app user; it is not an email/phone field and is sent as supplied over the collection transport.
If consent is withdrawn while identify waits for browser configuration, the call resolves to false and does not resume after a later grant. Obtain current consent and make a new call only when that new identity use is permitted. The same superseding denial cancels a held track call with null.
- Email is trimmed and lowercased.
- International phone numbers must start with
+and include 8–15 digits after normalization. - Finnish local numbers require
defaultPhoneRegion: "FI"in the initialization configuration. - Identification returns
falseon an insecure page where browser cryptography is unavailable.
How do I identify an app user in the browser?
After the installed script has loaded and your current policy permits identity use, identify at signup or login with the same stable internal user ID used by your Stripe association:How do I subscribe to the canonical visitor join key?
For a custom first-party integration, an authorized workspace manager can enable Connections → Visitor join key and choose Save visitor join key. This optional setting is disabled by default. Register a callback before the existing event that will carry the grant:visitor_id, the original full-grant captured_at and a local revision, or null on re-init, denial, withdrawal or other loss of eligibility. Keep its state temporary, clear downstream copies on null and handle repeated notifications idempotently. Registration itself sends no request; subscribing after an event waits for the next existing event response, with no cached-key replay.
Release requires the workspace opt-in, an identity-serving first-party transport and full grants for all three purposes. Legitimate interest alone, partial consent, GPC or the shared identity-free tier cannot release a key. Collector enqueue acknowledgement is not proof that downstream core persistence or an order join completed.
The loaded API returns an unsubscribe function; the boot queue does not return that handle. Clear your own copies before unsubscribing. This generic callback does not install a Shopify bridge or configure order webhooks.
Read the visitor ID
getVisitorId returns the current page-local UUID after consent permits it, or null while pending or denied. It is not the collector’s canonical visitor join key; use the opt-in join-key callback when that distinction matters.
Verify Stripe Checkout settlement
Stripe verified revenue records settled Checkout Sessions and eligible paid subscription renewals. Revenue verification and advertising delivery are separate: an eligible global-policy record can use already-retained customer context, while strict-EU, opted-out or unmatched records do not establish an attributed advertising conversion.metadata.visitor_id alone is not proof of a join or Meta acceptance. For your own consented event flow, use the managed browser purchase or backend recipe.
What do I need before connecting Stripe?
You need an active Signals workspace, current team update permission for Connections, and permission to configure webhook endpoints for the Stripe account that receives your customers’ payments. Your application must already create Checkout Sessions and handle order fulfillment. This connection is separate from paying for Plainrouter. The supported settlement flow uses Checkout Session events. Eligibleinvoice.paid renewals use paid, positive-value subscription_cycle invoices under a global workspace and effective global policy. A first paid invoice after a captured trial has a separate eligibility path; this does not establish support for every Stripe payment flow or invoice. Stripe’s fulfillment guide explains delayed payments and why returning to a success URL does not prove payment.
Configure the webhook
- Open Connections → Stripe.
- Copy the workspace’s Webhook endpoint and add it as an endpoint in the intended Stripe account.
- Use Stripe snapshot events and subscribe to the required list shown in Plainrouter:
checkout.session.completed,checkout.session.async_payment_succeeded,invoice.paid,customer.subscription.created,customer.subscription.updated,customer.subscription.deleted,refund.created,refund.updated,refund.failed,customer.createdandcustomer.updated. You can also keepcheckout.session.async_payment_failedfor failure notifications. Stripe’s webhook guide explains event formats and endpoint setup. - Copy that endpoint’s signing secret into Endpoint signing secret in Plainrouter and choose Save secret. This is the webhook signing secret, not your Stripe API key.
- Confirm the Stripe card shows
connected. That status confirms a signing secret is configured; verify a settled payment separately below.
Associate a Checkout Session with your order
Setmetadata.order_id to your application’s non-personal order ID when creating the Session on your server. Use the same order ID as your browser purchase if both sources report that order. Plainrouter trims this value and uses it as the purchase’s order ID; without it, the Checkout Session ID is the fallback. client_reference_id does not select Plainrouter’s order ID. Keep order IDs within 128 characters so they remain readable.
This request calls Stripe directly, not the Plainrouter SDK. It creates a hosted, one-time Checkout Session. Set the variables from trusted server configuration and an existing order: select the Stripe Price on your server and persist one idempotency key for that checkout attempt. Reuse the key only when retrying the same request. Keep the Stripe secret key server-side.
id alongside your order and redirect the customer to its url. See Stripe’s Create a Checkout Session reference for the complete request. Session creation and the success-page redirect are not payment verification.
How do I associate Stripe customers with app users?
Use your application’s stable internal user ID consistently across server events and Stripe. This lets Plainrouter record a workspace-scoped customer-to-user association when an eligible signed webhook contains both identifiers. Use an opaque ID that is never reassigned and is distinct from an order ID or browser visitor ID. Use the same exact value throughout; do not substitute an email address.- Send the signup through your server-event integration with that ID in
user_data.external_id, preserving the real consent and event fields. The browserexternal_idcommand can use the same stable app-user ID when policy permits; neither call proves a Stripe association by itself. - When creating Checkout on your server, set
client_reference_idto the same ID. The signed event must also identify a Stripe Customer. For one-time Checkout that would not otherwise create a Customer, use Stripe’s supportedcustomerorcustomer_creationoption. - If you create Stripe Customers directly, set Customer
metadata.user_idto the same ID and subscribe your workspace endpoint tocustomer.createdandcustomer.updated. A signed subscription snapshot can also supplymetadata.user_id. Plainrouter uses metadata present in the webhook; it does not fetch missing nested Customer or Subscription data. - Inspect the signed webhook in Stripe: check the workspace endpoint, Customer ID and selected app-user field. Then verify the retained purchase or lifecycle event separately. HTTP
200alone does not prove a user association, paid revenue or advertising attribution.
client_reference_id first, then Session metadata.user_id, then available nested Customer and Subscription metadata.user_id. For a Customer event it reads Customer metadata.user_id; for a subscription event it reads Subscription metadata before available nested Customer metadata. Use one consistent ID so these sources cannot disagree.
Add these fields to your server-side Checkout creation request when using an existing Customer. These are Stripe fields, separate from the Plainrouter event body:
metadata.order_id for order reconciliation; client_reference_id does not replace it. See Stripe’s Checkout Session fields and metadata propagation rules. Missing Customer data or app-user metadata cannot establish the association. An existing conflicting association is not silently reassigned, and opt-out, erasure and policy boundaries still apply. This setup does not guarantee a browser join, Meta acceptance or attribution.
How do I verify SaaS setup without creating a paid conversion?
For a managed-hostname (Path A) workspace, callget_install_instructions with the authorized workspace. Same-origin forwarding workspaces use their separate serving setup; this tool does not return Path B material. Follow saas_steps and read saas_verification; these are stored-evidence reads, not commands to create a customer, payment or advertising event.
Inspect each fact’s
status, value and reason. observed, not_observed, test_only and unavailable are distinct. The recent webhook evidence uses the last 24 hours within retention; an ignored webhook, replay or metadata-only update may not leave a new receipt. Missing evidence can also mean erasure or expiry, not faulty setup. Consent receipts are reported separately; neither setup readiness nor missing receipts requires inventing a grant.
Collection evidence can say browser_snippet or server_only. Keep that distinction: a server observation is not proof that the browser snippet loaded. The installation recipe can still report pending_release for its optional browser-identify step; that field does not prove which browser asset your site loaded. Current released v4 supports the app-user identify call above. The server-event path remains available independently; neither path makes a server observation proof of a browser load.
Ask your assistant to read the returned state and signal quality, then name the missing evidence and next owner. The workspace owner completes DNS, Stripe secret entry and Meta connection in the app. A setup time estimate is not a deadline for real traffic, billing or live provider acceptance.
What do StartTrial and Subscribe delivery mean?
Eligible signed Stripetrial_started events map to Meta StartTrial without monetary value. An eligible subscribed event maps to Meta Subscribe only after verified first-positive-invoice evidence supplies its value and currency. A status change alone does not prove a paid subscription. Stripe lifecycle delivery uses action_source: "system_generated", not a browser visit, and does not borrow a webhook request’s IP or user agent as customer browser context. Current delivery uses retained, permitted identity context and remains subject to consent, policy, opt-out, destination and freshness checks.
Subscription renewals are not another Meta Subscribe, and invoice purchase rows are not sent to Meta as an extra Purchase. upgraded and churned remain recorded lifecycle facts rather than new Meta delivery promises. Signal quality explicitly labels trial/subscribed Google rows as not sent by design; this does not enable Google delivery.
Use the returned event ID and delivery trace. Do not construct subscription lifecycle event IDs from Stripe IDs: current IDs are workspace-keyed and legacy IDs remain compatibility details. A webhook acknowledgement or recorded lifecycle event is separate from provider acceptance and attribution.
Is the restricted Stripe revenue key the webhook signing secret?
No. Connections → Stripe → Stripe revenue accepts a restricted read-only Stripe API key and displays its status, live/test mode, account binding and verification reason. The Stripe webhook card uses a different endpoint signing secret. Stripe distinguishes restricted API keys from webhook signing secrets. Keep both in their intended app fields and out of MCP prompts, chat, source control and logs. Saving a revenue key can fail if the account or mode does not match retained signed webhook evidence; a different account or mode requires the app’s Signals reset flow. Review the data-removal consequences before resetting. If a key or signing-secret update reports Stripe credentials are busy. Please try again shortly., retry the same intended update later; that message does not mean the new credential was saved.Read current subscription revenue
A team administrator can open Connections → Stripe → Stripe revenue and save a restricted Stripe API key (rk_live_… or rk_test_…). Grant Subscriptions: Read and Accounts: Read, with all other permissions: None. The API key is separate from the webhook signing secret. Check the key’s live/test mode, account binding and verification status.
Current subscriptions shows its snapshot timestamp, per-currency monthly recurring revenue (MRR), active customers, trials, past-due subscriptions and unknown amounts. Known active and past-due recurring amounts contribute to MRR; trials do not. Supported recurring intervals and quantities are normalized to a monthly amount. Metered, tiered, incomplete or otherwise unsupported amounts remain unknown. Keep currencies separate and inspect the unknown count before treating the total as complete.
Signed subscription webhooks keep the retained snapshot current. A snapshot is not historical revenue, acquisition attribution, a backfilled conversion or proof of Meta delivery.
Is Stripe history import available to every workspace?
The former history-import workflow has been removed. Saving a restricted key supports the current subscription snapshot; it does not import historical attributed conversions. Continue using signed webhooks for supported settlement and lifecycle events.How do I verify a settled purchase?
Inspect the endpoint’s delivery in Stripe for a known Checkout Session, then compare the order and amount with Signals. Plainrouter records revenue only when the settlement event haspayment_status exactly paid.
An illustrative paid-webhook response is:
event_id to find the retained record through GET event. For this revenue flow, the check is the purchase record and value, not a Meta accepted delivery. A 404 can mean the wrong workspace or that the record is outside read retention.
Duplicate paid notifications for the same Session reuse one purchase record and return duplicate: true. The first recorded purchase uses its settlement-confirming webhook’s time. An older duplicate can return duplicate: true without an event_id; do not create another purchase to force a receipt or recover expired payload data. Supported refund notifications record an idempotent negative revenue adjustment. Plainrouter first tries the saved PaymentIntent-to-purchase link in this workspace, then available order metadata and charge references. Purchase lineage is attached only when a matching purchase exists; an unmatched refund does not establish a browser or advertising attribution link. Do not assume Stripe copies Session metadata onto refund objects; see Stripe metadata propagation.
How are subscriptions and trial conversions recorded?
Subscribe to all threecustomer.subscription.* events in the setup list so Plainrouter can keep the signed subscription state current. Eligible signed snapshots can record these lifecycle events:
Recovery from
past_due to active is not a new subscription activation. Setting cancel_at_period_end alone is not churn. A plan name change, discount, unmatched currency or uncomputable previous price does not by itself establish an upgrade. Plainrouter does not fetch missing historical prices to invent the comparison.
Lifecycle events do not add purchase revenue. Verify paid amounts through Checkout settlement or invoice.paid separately. Repeated webhook deliveries must not create another lifecycle conversion; keep the original Stripe event ID when redelivering through Stripe. An ignored or duplicate response is not proof of a new event, and old delivery cannot restore erased identity or expired history. See the webhook contract and Stripe subscription events for the inputs.
If a lifecycle event is missing, inspect the signed snapshot’s event type, current status and data.previous_attributes. For upgrades, compare the recurring items, currency and quantities; a larger invoice alone is insufficient. Then inspect the retained event and its destination trace. A lifecycle record is not proof of Meta acceptance or attribution.
For an eligible global-policy subscription Checkout Session with payment_status: "no_payment_required", Plainrouter can retain an available acquisition match for the trial without counting revenue. A later positive, paid invoice.paid for that same workspace, Stripe customer and subscription can use that retained match when recording the first paid conversion. This path can accept a first invoice that is not a subscription_cycle renewal. Missing matches, strict-EU policy, opt-out or erased identity do not establish advertising attribution; adding metadata.visitor_id cannot bypass those checks.
To verify using an existing trial and payment:
- In Stripe, confirm the workspace endpoint received the subscription snapshot and trial Checkout event. The unpaid trial must not appear as paid revenue.
- Find the later signed
invoice.paid. Confirm positiveamount_paid,paid: true,status: "paid", and the matching customer and subscription. - Use the webhook response’s
event_id, when supplied, to inspect the retained Signals record. Compare the paid amount and currency, then inspect acquisition and destination evidence separately. A200acknowledgement orsubscribedevent alone proves neither a purchase nor Meta acceptance.
How are renewals and refund status checked?
For an eligible renewal, inspect the signedinvoice.paid event: the invoice must be paid, have a positive amount, and use billing_reason: "subscription_cycle". The first paid trial conversion follows the separate checks above; arbitrary invoice events are not equivalent to renewals. A matched prior acquisition can supply retained attribution context; absence of that match does not imply an ad acquired the renewal.
Subscribe to all three refund events above. A succeeded refund can adjust verified revenue; pending, failed or canceled states must not be treated as settled refunds. The Refund status is unverified notice means only charge-summary fallback evidence has been observed. Follow its subscription guidance rather than assuming status is confirmed. Stripe’s refund statuses and events explain the provider side.
When a pending or action-required refund later fails or is canceled, it does not remain counted as a successful refund through an earlier charge summary. Other successful refunds on the same charge remain separate; repeated notifications must not subtract the same refund twice.
Revenue adjustments and downstream advertising delivery remain separate. Inspect the purchase/refund lineage and destination trace; a refund row or a connected Stripe card alone does not prove a platform correction.
Why is the Stripe purchase missing?
Stripe webhook redelivery and Plainrouter destination replay are different operations. Destination replay cannot create a missing Stripe revenue record.
Reliability behavior
- Event requests use browser
keepalivewhere available. - A granted event still in flight during
pagehideis also sent as a text beacon. - Conversion-event requests can receive at most one retry after network failures or retryable responses, within the request’s retry budget. Arrival requests are never retried.
- Landing click IDs stay in document memory and are transmitted only with a complete consent grant; the legacy
pr_click_idscookie is no longer used for storage. - First-party browser identifiers can still have shorter lifetimes when a browser applies its own storage restrictions.
Avoid duplicate Meta events
After you connect Meta, continue to track throughsignalq. The managed browser Pixel and Plainrouter server delivery share one event ID.
Choose one purchase owner before adding a confirmation-page event:
Send one managed purchase after payment confirmation
Use this recipe when the browser owns the purchase. Your application must first confirm payment on its server and supply the paid order’s non-personal string ID, decimal total, currency, and item count. A success URL alone is not proof of payment. Run this code after the Signals script loads and your CMP has reported the full grant. The map shares one attempt between repeated callbacks for the same order in the current document:track in an automatic retry loop: an uncertain response can follow an accepted request, and a new call creates a new ID.
The managed flow sends the browser Purchase with Pixel eventID and submits the matching server Purchase with event_id. You do not need an additional fbq or backend purchase call. Passing the returned ID to another API request does not enrich the already-accepted event.
Check the purchase pair
- Confirm the order was paid and the CMP reported all three grants before tracking.
- Inspect the conversion request’s
event_id,event_name, and value data. Internal retries should retain the same ID. - Check the event’s destination delivery trace, then compare the browser and server names and IDs in the intended Meta dataset. Meta’s deduplication guide explains the matching fields.
- If duplicates remain, inventory confirmation-page handlers, tag-manager tags, theme Pixels, commerce plugins, Stripe webhooks, and backend jobs. Remove overlapping senders after validating the intended flow.
Check a payload before sending it
Use the local checks alongside the relevant troubleshooting guide:- Missing or duplicate Meta events: inspect a synthetic native Meta payload. This checker expects Meta’s
dataenvelope, not a PlainrouterPOST /eventsbody. - Event-ID deduplication: compare browser/server event names and IDs.
- Browser identifiers: inspect
_fbpand_fbcformatting.