← Run 20261118-071408-e3affd04
Shopify to Meta ads conversion tracking implementation
task shopify-meta-capiNov 18, 2026Models on marketing tasks Model only

Answers & verdicts

GPT-6.1 Sol high effort

Task failed
Task the exact prompt the model was given — assignment and source material
Cedar & Coil sells the Arc Clip Lamp on Shopify and is preparing Meta ads. Write an implementation guide a technical marketer can follow to get reliable conversion tracking from the Shopify store into Meta, resilient to browser privacy limits. Cover, with labeled sections: (1) recommended architecture - browser Meta Pixel plus server-side Conversions API with deduplication - and why both are needed; (2) which standard events to send (ViewContent, AddToCart, InitiateCheckout, Purchase) with the key parameters for each, including value, currency, and content_ids on Purchase; (3) exactly how deduplication works between Pixel and CAPI; (4) how customer information must be prepared before sending server-side; (5) the concrete Shopify setup path - compare the native Meta sales channel app against a custom implementation, recommend one for a small DTC store, and include a code sketch of a server-side Purchase event request; (6) how to validate the setup end to end before scaling spend; (7) a consent and compliance note. Do not promise specific attribution recovery percentages. --- ## Supplied source: product-marketing.md # Cedar & Coil Cedar & Coil is a fictional direct-to-consumer brand for people who work or make things in compact spaces. Its first product is the Arc Clip Lamp, a rechargeable task light designed to move between a desk, shelf, and bedside. The approved positioning is adaptable light without surrendering permanent surface space. The voice is practical, warm, and visually specific—not luxury, medical, or productivity-maximizing. All campaign work must remain draft-only. Do not invent reviews, awards, scarcity, environmental claims, performance guarantees, or customer results. --- ## Supplied source: facts.md # Authoritative synthetic facts - Product: Arc Clip Lamp. - Price: $68. - Included: lamp, padded clamp, USB-C charging cable, and storage sleeve. - Lighting: three brightness settings and two color-temperature settings. - Battery statement allowed: up to eight hours on the lowest brightness. - Clamp opening: surfaces up to 2.25 inches thick. - Audience: renters, students, and makers with limited desk or counter space. - Approved CTA: Explore the Arc Clip Lamp. - No campaign has launched and no performance data exists.
✗ Attempt 1
Answer · attempt 1 the model's full response$0.24 · 179.0s · 7.4k tok
# Cedar & Coil: Shopify → Meta conversion tracking guide **Status: draft implementation plan.** Keep campaigns draft-only. Cedar & Coil has no campaign performance data; the tests below establish tracking readiness, not advertising results. ## 1. Recommended architecture: Pixel + Conversions API Use **one coordinated integration** to send events to the same Meta Pixel/dataset: ```text Shopify storefront and checkout ├─ Browser Meta Pixel ───────────────────────┐ └─ Shopify/server events → Conversions API ──┤ ▼ Same Meta Pixel/dataset Deduplicate overlapping events ``` - **Meta Pixel** captures browser interactions and browser-side identifiers. - **Conversions API (CAPI)** sends events from Shopify’s servers or your backend. A genuine server-generated Purchase does not require the customer’s browser to deliver the conversion request. - **Deduplication** prevents the browser and server copies of one action from becoming two conversions. Meta recommends this redundant architecture. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) For this small DTC store, I recommend the **native Facebook & Instagram by Meta sales channel**, with a privacy-approved sharing level that includes CAPI. Treat **server-side Purchase as the minimum resilience requirement**. Shopify explicitly documents CAPI Purchase delivery under Enhanced and Maximum sharing. Do not assume every funnel event is also server-delivered: audit the actual connection methods in Events Manager. A custom endpoint that merely forwards browser events still depends on those browser events reaching it. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) ## 2. Event specification Use Meta’s exact, case-sensitive standard event names. The following is the proposed measurement contract; confirm the native integration’s payloads against it. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | Meta event | Trigger | Key parameters | |---|---|---| | **ViewContent** | Arc Clip Lamp product detail viewed | `content_ids`, `content_type: "product"`, optional `content_name`, numeric `value` for the viewed variant, `currency` | | **AddToCart** | Product successfully added—not merely a button click | `content_ids`, `content_type`, `contents` with item ID, quantity and unit price; `value` for the quantity added; `currency` | | **InitiateCheckout** | Checkout actually begins | Checkout `content_ids`, `contents`, `content_type`, checkout `value`, `currency`, `num_items` | | **Purchase** | Confirmed completed purchase—not checkout start or payment-button click | **`value`, `currency`, `content_ids`**; also `content_type`, `contents`, and optionally `order_id` | Meta defines `contents` as an array of item objects, including `id`, `quantity` and optionally `item_price`. Use ISO currency codes such as `"USD"` and numbers such as `68.00`, not `"$68"`. Purchase requires value and currency; include `content_ids` in Cedar & Coil’s contract for product-level reporting and catalog matching. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) **Product IDs:** Inspect the actual item IDs in Cedar & Coil’s Meta catalog. Use those exact strings in `content_ids` and `contents[].id` across events. Do not assume a Shopify product ID, variant ID, SKU, and channel-generated catalog ID are interchangeable. Select `content_type` consistently with the catalog’s product versus product-group structure. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/custom-data)) **Revenue policy:** Use the actual checkout/order amount after discounts, with a documented tax, shipping and duties basis. Mirror the same amount and currency in both Purchase copies. Shopify’s native integration uses its order-total convention; document the observed payload rather than layering on a different calculation. A single lamp’s merchandise price is $68, but its final Purchase value need not be $68. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) For every server event, provide: - `event_name` - `event_time`: actual occurrence time, Unix **seconds** - `event_id` - `action_source: "website"` - `event_source_url`: actual customer-facing event URL - `user_data`, including the original browser user agent for website events - `custom_data`: the business parameters above. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 3. Exactly how deduplication works For the **same customer action**, send: 1. To the **same Pixel/dataset ID**. 2. The same exact event name—for example, `Purchase`. 3. The same exact event identifier: - Pixel: **`eventID`**, in the fourth `fbq` argument. - CAPI: **`event_id`**, at the event’s top level. 4. Both copies promptly. Meta documents a **48-hour matching window** for corresponding events. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) Browser example for a **custom implementation**: ```js fbq("track", "Purchase", { value: purchase.value, currency: purchase.currency, content_ids: purchase.contentIds, content_type: "product" }, { eventID: purchase.eventId }); ``` The server must send `event_name: "Purchase"` and `event_id: purchase.eventId`. Putting the ID only in `custom_data.order_id` does **not** establish this pairing. Keep the business parameters consistent; do not depend on Meta combining complementary fields from two incomplete copies. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) **Recommended custom ID policy:** - Purchase: derive a stable ID such as `cc:<shop-id>:purchase:<canonical-order-id>`. - Normalize Shopify IDs identically on both sides; a numeric order ID and its full GraphQL GID are different strings. - Other events: generate one UUID per action and pass that same UUID to browser and server. - Preserve the Purchase ID and original occurrence time across retries. - Add your own durable order-level idempotency and browser replay guards. Do not use Meta’s matching window as permanent duplicate protection. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) With the native channel, leave event generation to that integration and validate its pairing. Do not add the sample browser call beside it. ## 4. Prepare customer information before server-side sending For a direct HTTP implementation, normalize contact information **before applying SHA-256**. Send lowercase hexadecimal digests, not plaintext contact details. Hash each field separately; do not salt the matching hash or hash an already-hashed value again. If using Meta’s Business SDK, check its automatic hashing behavior first. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | Field | Preparation before hashing | |---|---| | `em` | Trim surrounding whitespace; lowercase | | `ph` | Normalize to an international number; include country code; remove formatting and leading dialing/trunk zeros as appropriate | | `fn`, `ln` | Lowercase; remove punctuation; follow Meta’s UTF-8 rules | | `ct` | Lowercase; remove spaces and punctuation | | `st` | For US states, lowercase two-letter abbreviation, such as `ca` | | `zp` | Follow country-specific normalization; US ZIP uses first five digits | | `country` | Lowercase two-letter country code, such as `us` | | `external_id` | Use a stable first-party customer identifier; hashing is recommended; keep its representation consistent across channels | Omit unavailable or invalid fields rather than sending empty strings or guessed identifiers. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) **Do not hash** `client_ip_address`, `client_user_agent`, `fbp`, or `fbc`. Use the shopper’s original IP and user agent—not the webhook sender’s or your server’s. Pass available `_fbp` and `_fbc` cookie values as `fbp` and `fbc`. If constructing `fbc`, use Meta’s format and a genuinely observed `fbclid`; do not fabricate click identifiers. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/)) ## 5. Concrete Shopify setup ### Native channel versus custom implementation | Option | What you manage | Recommendation | |---|---|---| | **Native Facebook & Instagram by Meta** | Asset selection, sharing settings, consent configuration, duplicate-install audit and QA | **Recommended starting point** | | **Custom Pixel + CAPI backend** | Event mapping, identity/context joins, hashing, deduplication, webhook security, queues, consent enforcement and maintenance | Use only for a defined requirement the native channel cannot meet | Shopify identifies custom pixels as an advanced, merchant-maintained feature. That maintenance burden is difficult to justify for Cedar & Coil’s initial single-product setup without a specific unmet need. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage)) ### Recommended native setup path 1. Install/open **Facebook & Instagram by Meta** in Shopify’s sales channels. 2. Connect Cedar & Coil’s business portfolio and Facebook Page using an account with the necessary full-control permissions. 3. Confirm the correct ad account and Pixel/dataset are associated with the setup. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup)) 4. Go to **Sales channels → Facebook & Instagram → Settings → Data sharing settings / Share data settings**. 5. Enable customer data sharing and connect the intended Pixel. 6. Choose the approved sharing level: - **Standard:** browser Pixel only. - **Enhanced:** Pixel + CAPI Purchase. - **Maximum:** Pixel + CAPI Purchase and Meta’s evolving advertising technology. Use Maximum only if its sharing scope is approved; Enhanced also includes CAPI. Labels can differ between installations. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) 7. Remove competing Meta installations: hardcoded theme snippets, duplicate GTM tags, custom pixels and other apps sending the same events. **One coordinated browser/server implementation—not several overlapping ones.** ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/)) ### If custom implementation is necessary - Use **Settings → Customer events → Add custom pixel**, or a supported app-pixel implementation. Configure its customer-privacy permissions before connecting it. Do not build checkout tracking around legacy additional-script snippets. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage)) - Map Shopify events: - `product_viewed` → `ViewContent` - `product_added_to_cart` → `AddToCart` - `checkout_started` → `InitiateCheckout` - `checkout_completed` → browser Purchase, subject to your purchase definition. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/product_viewed)) - For resilient server Purchase delivery, subscribe to an appropriate order webhook—for a **paid-order definition**, use `orders/paid`. Verify the HTTPS webhook’s HMAC against the raw body, durably enqueue it, and deduplicate delivery retries. ([shopify.dev](https://shopify.dev/docs/api/webhooks/latest?utm_source=openai)) - Persist permitted browser context and consent decisions in a protected backend record joined to the checkout/order. Use Shopify’s sandbox browser APIs and event context rather than assuming access to the top-frame document. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api?utm_source=openai)) **Important:** `checkout_completed` can be absent if its page never loads. It is not a sufficient server Purchase source. Also, for delayed payment methods, do not emit an early browser Purchase and another paid Purchase days later: use the same purchase definition, or make that flow server-only. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) ### Server-side Purchase request sketch This is **custom-path code only**, not something to add alongside native CAPI. Assume `p` is a validated internal record assembled from a verified paid-order webhook plus permitted stored browser context. `p.total`, `p.currency`, line items and payment status must come from trusted Shopify data—not client-submitted prices. Set `META_GRAPH_VERSION` to an explicitly pinned, supported API version. ```js import { createHash } from "node:crypto"; const sha256 = value => createHash("sha256").update(value, "utf8").digest("hex"); async function sendPurchase(p) { // Computed from recorded consent, applicable region and opt-out state. if (!p.metaSharingAllowed) return { skipped: true }; const userData = { client_user_agent: p.browserUserAgent }; if (p.email) { userData.em = [sha256(p.email.trim().toLowerCase())]; } if (p.phoneInternationalDigits) { // Already validated: country code + national number, digits only. userData.ph = [sha256(p.phoneInternationalDigits)]; } for (const [key, value] of Object.entries({ client_ip_address: p.browserIp, fbp: p.fbp, fbc: p.fbc })) { if (value) userData[key] = value; // These fields are NOT hashed. } const event = { event_name: "Purchase", event_time: p.occurredAtSeconds, // Original occurrence; not retry time. event_id: p.eventId, // Same as browser eventID. action_source: "website", event_source_url: p.eventSourceUrl, user_data: userData, custom_data: { value: p.total, currency: p.currency, content_type: "product", content_ids: [...new Set(p.lines.map(line => line.catalogId))], contents: p.lines.map(line => ({ id: line.catalogId, quantity: line.quantity, item_price: line.unitPrice })), order_id: p.orderId } }; const body = new URLSearchParams({ access_token: process.env.META_CAPI_TOKEN, data: JSON.stringify([event]) }); if (process.env.META_TEST_EVENT_CODE) { body.set("test_event_code", process.env.META_TEST_EVENT_CODE); } const response = await fetch( `https://graph.facebook.com/${process.env.META_GRAPH_VERSION}/` + `${process.env.META_PIXEL_ID}/events`, { method: "POST", body } ); const result = await response.json(); if (!response.ok || result.error || result.events_received !== 1) { throw new Error("Meta Purchase not accepted; inspect redacted diagnostics"); } return result; } ``` The endpoint, event envelope and test-code mechanism follow Meta’s CAPI request format. Keep the token server-only. Wrap this sketch in a durable outbox with transient-error retries, permanent-error alerts and accepted-event records; an accepted API request alone does not prove attribution. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ## 6. Validate end to end before any launch review ### A. Establish a controlled test Use a test store/dataset where practical and authorized tester details. Record each test’s order ID, expected event ID, amount, currency, consent state and expected delivery paths. In **Meta Events Manager → Data Sources → intended Pixel/dataset → Test Events**, test browser activity. For custom CAPI, add the displayed `test_event_code` at the request’s top level. **Test-coded events are not automatically discarded from measurement**, so keep testing controlled and remove the code for production. If the native app exposes no test-code field, validate its server delivery through event details and diagnostics rather than treating an empty server Test Events view as conclusive. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ### B. Execute this acceptance checklist | Test | Expected result | |---|---| | View lamp → add one → begin checkout → pay | Correct event names and parameters at each actual step | | Inspect Purchase pair | Same dataset, exact event name and exact shared ID; overlapping copies deduplicate | | Quantity two, discount, shipping/tax | Amount, quantities and currency match the documented policy | | Refresh/revisit confirmation | No additional logical Purchase | | Replay webhook / retry CAPI | No new event ID or additional logical Purchase | | Failed or abandoned checkout | No Purchase | | Consented session with Pixel blocked | Server Purchase still arrives through the independent order path | | Consent denied / sale-sharing opt-out | Advertising delivery follows the approved policy on both paths | | Mobile Safari and supported express checkout | Supported flows produce the expected events without duplicates | Use Events Manager’s **Event Deduplication**, **Event Match Quality**, **Event Freshness** and **Diagnostics** views to inspect pairing, identifier quality, latency and errors. Raw received-event counts can precede deduplication and policy processing, so do not mistake two received copies for two final purchases. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ### C. Reconcile and monitor For custom tracking, reconcile eligible paid Shopify orders against the outbox and accepted CAPI events by order/event ID. For native tracking, compare controlled order results and event-detail evidence. Document exclusions and investigate unexplained gaps or duplication. Do not require Ads Manager attributed purchases to equal all Shopify orders: **event receipt, identity matching and advertising attribution are different stages**. Preserve Shopify as the order/revenue ledger. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) **Readiness gate:** approve the implementation only after controlled Purchase pairing, value accuracy, retry behavior, consent behavior and monitoring have passed. Keep the campaign itself draft-only pending separate authorization. ## 7. Consent and compliance - Configure **Shopify Settings → Customer privacy**, including the privacy policy, appropriate banner and data-sharing opt-out controls. Integrate any third-party consent manager with Shopify’s Customer Privacy API. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/understanding-customer-privacy-settings?c=VE&gmbsrc=ww-ww-et-gs-z-gmb-s-z-u~sb-g4sb_srvcs-u&subid=ww-ww-et-g-awa-a-g_hpbfoot1_1%21o2&utm_source=openai)) - Enforce applicable permission requirements on **both browser and server**. A webhook’s existence is not permission to send advertising data. Honor applicable sale/sharing opt-outs and GPC signals; covered California businesses must honor GPC as a valid opt-out. Have counsel confirm Cedar & Coil’s obligations and regional policy. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/pixel-privacy?utm_source=openai)) - Treat hashed customer identifiers as protected personal data, not anonymous data. Minimize fields and retention, restrict access, redact logs, and exclude payment credentials, sensitive information and free-text order notes from advertising payloads. ([ico.org.uk](https://ico.org.uk/for-organisations/uk-gdpr-guidance-and-resources/data-sharing/anonymisation/how-do-we-ensure-anonymisation-is-effective/)) **CAPI improves delivery resilience; it is not a consent workaround or a guarantee of complete attribution.** Judge this implementation by verified event correctness and privacy controls—not a promised attribution-recovery percentage.
Score · attempt 1 the judge's verdict, criterion by criterion10/11 criteria passed · failed: sources_defined
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends browser Pixel plus CAPI to the same dataset with deduplication, and explains that a server-generated Purchase doesn't rely on the customer's browser delivering the request.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The Section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with key parameters, and Purchase explicitly lists value, currency and content_ids.
code_sketch
A concrete server-side Purchase event code sketch or request example is included showing event_name, event_time, event_id, action_source, and a user_data block.
✓The Node sketch builds an event with event_name 'Purchase', event_time, event_id, action_source 'website' and a user_data block, then POSTs it to the /events endpoint.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Events Manager Test Events with test_event_code and an acceptance row 'Inspect Purchase pair... overlapping copies deduplicate', and names the Event Deduplication view.
sources_defined
For each event it is clear where it fires (browser vs server) and what the source of truth is (e.g. Purchase from the Shopify order webhook/server, not only the thank-you page).
✗Purchase's source is clear (the paid-order webhook, with checkout_completed called insufficient), but the event table gives triggers only and never states browser versus server firing for ViewContent, AddToCart or InitiateCheckout; it even says to audit which funnel events are server-delivered.
limits_stated
Limitations are stated honestly: no promised attribution-recovery percentages, and consent/regional rules are noted as constraints on what may be sent.
✓The closing says 'CAPI... is not a consent workaround or a guarantee of complete attribution' and promises no recovery percentage; Section 7 treats consent and regional rules as constraints on what may be sent.
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓Section 3 requires the same dataset, the same exact event name and the same event ID (Pixel eventID, CAPI event_id), with a browser example and a note that order_id alone doesn't dedupe.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓Purchase uses the stable derived ID 'cc:<shop-id>:purchase:<canonical-order-id>', other events use one UUID shared by browser and server, and the guide says to 'Preserve the Purchase ID and original occurrence time across retries'.
event_time_stable
The server Purchase event uses the purchase/order occurrence timestamp in Unix seconds and preserves it across retries; using the current send or retry time fails.
✓The guide specifies event_time as the actual occurrence time in Unix seconds, and the code uses p.occurredAtSeconds with the comment 'Original occurrence; not retry time'.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓The guide describes trimming and lowercasing before SHA-256, and the code hashes em via sha256(p.email.trim().toLowerCase()) while leaving IP, user agent, fbp and fbc unhashed.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓It recommends the native Facebook & Instagram by Meta channel for a small store and gives numbered steps covering install, connect, sharing level, and removal of duplicate installs, with the custom path as a fallback.
✗ Attempt 2
Answer · attempt 2 the model's full response$0.23 · 175.6s · 7.1k tok
# Cedar & Coil: Shopify-to-Meta conversion tracking guide **Draft implementation plan.** No campaigns have launched and no performance results exist. Keep campaign activation separate from tracking setup and QA. ## 1. Recommended architecture: Meta Pixel + Conversions API Use **browser Meta Pixel and server-side Conversions API (CAPI), connected to the same Meta Pixel/dataset**, with deduplication for overlapping events. Meta recommends this redundant setup. The Pixel captures browser interactions; CAPI provides an additional delivery path for events that browser execution, connectivity, or page-loading failures can otherwise lose. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/best-practices)) ```text Consented Shopify customer activity ├─ Browser Pixel ──────────────────────────┐ └─ Shopify/backend → CAPI ─────────────────┤ ↓ Same Meta Pixel/dataset Deduplicate shared events ``` Neither path replaces the other: - **Pixel:** captures browsing and funnel activity in its browser context. - **CAPI:** can deliver a server-confirmed Purchase without depending on the confirmation page’s Pixel request succeeding. - **Together:** improve resilience, but do not guarantee matching or attribution. Delivery, user matching, and ad attribution are separate stages. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) For Cedar & Coil, start with Shopify’s native integration. Shopify explicitly documents server-to-server **Purchase** delivery; verify whether other events also arrive server-side rather than assuming all browser events are mirrored. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) ## 2. Standard events and parameter contract Use these exact, case-sensitive Meta standard event names. The Shopify event names below are the subscriptions to use **if building a custom implementation**. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | Meta event | Shopify trigger | Recommended business parameters | |---|---|---| | `ViewContent` | `product_viewed` | `content_ids`, `content_type`, `contents`, `value`, `currency`; optionally `content_name: "Arc Clip Lamp"` | | `AddToCart` | `product_added_to_cart`, after the addition succeeds | `content_ids`, `content_type`, `contents` with quantity added, `value` for the items added, `currency` | | `InitiateCheckout` | `checkout_started` | Cart `content_ids`, `contents`, `num_items`, checkout `value`, `currency` | | `Purchase` | Browser: `checkout_completed`; server: authoritative completed-order/payment workflow | **`value`, `currency`, `content_ids`**, plus `content_type`, `contents`; optionally `order_id` | These parameters follow Meta’s Pixel and CAPI schemas. On CAPI, business parameters belong inside **`custom_data`**, not `user_data`. Purchase requires `value` and `currency`; include `content_ids` as part of Cedar & Coil’s tracking contract as well. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) **Implementation rules** - Use the same product-ID scheme in browser and server events. Inspect the connected catalog’s actual item identifiers; do not assume a Shopify product ID, variant ID, SKU, or handle is interchangeable. Set `content_type: "product"` for item-level identifiers, or `"product_group"` for group-level identifiers. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/reference/product-item/?utm_source=openai)) - Send numeric monetary amounts and three-letter currencies, such as `68.00` and `"USD"`. For a one-lamp example with no tax, shipping, or discount, the value is $68. **Production Purchase values must come from the actual order**, not a hard-coded product price. - Keep browser/server valuation identical: same discounts, taxes, shipping, duties, currency, and purchase milestone. Shopify’s native integration uses the order’s total-price convention; reconcile against that convention rather than a merchandise-only subtotal. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) Every custom CAPI website event should also include: - `event_name` - `event_time`: actual occurrence time, Unix **seconds** - `event_id` - `action_source: "website"` - `event_source_url`: actual event URL, sanitized of personal information and access tokens - `user_data`, including the customer’s browser `client_user_agent` and permitted matching identifiers. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 3. Exactly how deduplication works Meta deduplicates corresponding Pixel and CAPI events when they have: 1. The **same destination Pixel ID**. 2. The **same event name**, such as `Purchase`. 3. The **same event identifier**: browser `eventID` equals server `event_id`. 4. Arrival within **48 hours of the first event with that ID**. Send promptly rather than using that window as a scheduling target. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) Browser example—assuming Pixel is initialized, permission is granted, and the purchase is confirmed: ```js fbq("track", "Purchase", { value: 68.00, currency: "USD", content_ids: ["ACTUAL_CATALOG_ITEM_ID"], content_type: "product" }, { eventID: "cc:purchase:CANONICAL_SHOPIFY_ORDER_ID" }); ``` The corresponding CAPI event must contain: ```json { "event_name": "Purchase", "event_id": "cc:purchase:CANONICAL_SHOPIFY_ORDER_ID" } ``` The browser identifier is the **fourth argument**, not a business parameter. CAPI’s identifier is a top-level event field. Matching email addresses, amounts, or `custom_data.order_id` alone does not implement this recommended method. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) Recommended ID strategy: - **Purchase:** derive one stable ID from the canonical Shopify order ID. Normalize browser GraphQL IDs and webhook order IDs into the same representation. - **Other events:** generate one UUID per actual occurrence and pass it to both delivery paths. - **Retries:** reuse the original ID and occurrence time. Never generate a new conversion ID for a retry. Order/transaction IDs and shared random identifiers are supported approaches. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) Maintain your own persistent idempotency controls too; Shopify can redeliver webhooks. ([shopify.dev](https://shopify.dev/docs/apps/build/webhooks/verify-deliveries)) ## 4. Preparing customer information for CAPI For direct API requests, **normalize first, then SHA-256 hash** fields requiring hashing. Use unsalted hexadecimal hashes; omit unavailable fields rather than hashing empty strings. If using Meta’s Business SDK, account for its automatic hashing—do not double-hash. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | Field | Preparation before hashing | |---|---| | `em` | Trim surrounding whitespace; lowercase | | `ph` | Parse with the correct country; produce digits including country code, without `+`, punctuation, or trunk-prefix zeros | | `fn`, `ln` | Lowercase and remove punctuation according to Meta’s field rules | | `ct` | Lowercase; remove spaces and punctuation | | `st` | For US addresses, lowercase two-letter state abbreviation | | `zp` | Remove spaces/dashes; use first five digits for US ZIP codes | | `country` | Lowercase two-letter country code, such as `us` | | `external_id` | Stable merchant/customer identifier; hashing recommended; use the same representation across channels | Meta specifies field-level normalization rules, including international formats. Do not collect additional demographic information just to fill matching fields. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) **Do not hash** `client_ip_address`, `client_user_agent`, `fbp`, or `fbc`. Use the customer’s actual browser IP/UA—not the webhook sender’s or your server’s. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) When permitted, preserve `_fbp` and `_fbc` values in first-party tracking context associated with the cart/checkout. Send them as `fbp` and `fbc`. If `_fbc` is absent, construct it only from a genuinely observed `fbclid` using Meta’s format; preserve case and never invent a click identifier. Missing optional identifiers should remain missing. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/fbp-and-fbc)) ## 5. Concrete Shopify setup: native versus custom ### Recommended: Facebook & Instagram by Meta For this small DTC store, I recommend the **native sales channel first**, because it avoids making Cedar & Coil responsible for an entire tracking pipeline. | Option | What it offers | Main trade-off | |---|---|---| | Native Meta sales channel | Shopify-managed Pixel integration and server-side Purchase delivery | Less control over individual payloads; validate its actual output | | Custom implementation | Explicit event schemas, IDs, consent handling, queues, and observability | You own implementation, security, deduplication, retries, and maintenance | Shopify documents Pixel plus CAPI through its enhanced data-sharing settings; custom implementations use Shopify’s Web Pixels APIs and backend infrastructure. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) **Native setup path** 1. Install/open **Facebook & Instagram by Meta**. 2. Connect the intended business portfolio, Page, and ad account using an account with the necessary control. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 3. Open **Shopify admin → Sales channels → Facebook & Instagram → Settings → Data sharing settings**. 4. Enable customer data sharing; select **Maximum**, subject to the privacy review in section 7. 5. Connect the intended existing Meta Pixel/dataset. Shopify currently documents CAPI Purchase delivery for both **Enhanced** and **Maximum**; Standard is browser-only. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) 6. Remove competing Meta implementations: theme snippets, GTM tags, custom pixels, and third-party senders. Do not add the code below alongside the native integration. Multiple independently generated events can produce incorrect reporting. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) ### Custom implementation path Use this only for a concrete requirement the native integration cannot meet. - Build a Shopify Web Pixel app extension, or an appropriately configured custom pixel under **Settings → Customer events**, subscribing to the events in section 2. Respect the pixel sandbox and privacy settings. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api?utm_source=openai)) - Send Purchase from an authoritative Shopify order/payment webhook—not exclusively from a browser callback. `checkout_completed` can be absent when its page fails to load. For a paid-order definition, use `orders/paid` and align browser behavior; explicitly test delayed/manual-payment methods. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) - Verify webhook HMAC against the raw request body, persist an idempotent delivery record, then queue processing. Recommended application key: `(shop, event_name, event_id)`. ([shopify.dev](https://shopify.dev/docs/apps/build/webhooks/verify-deliveries)) - Join consent and permitted browser context to the order. If using checkout references, current Shopify webhooks use `checkout_token`; do not build against the removed `checkout_id`. ([shopify.dev](https://shopify.dev/changelog/posts/removed-checkout-id-from-checkouts-and-orders-webhooks?utm_source=openai)) ### Server-side Purchase request sketch **Illustrative Node.js code, not a complete webhook handler.** Its input is a validated internal record built from authenticated Shopify order data plus permitted tracking context. Pin `META_GRAPH_VERSION` to a supported version; keep credentials server-side. The payload structure follows Meta’s CAPI request schema. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ```js import { createHash } from "node:crypto"; const sha256 = s => createHash("sha256").update(s, "utf8").digest("hex"); export async function sendPurchase(p) { // A policy decision derived from applicable privacy permissions, // not Shopify's email-marketing opt-in flag. if (p.metaSharingAllowed !== true) return { skipped: true }; // Upstream validation must verify amounts, currency, IDs, // occurrence time, source URL, and identifier availability. if (!p.browserUserAgent || !p.eventSourceUrl) { throw new Error("Missing required website-event context"); } const userData = { client_user_agent: p.browserUserAgent }; if (p.email?.trim()) { userData.em = [sha256(p.email.trim().toLowerCase())]; } // Already parsed/validated: country code + digits only. if (p.phoneDigits) userData.ph = [sha256(p.phoneDigits)]; if (p.customerId) { userData.external_id = [sha256(`cc:customer:${p.customerId}`)]; } if (p.browserIp) userData.client_ip_address = p.browserIp; if (p.fbp) userData.fbp = p.fbp; // Do not hash. if (p.fbc) userData.fbc = p.fbc; // Do not hash. const event = { event_name: "Purchase", event_id: `cc:purchase:${p.canonicalOrderId}`, event_time: Math.floor(Date.parse(p.occurredAt) / 1000), action_source: "website", event_source_url: p.eventSourceUrl, // Sanitized actual source. user_data: userData, custom_data: { value: p.orderTotal, // Actual total, not fixed $68. currency: p.currency, content_type: "product", content_ids: p.items.map(i => i.catalogItemId), contents: p.items.map(i => ({ id: i.catalogItemId, quantity: i.quantity, item_price: i.unitPrice })), order_id: p.canonicalOrderId } }; const body = { data: [event] }; if (process.env.META_TEST_EVENT_CODE) { body.test_event_code = process.env.META_TEST_EVENT_CODE; } const response = await fetch( `https://graph.facebook.com/${process.env.META_GRAPH_VERSION}` + `/${process.env.META_PIXEL_ID}/events`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${process.env.META_CAPI_TOKEN}` }, body: JSON.stringify(body) } ); const result = await response.json(); if (!response.ok || result.error) { throw new Error("CAPI delivery failed; inspect redacted diagnostics"); } return result; } ``` Add persistent delivery state, bounded retries/backoff for transient failures, and alerts for validation/authentication failures. Preserve IDs and timestamps on retries. Send near real time; Meta rejects website events older than seven days. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 6. Validate end to end before scaling spend ### A. Verify receipt and payloads In **Events Manager → Data Sources → intended Pixel/dataset → Test Events**, complete the product-to-purchase journey. For custom CAPI, supply the generated `test_event_code`; remove it from production configuration afterward. **A test code is not an isolation mechanism**: Meta states these events can still be used for measurement and targeting. Prefer a separate test dataset for synthetic development traffic. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) For native integration, use its available testing/diagnostic surfaces and Events Manager’s connection-method details; do not assume the channel exposes a field for a custom test code. Confirm server receipt, not just browser execution. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ### B. Run this acceptance matrix | Test | Required result | |---|---| | Normal consented journey | Correct four-event sequence; correct destination, parameters, quantities, and values | | Pixel + CAPI Purchase | Matching event IDs and names; one processed purchase after deduplication | | Blocked Pixel request, sharing otherwise permitted | Server Purchase still arrives | | Confirmation-page reload | No new logical Purchase | | Duplicate webhook/retry | Same conversion ID; no new logical Purchase | | Discount, multiple quantities, shipping/tax | Browser/server totals and currency agree | | Mobile Safari and accelerated/offsite checkout used by the store | No unexplained missing Purchase or duplicate Purchase | | Consent declined, withdrawn, or applicable sharing opt-out | Both paths follow the configured permission decision | These are QA requirements, not claimed results. Use Meta’s **Event Deduplication**, **Event Freshness**, and **Event Match Quality** diagnostics to investigate failures; a high match-quality score alone does not establish correct deduplication or revenue. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ### C. Reconcile before increasing budget Compare eligible Shopify orders with your delivery ledger and Meta’s processed events using consistent dates, currencies, test-order exclusions, and revenue definitions. Investigate missing and duplicate IDs individually. Do **not** equate Events Manager receipt with Ads Manager attribution: Meta distinguishes received, matched, and attributed events. Keep campaign activation pending until QA passes; no attribution-recovery percentage should be assumed. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ## 7. Consent and compliance **CAPI is a resilient transport, not permission to bypass privacy choices.** Configure **Shopify → Settings → Customer privacy** with appropriate notices, consent controls, and sharing opt-outs for the jurisdictions served. Shopify documents support for Global Privacy Control through its configured opt-out functionality. Have the applicable requirements reviewed for Cedar & Coil’s actual business and markets. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings)) For custom tracking, use Shopify’s Customer Privacy API signals, including `marketingAllowed` and `saleOfDataAllowed`, and subscribe to consent changes. Carry the resulting permission decision into backend processing; recheck it before queued advertising events are sent. Do not substitute email-marketing consent for advertising-data-sharing permission. ([shopify.dev](https://shopify.dev/docs/api/customer-privacy?utm_source=openai)) Minimize collected fields, restrict access, set retention limits, and redact credentials and customer data from logs. Treat hashed identifiers as protected customer information—not as a substitute for consent or authorization. Exclude payment credentials, sensitive personal information, and personal information embedded in URLs or free-text fields. Meta’s Business Tools restrictions apply to both browser and server integrations. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters))
Score · attempt 2 the judge's verdict, criterion by criterion10/11 criteria passed · failed: sources_defined
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends browser Pixel plus CAPI on the same dataset with deduplication, and says CAPI covers events the browser loses to execution, connectivity, or page-load failures, but it never explicitly ties this to browser privacy limits like ITP or ad blockers.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase lists value, currency and content_ids in bold.
code_sketch
A concrete server-side Purchase event code sketch or request example is included showing event_name, event_time, event_id, action_source, and a user_data block.
✓The Node.js sketch builds an event with event_name, event_time, event_id, action_source and a user_data block.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Events Manager Test Events with test_event_code, and the acceptance matrix requires matching IDs and names and one processed purchase after deduplication, with the Event Deduplication diagnostic.
sources_defined
For each event it is clear where it fires (browser vs server) and what the source of truth is (e.g. Purchase from the Shopify order webhook/server, not only the thank-you page).
✗Purchase is clearly split (browser checkout_completed, server from the order webhook), but ViewContent, AddToCart and InitiateCheckout are mapped only to Shopify browser triggers and the response never says whether they also fire server-side or what their source of truth is.
limits_stated
Limitations are stated honestly: no promised attribution-recovery percentages, and consent/regional rules are noted as constraints on what may be sent.
✓It says "no attribution-recovery percentage should be assumed" and "do not guarantee matching or attribution", and section 7 treats consent and regional rules as constraints on what may be sent.
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓It requires the same Pixel ID, same event name and eventID equal to event_id, shows the fbq fourth-argument eventID and the CAPI event_id, and states the 48-hour window.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓The Purchase ID is derived from the canonical order ID (`cc:purchase:CANONICAL_SHOPIFY_ORDER_ID`), other events get one UUID per occurrence shared by both paths, and "Retries: reuse the original ID and occurrence time."
event_time_stable
The server Purchase event uses the purchase/order occurrence timestamp in Unix seconds and preserves it across retries; using the current send or retry time fails.
✓The code sets event_time from `Date.parse(p.occurredAt)/1000` in Unix seconds, and the text says to "Preserve IDs and timestamps on retries" and use actual occurrence time.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓The guide says to normalize then SHA-256 hash, lists `em` as trimmed and lowercased, and the code applies `sha256(p.email.trim().toLowerCase())` while leaving IP, user agent, fbp and fbc unhashed.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓It recommends the native Meta sales channel for a small store, gives numbered setup steps (install, connect, Data sharing settings, pick the pixel, remove competing implementations), and reserves custom for specific needs.
✗ Attempt 3
Answer · attempt 3 the model's full response$0.26 · 228.6s · 9.7k tok
# Cedar & Coil: Shopify → Meta conversion-tracking guide **Status: draft implementation plan.** No campaign has launched and no performance data exists. Keep campaigns unpublished until tracking, privacy, and launch approvals are complete. ## 1. Recommended architecture: Pixel + Conversions API Use **browser Meta Pixel plus server-side Conversions API (CAPI), feeding the same Meta pixel/dataset**, with deduplication for overlapping events. Meta recommends this redundant setup. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/best-practices)) ```text Eligible storefront/checkout action ├─ Browser Meta Pixel ───────────────────┐ └─ Server event → queue → Meta CAPI ─────┤ ▼ Same Meta pixel/dataset Deduplicate shared events For Purchase, use Shopify’s order system as the server-side source. ``` - **Pixel supplies browser context:** product and checkout interactions, plus browser identifiers useful for matching. - **CAPI supplies another delivery path:** a Shopify-generated Purchase need not depend on the customer successfully loading a confirmation page or making a browser request to Meta. This reduces dependence on browser delivery, but does not eliminate consent restrictions, identifier loss, or attribution limitations. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) **Shopify-specific distinction:** Shopify documents the native integration’s four requested funnel events through the Pixel, and explicitly documents **Purchase** through CAPI at Enhanced and Maximum sharing levels. Do not assume native server-side coverage for every upper-funnel event; inspect actual traffic. For this small store, prioritize a dependable dual-path **Purchase** rather than adding custom infrastructure merely to mirror every event. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) ## 2. Event plan and parameters Use the exact, case-sensitive Meta standard event names. The following is Cedar & Coil’s recommended event contract, using Shopify’s corresponding customer events as implementation hooks. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | Meta event | Trigger / Shopify hook | Recommended event parameters | |---|---|---| | **ViewContent** | Arc Clip Lamp product detail viewed; `product_viewed` | `content_ids`, `content_type`, `contents`; `value` = displayed item price; `currency` = displayed currency. At the supplied regular price, one lamp is **68 USD**. | | **AddToCart** | Successful addition—not merely a button click; `product_added_to_cart` | Added item’s `content_ids`, `content_type`, `contents` with quantity; `value` = value of the quantity just added, not the entire existing cart; `currency`. | | **InitiateCheckout** | Customer enters checkout; `checkout_started` | All checkout `content_ids`, `contents`, `num_items`, current checkout `value`, and `currency`. | | **Purchase** | Genuine completed purchase; browser `checkout_completed`, paired with the corresponding verified Shopify server event | **`value`, `currency`, `content_ids`**; also `content_type`, `contents` with quantities, and server-side `order_id` for reconciliation. | Meta requires `value` and `currency` on Purchase. Include `content_ids` as part of Cedar & Coil’s contract even when not using catalog ads. Product identifiers must match the identifiers used in the connected Meta catalog; do not substitute the product title or assume a Shopify SKU is the catalog identifier. Use `content_type: "product"` for item-level IDs, or `"product_group"` when intentionally sending group IDs. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) **Value rules** - Send numeric major-unit amounts: `68.00`, not `6800` or `"$68"`. - Send an ISO currency code such as `"USD"`. - Purchase must use the **actual transaction total and corresponding currency**, not a hard-coded $68. Discounts, quantities, and checkout charges can change it. - Document the revenue basis and keep browser and server copies consistent. With the native channel, reconcile against Shopify’s documented order-total basis rather than adding a second calculation. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/custom-data)) For each custom CAPI website event, supply `event_name`, original occurrence time as Unix **seconds** in `event_time`, `event_id`, `action_source: "website"`, the relevant `event_source_url`, and prepared `user_data`, including the customer’s browser user agent. Business parameters belong inside `custom_data`. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 3. Exactly how Pixel–CAPI deduplication works For the recommended event-ID method, both copies must have: 1. The **same destination pixel/dataset**. 2. The **same event name**, such as `Purchase`. 3. The **same identifier**: browser `eventID` equals server `event_id`. 4. Arrival within Meta’s **48-hour deduplication window**, measured from receipt of the first matching event. Send promptly; this is not a reason to delay delivery. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) Browser example—**custom implementation only**: ```javascript fbq("track", "Purchase", purchaseParameters, { eventID: purchaseEventId }); ``` The corresponding CAPI object must contain: ```javascript { event_name: "Purchase", event_id: purchaseEventId // ...other required fields } ``` `eventID` is the Pixel call’s **fourth argument**, not a property buried in its business parameters. Matching email, value, or timestamp is not the recommended event-ID deduplication method. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) For custom Purchase events, use a stable, namespaced identifier such as `cc:purchase:12345`, derived from one canonical Shopify order ID. Normalize GraphQL and webhook order-ID formats before constructing it. For repeatable actions such as AddToCart, create an ID **per action**, then reuse it on both paths—not one ID per visitor or session. Meta explicitly supports order identifiers and shared random identifiers for these purposes. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) Keep overlapping copies’ values and currencies consistent; do not assume deduplication will repair conflicting payloads. Separately maintain application-level idempotency for webhook redeliveries and successful sends, so replaying an old order does not create another conversion after the deduplication window. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 4. Preparing server-side customer information For a direct HTTP integration, normalize contact information **before** hashing it with SHA-256. Send the hexadecimal digest, without adding a salt. Do not double-hash; Meta’s Business SDK can perform hashing automatically, so establish which layer owns it. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | Field | Preparation before sending | |---|---| | `em` | Trim leading/trailing whitespace, lowercase, then SHA-256. | | `ph` | Parse using the correct country context; include country code, remove formatting and applicable leading zeros, then SHA-256. Do not assume every number is US-based. | | `fn`, `ln` | Apply Meta’s lowercase/no-punctuation normalization, then SHA-256. | | `ct`, `st`, `zp`, `country` | Apply field-specific normalization, then hash. Examples: US state `ca`; US ZIP first five digits; country `us`. | | `external_id` | Use a stable first-party customer identifier. Hashing is recommended; keep its representation consistent across channels. | These are field-specific rules, not a universal “remove all punctuation from everything” transformation. Omit unavailable identifiers rather than sending empty or fabricated values. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) **Do not hash** `client_ip_address`, `client_user_agent`, `fbp`, or `fbc`. Use the actual customer browser context—not the IP address or user agent of Shopify’s webhook sender. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) Capture `_fbp` and `_fbc` only when permitted and available, and associate them with the checkout/order through a persisted correlation key. If constructing `fbc`, use a genuinely observed `fbclid` and Meta’s prescribed format; preserve its case. Never fabricate an advertising click identifier. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/fbp-and-fbc)) ## 5. Concrete Shopify setup: native versus custom ### Recommended choice: the native Meta sales channel | Approach | What it provides / requires | Recommendation | |---|---|---| | **Facebook and Instagram by Meta** | Managed Pixel installation and server-side Purchase delivery at Enhanced/Maximum; less control over individual payloads. | **Start here** for Cedar & Coil. Validate its behavior rather than assuming installation equals correctness. | | **Custom Pixel + backend CAPI** | Control over event definitions, IDs, parameters, consent propagation, queues, retries, and monitoring—but the store owns all of that engineering. | Consider only for a demonstrated requirement or unresolved integration gap. | Shopify provides the managed installation path; a custom solution instead requires Shopify-compatible pixel code and an independently operated backend. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) ### Native setup steps 1. **Audit existing tracking.** Inventory theme snippets, Google Tag Manager tags, Shopify custom pixels, and third-party CAPI apps. Remove or disable competing Meta event senders before enabling the native integration. Shopify specifically warns against retaining manually installed theme Pixel code. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) 2. In Shopify, open **Settings → Sales channels → Shopify App Store**, install **Facebook and Instagram by Meta**, and complete account setup. Connect the intended business assets and verify the selected advertising account and pixel/dataset. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 3. Open **Sales channels → Facebook & Instagram → Settings → Data sharing settings / Share data settings**. 4. Enable customer data sharing and connect the intended pixel. **Standard is browser-only; Enhanced and Maximum enable Pixel plus CAPI Purchase.** Use Maximum only if its sharing scope is approved by Cedar & Coil’s privacy review; Enhanced also provides the core dual-path architecture. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) 5. Configure **Settings → Customer privacy**, including applicable banners and opt-out settings, before testing. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai)) 6. Run the validation plan below. Let the native integration own its event IDs; **do not add the following custom Purchase sender alongside it** unless a developer has explicitly coordinated ownership and deduplication. ### If a custom implementation is justified - Subscribe to Shopify’s supported Customer Events/Web Pixels events rather than relying on old thank-you-page scripts. Respect the chosen sandbox; the `fbq` example above is an API illustration, not a complete Shopify pixel installation. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api?utm_source=openai)) - Drive server Purchase from **verified Shopify order webhooks**, not solely from a browser `fetch`. Verify HTTPS webhook HMAC against the **raw body**, persist/enqueue work, acknowledge promptly, and process idempotently. Add reconciliation because webhook delivery is not guaranteed. ([shopify.dev](https://shopify.dev/docs/apps/build/webhooks/verify-deliveries)) - Define the purchase milestone consistently. `checkout_completed` means checkout completion; `orders/paid` means the order became paid. They can occur at different times with delayed payment. Do not blindly pair different milestones. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) - Persist permitted attribution context and consent against an opaque checkout/order correlation key. Do not assume an order webhook contains browser cookies. Obtain the necessary customer-data access for the fields you use. ([shopify.dev](https://shopify.dev/docs/apps/build/webhooks/delivery-structure?utm_source=openai)) ### Server-side Purchase request sketch **Custom path only; not production-complete.** This Node.js sketch assumes `job` was built from a verified Shopify order and associated permitted browser context. Amount, currency, IDs, occurrence time, and consent eligibility must be validated upstream. ```javascript import { createHash } from "node:crypto"; const sha256 = value => createHash("sha256").update(value, "utf8").digest("hex"); export async function sendPurchase(job) { if (!job.metaSharingAllowed) return { skipped: true }; const email = job.email?.trim().toLowerCase(); const eventId = `cc:purchase:${job.canonicalOrderId}`; const event = { event_name: "Purchase", event_time: job.occurredAtUnixSeconds, // Original time; never retry time event_id: eventId, // Same as browser eventID action_source: "website", event_source_url: job.sourceUrl, // Actual relevant URL; no private tokens user_data: { ...(email ? { em: [sha256(email)] } : {}), client_user_agent: job.customerUserAgent, ...(job.customerIp ? { client_ip_address: job.customerIp } : {}), ...(job.fbp ? { fbp: job.fbp } : {}), ...(job.fbc ? { fbc: job.fbc } : {}) }, custom_data: { value: Number(job.orderTotalAmount), currency: job.orderCurrency, order_id: String(job.canonicalOrderId), content_type: "product", content_ids: [...new Set(job.items.map(i => String(i.catalogItemId)))], contents: job.items.map(i => ({ id: String(i.catalogItemId), quantity: i.quantity })) } }; const payload = { data: [event] }; if (process.env.META_TEST_EVENT_CODE) { payload.test_event_code = process.env.META_TEST_EVENT_CODE; } const response = await fetch( `https://graph.facebook.com/${process.env.META_API_VERSION}` + `/${process.env.META_PIXEL_ID}/events`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${process.env.META_CAPI_TOKEN}` }, body: JSON.stringify(payload) } ); const result = await response.json(); if (!response.ok || result.error || result.events_received !== 1) { throw new Error(`Meta Purchase delivery failed; HTTP ${response.status}`); } return { eventId, traceId: result.fbtrace_id }; } ``` The request uses Meta’s versioned `/{PIXEL_ID}/events` endpoint and separates customer identifiers from business parameters. Pin a supported API version in configuration; keep the access token server-side. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) The production wrapper should persist successful sends, retry transient failures with backoff using the **same event ID and original timestamp**, and alert on authentication or validation errors. Send promptly: Meta’s documented maximum age for these events is seven days, separate from the 48-hour deduplication window. Avoid logging tokens, raw customer details, or complete payloads. ([developers.facebook.com](https://developers.facebook.com/docs/graph-api/guides/error-handling?utm_source=openai)) ## 6. End-to-end validation before approving spend ### A. Verify the complete funnel In **Meta Events Manager**, select the intended data source and use **Test Events**. Traverse the actual Arc Clip Lamp journey: product view → successful cart addition → checkout → completed order. Inspect event names, parameters, destination, IDs, amounts, and currency. For custom CAPI testing, supply `test_event_code`; remove it for approved production use. Use a separate test data source for fabricated payloads—do not assume the test code quarantines measurement data. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ### B. Run this acceptance matrix | Test | Required result | |---|---| | Normal browser, sharing permitted | Four expected funnel events; Purchase received through browser and server where supported. | | Purchase overlap | Matching event name and IDs; Meta’s deduplication details show correct handling rather than two distinct conversions. | | Different quantity or discount | Correct actual amount, currency, item IDs, and quantities on both Purchase copies. | | Confirmation-page refresh/revisit | No additional logical Purchase for the same order. | | Browser Meta requests blocked, sharing still permitted | Server Purchase still arrives. Do not require a browser receipt when deliberately blocked. | | Failed or abandoned checkout | No Purchase. | | Consent denied or applicable opt-out exercised | Tracking follows the configured policy on **both** paths. | | Custom webhook redelivery / transient API failure | Idempotent processing and retries retain the same ID and occurrence time. | These checks exercise Meta’s receipt, freshness, deduplication, and matching controls, together with Shopify’s consent and webhook behavior. Test accelerated checkout and each payment method Cedar & Coil intends to offer, rather than validating only one desktop card flow. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ### C. Inspect diagnostics and reconcile - Review **Event Deduplication**, **Event Freshness**, **Event Match Quality**, and parameter warnings. A high match-quality score is not proof of correct amounts or deduplication. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) - Compare an order-level QA ledger with Shopify: order ID, event ID, eligible sharing status, amount/currency, delivery outcome, and duplicate handling. - Distinguish **received**, **deduplicated/processed**, **matched**, and **ad-attributed** events. An API acceptance response does not prove attribution; Events Manager’s raw receipt totals can include events before deduplication or policy processing. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) **Approval gate:** resolve unexplained duplicates, missing eligible Purchases, incorrect values, and consent failures before launch or any later spend increase. Do not expect Shopify order totals to equal Ads Manager attributed purchases. ## 7. Consent and compliance note Treat CAPI as another data-delivery method—not permission to bypass a customer’s tracking choice. - Publish an accurate privacy notice describing Meta sharing and its purposes. Configure Shopify’s regional consent and opt-out controls; custom code may require additional integration to honor them. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) - Propagate the relevant marketing and sale/sharing permissions to the backend. Shopify exposes these separately; an email-marketing subscription is not a substitute for the appropriate advertising-data permission. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-api/customerprivacy?utm_source=openai)) - Honor applicable sale/sharing and targeted-advertising opt-outs, including Global Privacy Control where required. California obligations depend on whether the business and processing are covered—not simply whether the store is US-based. Obtain legal review for applicable markets. ([cppa.ca.gov](https://cppa.ca.gov/pdf/oops?utm_source=openai)) - Minimize transmitted fields, protect identifiers and logs, and implement retention/deletion procedures. **Hashing is not anonymization** and does not remove privacy obligations. ([ico.org.uk](https://ico.org.uk/for-organisations/uk-gdpr-guidance-and-resources/data-sharing/anonymisation/introduction-to-anonymisation/?utm_source=openai)) The objective is accurate, consent-respecting delivery of eligible conversion signals—not guaranteed attribution recovery.
Score · attempt 3 the judge's verdict, criterion by criterion10/11 criteria passed · failed: sources_defined
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends browser Pixel plus CAPI into the same dataset with deduplication, and explains CAPI does not depend on the customer's browser loading a confirmation page or reaching Meta, while noting consent and identifier limits.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The Section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase explicitly lists value, currency and content_ids.
code_sketch
A concrete server-side Purchase event code sketch or request example is included showing event_name, event_time, event_id, action_source, and a user_data block.
✓The Node.js sketch builds an event with event_name "Purchase", event_time, event_id, action_source "website", and a user_data block, then POSTs it to /{PIXEL_ID}/events.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Events Manager Test Events and test_event_code, and the acceptance matrix has a 'Purchase overlap' test where the deduplication details must show correct handling, plus the Event Deduplication diagnostic.
sources_defined
For each event it is clear where it fires (browser vs server) and what the source of truth is (e.g. Purchase from the Shopify order webhook/server, not only the thank-you page).
✗Purchase's source is clear (Shopify order webhook on the server, checkout_completed in the browser), but the guide says native server-side coverage for upper-funnel events is unverified ('inspect actual traffic'), so where ViewContent, AddToCart and InitiateCheckout fire server-side is not defined.
limits_stated
Limitations are stated honestly: no promised attribution-recovery percentages, and consent/regional rules are noted as constraints on what may be sent.
✓The closing line says 'not guaranteed attribution recovery', no percentages are given, and consent and regional rules (GPC, CCPA, GDPR) are described as constraints on what may be sent.
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓Section 3 requires the same event name and same ID, with browser eventID as the fourth fbq argument equal to server event_id, in the same pixel/dataset within the 48-hour window.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓The event ID is derived from the canonical order ID (`cc:purchase:${job.canonicalOrderId}`), shared with the browser, and the guide says retries use 'the same event ID and original timestamp'; a per-action ID is shared across both paths for AddToCart.
event_time_stable
The server Purchase event uses the purchase/order occurrence timestamp in Unix seconds and preserves it across retries; using the current send or retry time fails.
✓The code uses job.occurredAtUnixSeconds with the comment 'Original time; never retry time', the guide specifies Unix seconds, and it says retries preserve the original timestamp.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓The code trims, lowercases, then SHA-256 hashes the email, and Section 4 gives per-field normalization before hashing, with no hashing of IP, user agent, fbp or fbc.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓The guide recommends the native Facebook & Instagram by Meta channel ('Start here') with numbered setup steps, and says to use custom only for a demonstrated need.