Meta Pixel (CAPI) & TikTok Events API 2.0 — RUTHH COD Form & Upsells
Goal and Expected Result
Section titled “Goal and Expected Result”Configure Settings → Pixels (/app/settings/pixels) for Meta Pixel + Conversions API (CAPI) and TikTok Pixel + Events API 2.0 so Cash on Delivery funnel events and completed purchases are tracked across both browser and server with deterministic event_id deduplication.
Preconditions
Section titled “Preconditions”- You have your Meta Pixel ID (and optional Conversions API Access Token from Meta Events Manager) or TikTok Pixel ID (and optional TikTok Events API 2.0 Access Token).
- The app’s native Shopify Web Pixel extension is connected during app installation/pixel setup.
Numbered Instructions
Section titled “Numbered Instructions”1. Configure Meta Pixel & Server-Side Conversions API (CAPI)
Section titled “1. Configure Meta Pixel & Server-Side Conversions API (CAPI)”- In Shopify Admin, navigate to Settings → Pixels (
/app/settings/pixels). - Click Add Pixel and select Meta (Facebook & Instagram).
- Enter your numeric Meta Pixel ID.
- To enable server-side Conversions API (CAPI) dispatch alongside browser tracking:
- Paste your Conversions API Access Token (stored encrypted at rest on the server; never exposed to storefront JavaScript).
- Optionally enter a Test Event Code (for example,
TEST12345) while verifying events in Meta Events Manager’s Test Events tab.
- Select which funnel events to dispatch (
InitiateCheckouton form open,AddPaymentInfoon form submit, andPurchaseon verified COD order creation) and click Save.
2. Configure TikTok Pixel & Server-Side Events API 2.0
Section titled “2. Configure TikTok Pixel & Server-Side Events API 2.0”- In Settings → Pixels (
/app/settings/pixels), click Add Pixel and select TikTok. - Enter your TikTok Pixel ID.
- Optionally paste your TikTok Events API 2.0 Access Token and Test Event Code for server-side event delivery.
- Click Save in the SaveBar.
3. How Browser + Server Deduplication Works
Section titled “3. How Browser + Server Deduplication Works”- When a buyer opens the COD form, submits details, or completes a COD order, the app generates a deterministic
event_idtied to the order intent / funnel correlation token. - Browser Path: The storefront emits custom analytics events (
cod:form_open,cod:form_submit,cod:order_created) consumed by the native Shopify Web Pixel sandbox, which forwards the event andevent_idto Meta/TikTok when marketing consent is granted. - Server Path: When
orderCreateordraftOrderCreatesucceeds on the server, the server CAPI dispatcher normalizes and SHA-256 hashes buyer identifiers (phone, email, country, client IP/user-agent when consented) and sends thePurchaseevent with the exact sameevent_idto Meta Graph API and TikTok Events API 2.0. - Meta and TikTok automatically deduplicate matching
event_idpairs within their deduplication window.
Warnings and Edge Cases
Section titled “Warnings and Edge Cases”- Customer Privacy & Consent: Both the Shopify Web Pixel extension and server-side dispatchers honor Shopify Customer Privacy consent signals. If a buyer opts out of marketing/analytics tracking in a consent-gated region, pixel dispatch is suppressed.
Troubleshooting Steps
Section titled “Troubleshooting Steps”Purchaseevent appears in Server CAPI but not Browser Pixel: Check if the buyer used an ad blocker or closed the tab immediately as the order succeeded. This is the exact scenario Server CAPI is designed to recover.- Duplicate
Purchaseevents in Meta Events Manager: Verify that you do not have a second third-party pixel app firing a syntheticPurchaseevent with a differentevent_idon the same custom thank-you URL.