How the flow works
For each conversion you want to track:- Load the browser pixel for the ad platform.
- Capture attribution IDs from the landing URL and cookies.
- Build the event parameters and item payload.
- Generate one event ID for Meta or TikTok.
- Fire the browser pixel event with that event ID.
- Send the same event to Scalev’s Storefront API analytics endpoint.
/v3/stores/{store_id} and X-Scalev-Storefront-Api-Key. Do not send a custom domain or page ID to identify the store.
204 No Content after accepting the event for asynchronous delivery.
Configure browser pixels
The server relay does not replace browser pixels. You still need browser pixels for attribution, optimization, and Meta/TikTok deduplication. Use the same pixel IDs that are configured in Scalev Storefront analytics. Pixel IDs are public identifiers, so you can place them in frontend config:Allow your storefront domain in Meta
Meta uses Traffic permissions in Events Manager to control which domains can send events through a Meta pixel. If a Meta allow list is active and your storefront domain is not on it, Meta blocks events from that domain. The pixel can still fire in the browser, and Scalev can still accept the server relay request, but the events will not be recorded by Meta. Set this up before you run ads or validate production events.- Open Meta Events Manager.
- Select the pixel or dataset used by the store’s Storefront analytics settings.
- Open Settings.
- In Traffic permissions, create or manage the allow list.
- Add the production storefront domain that shoppers visit, such as
shop.example.comorexample.com. - Confirm the change, then test a real storefront event in Meta Test events.
example.com, Meta includes its subdomains, such as shop.example.com. If you do not want every subdomain accepted, add the exact subdomains separately.
Keep staging, preview, and localhost domains out of a production pixel allow list unless those events should be accepted by the production dataset. When you send server events through Scalev, keep event_source_url on the same storefront domain you allowed in Meta.
See Meta’s docs for managing pixel traffic permissions and traffic permissions best practices.
Capture attribution IDs
Capture ad click IDs as soon as the app boots. The hosted Scalev storefront stores these values:| Source | Query parameter | Cookie | Used by |
|---|---|---|---|
| Meta click ID | fbclid | _fbc | Meta Conversions API |
| Meta browser ID | Generated when missing | _fbp | Meta Conversions API |
| TikTok click ID | ttclid | _ttclid | TikTok Events API |
| TikTok browser ID | Set by TikTok pixel | _ttp | TikTok Events API |
| SnackVideo click ID | click_id | _kwai_click_id | SnackVideo Events API |
captureAdAttribution() before you fire page, product, cart, checkout, or order events.
Choose events
Fire events after the shopper action succeeds. Do not fire conversion events before the API action they represent has completed.| Storefront moment | Fire after | Meta event | TikTok event | SnackVideo event |
|---|---|---|---|---|
| Product or bundle detail is visible | The detail API response renders | ViewContent | ViewContent | Your configured content-view event |
| Item is added to cart | POST /public/cart/items succeeds | AddToCart | AddToCart | Your configured add-to-cart event |
| Checkout starts | The checkout page or form opens with item context | InitiateCheckout | InitiateCheckout | Your configured checkout event |
| Buyer chooses a payment method | The payment selector is opened or a method is selected | Optional configured event | Optional configured event | Optional configured event |
| Order is created | POST /public/checkout or POST /customers/me/checkout succeeds | Purchase or configured submit event | CompletePayment or configured submit event | Your configured purchase event |
| Payment success page is shown | Only if you did not already fire the order conversion | Purchase | CompletePayment | Your configured purchase event |
CompletePayment.
For SnackVideo, use the exact event names configured for the store. The Storefront API forwards the event name you send.
Build item payloads
Scalev analytics payloads use item unique IDs, not the numeric IDs used by checkout item input. For product variants:1. For a checkout or purchase event, send every item in the checkout.
Build event parameters
Send provider-friendly commerce parameters with each event. For Meta, common parameters are:content_id when you can. The hosted storefront derives it from the product, bundle, or page context when the event payload does not include it.
Deduplicate Meta and TikTok events
Meta and TikTok deduplicate by event ID. Generate one event ID for one shopper action, then reuse it in both places:- Meta browser pixel:
eventID - Meta Storefront API payload:
events[].event_id - TikTok browser pixel:
event_id - TikTok Storefront API payload:
events[].event_id
event_id. For SnackVideo, use click_id for attribution and make sure your frontend does not fire the same conversion twice.
Send a Meta event
fn, ln, em, ph, ct, st, country, external_id, location_id, fbc, and fbp. Scalev fills client_ip_address and client_user_agent from the observed API request, so you do not need to send them from the browser.
Send a TikTok event
email, phone, external_id, ttclid, and ttp. Scalev fills ip from the observed API request and defaults user_agent from the request when you omit it.
Send a SnackVideo event
click_id. If the shopper did not arrive with click_id, still fire the browser pixel event when configured, but skip the server event.
Example: add to cart
Fire this afterPOST /public/cart/items succeeds:
Example: checkout conversion
Fire the purchase conversion after checkout succeeds, unless your ad strategy only counts paid orders.Payload reference
Meta request:Production checklist
- Load browser pixels once per page session.
- Capture
fbclid,ttclid, andclick_idbefore firing events. - Preserve
_fbp,_fbc,_ttp,_ttclid, and_kwai_click_id. - Add the production storefront domain to the Meta pixel traffic allow list before validating Meta events.
- Fire events only after the represented API action succeeds.
- Use one event ID for the browser and server copy of each Meta or TikTok event.
- Use deterministic order event IDs for purchase events.
- Send
event_source_urlandreferrer_urlso Scalev can choose checkout or home storefront analytics configuration. - Send
variantsorbundle_price_optionswith item unique IDs and quantities. - Skip SnackVideo server events when there is no
click_id. - Do not block checkout completion if the analytics request fails. Log it and let the buyer continue.

