← Run 20261118-064047-80317678
Shopify to Meta ads conversion tracking implementation
task shopify-meta-capiNov 18, 2026Models on marketing tasks + Marketing Skillsskill analytics

Answers & verdicts

GPT-6 Astra high effort

Task failed
Task the exact prompt the model was given — assignment, source material, and skill guidance
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. --- ## Skill guidance you should follow --- name: analytics description: "Set up or audit tracking — GA4, GTM, Mixpanel, Segment; tracking plans, event naming, UTM conventions, conversion and attribution debugging. Rate metrics divide matching closed windows — never full-period spend by partial-period results." metadata: version: 2.2.0 --- # Analytics Tracking You are an expert in analytics implementation and measurement. Your goal is to help set up tracking that provides actionable insights for marketing and product decisions. ## Initial Assessment **Check for product marketing context first:** If `.agents/product-marketing.md` exists (or `.claude/product-marketing.md`, or the legacy `product-marketing-context.md` filename, in older setups), read it before asking questions. Use that context and only ask for information not already covered or specific to this task. **Apply the project's brand:** If `BRAND.md` exists, read it before asking questions and apply it to everything you produce — its voice, messaging, and audience for anything written, and its colors, typography, and logo for anything visual. Never ask for a brand fact it already answers. If it lacks something you need, name the missing fact instead of inventing one or quietly falling back to a generic default. Before implementing tracking, understand: 1. **Business Context** - What decisions will this data inform? What are key conversions? 2. **Current State** - What tracking exists? What tools are in use? 3. **Technical Context** - What's the tech stack? Any privacy/compliance requirements? --- ## Core Principles ### 1. Track for Decisions, Not Data - Every event should inform a decision - Avoid vanity metrics - Quality > quantity of events ### 2. Start with the Questions - What do you need to know? - What actions will you take based on this data? - Work backwards to what you need to track ### 3. Name Things Consistently - Naming conventions matter - Establish patterns before implementing - Document everything ### 4. Maintain Data Quality - Validate implementation - Monitor for issues - Clean data > more data ### 5. Compute, Don't Eyeball - Derive every total, rate, and delta from row-level data with a script or spreadsheet — never by scanning rows and summing mentally. One silently dropped row corrupts every figure downstream of it. - Cross-check each headline figure a second, independent way (a reconciliation total, a recomputation from a different grouping) before reporting it, and chase any mismatch to the exact row. - When a claim is about one segment — a single campaign, ad set, channel, or week — report that segment's own numbers. Never fold it into a neighboring group and let the group's total speak for it. ### 6. Match Observation Windows - A rate or efficiency metric divides a numerator and denominator that cover the same closed observation window. Never divide a full period's spend by a partial period's conversions or revenue — restate both over the weeks that actually have data, and say which weeks those are. - Cohort rates use only cohorts whose observation window has ended. A trial or signup still inside its window is pending, not failed — exclude it from the denominator and label it as pending rather than counting it against the rate. ### 7. Recommend Against the Stated Goal - Analysis ends in a recommendation, and the recommendation must be argued from the goal the brief states — the launch target, audience, revenue, or positioning objective — not only from what is operationally easiest. Name which stated goal each option serves and what it trades away. --- ## Tracking Plan Framework ### Structure ``` Event Name | Category | Properties | Trigger | Notes ---------- | -------- | ---------- | ------- | ----- ``` ### Event Types | Type | Examples | |------|----------| | Pageviews | Automatic, enhanced with metadata | | User Actions | Button clicks, form submissions, feature usage | | System Events | Signup completed, purchase, subscription changed | | Custom Conversions | Goal completions, funnel stages | **For comprehensive event lists**: See [references/event-library.md](references/event-library.md) --- ## Event Naming Conventions ### Recommended Format: Object-Action ``` signup_completed button_clicked form_submitted article_read checkout_payment_completed ``` ### Best Practices - Lowercase with underscores - Be specific: `cta_hero_clicked` vs. `button_clicked` - Include context in properties, not event name - Avoid spaces and special characters - Document decisions --- ## Essential Events ### Marketing Site | Event | Properties | |-------|------------| | cta_clicked | button_text, location | | form_submitted | form_type | | signup_completed | method, source | | demo_requested | - | ### Product/App | Event | Properties | |-------|------------| | onboarding_step_completed | step_number, step_name | | feature_used | feature_name | | purchase_completed | plan, value | | subscription_cancelled | reason | **For full event library by business type**: See [references/event-library.md](references/event-library.md) --- ## Event Properties ### Standard Properties | Category | Properties | |----------|------------| | Page | page_title, page_location, page_referrer | | User | user_id, user_type, account_id, plan_type | | Campaign | source, medium, campaign, content, term | | Product | product_id, product_name, category, price | ### Best Practices - Use consistent property names - Include relevant context - Don't duplicate automatic properties - Avoid PII in properties --- ## GA4 Implementation ### Quick Setup 1. Create GA4 property and data stream 2. Install gtag.js or GTM 3. Enable enhanced measurement 4. Configure custom events 5. Mark conversions in Admin ### Custom Event Example ```javascript gtag('event', 'signup_completed', { 'method': 'email', 'plan': 'free' }); ``` **For detailed GA4 implementation**: See [references/ga4-implementation.md](references/ga4-implementation.md) --- ## Google Tag Manager ### Container Structure | Component | Purpose | |-----------|---------| | Tags | Code that executes (GA4, pixels) | | Triggers | When tags fire (page view, click) | | Variables | Dynamic values (click text, data layer) | ### Data Layer Pattern ```javascript dataLayer.push({ 'event': 'form_submitted', 'form_name': 'contact', 'form_location': 'footer' }); ``` **For detailed GTM implementation**: See [references/gtm-implementation.md](references/gtm-implementation.md) --- ## UTM Parameter Strategy ### Standard Parameters | Parameter | Purpose | Example | |-----------|---------|---------| | utm_source | Traffic source | google, newsletter | | utm_medium | Marketing medium | cpc, email, social | | utm_campaign | Campaign name | spring_sale | | utm_content | Differentiate versions | hero_cta | | utm_term | Paid search keywords | running+shoes | ### Naming Conventions - Lowercase everything - Use underscores or hyphens consistently - Be specific but concise: `blog_footer_cta`, not `cta1` - Document all UTMs in a spreadsheet --- ## Debugging and Validation ### Testing Tools | Tool | Use For | |------|---------| | GA4 DebugView | Real-time event monitoring | | GTM Preview Mode | Test triggers before publish | | Browser Extensions | Tag Assistant, dataLayer Inspector | ### Validation Checklist - [ ] Events firing on correct triggers - [ ] Property values populating correctly - [ ] No duplicate events - [ ] Works across browsers and mobile - [ ] Conversions recorded correctly - [ ] No PII leaking ### Common Issues | Issue | Check | |-------|-------| | Events not firing | Trigger config, GTM loaded | | Wrong values | Variable path, data layer structure | | Duplicate events | Multiple containers, trigger firing twice | --- ## Privacy and Compliance ### Considerations - Cookie consent required in EU/UK/CA - No PII in analytics properties - Data retention settings - User deletion capabilities ### Implementation - Use consent mode (wait for consent) - IP anonymization - Only collect what you need - Integrate with consent management platform --- ## Output Format ### Tracking Plan Document ```markdown # [Site/Product] Tracking Plan ## Overview - Tools: GA4, GTM - Last updated: [Date] ## Events | Event Name | Description | Properties | Trigger | |------------|-------------|------------|---------| | signup_completed | User completes signup | method, plan | Success page | ## Custom Dimensions | Name | Scope | Parameter | |------|-------|-----------| | user_type | User | user_type | ## Conversions | Conversion | Event | Counting | |------------|-------|----------| | Signup | signup_completed | Once per session | ``` --- ## Task-Specific Questions 1. What tools are you using (GA4, Mixpanel, etc.)? 2. What key actions do you want to track? 3. What decisions will this data inform? 4. Who implements - dev team or marketing? 5. Are there privacy/consent requirements? 6. What's already tracked? --- ## Tool Integrations For implementation, see the [tools registry](../../tools/REGISTRY.md). Key analytics tools: | Tool | Best For | MCP | Guide | |------|----------|:---:|-------| | **GA4** | Web analytics, Google ecosystem | ✓ | [ga4.md](../../tools/integrations/ga4.md) | | **Mixpanel** | Product analytics, event tracking | - | [mixpanel.md](../../tools/integrations/mixpanel.md) | | **Amplitude** | Product analytics, cohort analysis | - | [amplitude.md](../../tools/integrations/amplitude.md) | | **PostHog** | Open-source analytics, session replay | - | [posthog.md](../../tools/integrations/posthog.md) | | **Segment** | Customer data platform, routing | - | [segment.md](../../tools/integrations/segment.md) | --- ## Related Skills - **ab-testing**: For experiment tracking - **seo-audit**: For organic traffic analysis - **cro**: For conversion optimization (uses this data) - **revops**: For pipeline metrics, CRM tracking, and revenue attribution
✗ Attempt 1
Answer · attempt 1 the model's full response$1.03 · 192.8s · 7.2k tok
# Cedar & Coil: Shopify → Meta conversion tracking guide **Status: draft implementation plan.** No campaign has launched, and no performance results are assumed. Keep ads unpublished while implementing and validating this setup. **Recommendation:** Start with Shopify’s **Facebook & Instagram by Meta sales channel**, using a consent-appropriate setting that enables both Meta Pixel and Conversions API. Reserve a custom implementation for requirements the native integration cannot meet. ## 1. Recommended architecture: browser Pixel + server-side CAPI ```text Consent / privacy controls │ ┌─────────────────┴─────────────────┐ │ │ Shopify browser events Shopify order/backend events │ │ Meta Pixel Conversions API │ │ └──────── Same Meta dataset ────────┘ Matching event name + ID │ One counted conversion ``` Use both because they provide complementary signals: - **Pixel:** captures browser interactions and available browser identifiers. - **CAPI:** sends events directly from the backend, including purchases that might otherwise be missed because the confirmation page or browser tracking did not load. - **Deduplication:** prevents the browser and server copies of one purchase from becoming two conversions. Meta recommends this redundant setup. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/best-practices)) Prioritize an **order-backed server Purchase**. Merely forwarding a browser-generated event through a server is not an independent fallback if that browser event never fires. Shopify explicitly notes that its browser `checkout_completed` event can be absent when the relevant page fails to load. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) The goal is more reliable, consent-respecting measurement—not perfect attribution or circumvention of privacy choices. ## 2. Standard events and parameter contract Use Meta’s exact standard event names, including capitalization. Do not rename them to an internal convention such as `purchase_completed`. The following is Cedar & Coil’s proposed tracking contract; some parameters are optional in Meta’s API but should still be required internally for consistent reporting. Meta requires `value` and `currency` for Purchase. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | Event | Trigger | Parameters to send | |---|---|---| | **ViewContent** | Arc Clip Lamp product detail is viewed | `content_ids`, `content_type: "product"`, `content_name: "Arc Clip Lamp"`, `value` = displayed unit price, `currency` | | **AddToCart** | Product is successfully added—not merely when the button is clicked | `content_ids`, `content_type`, `contents` with quantity, `value` = value of items added, `currency` | | **InitiateCheckout** | Checkout begins | `content_ids`, `contents`, `num_items`, `value` = checkout value at that moment, `currency` | | **Purchase** | Successful completed purchase, once per order | **`value`, `currency`, `content_ids`**, plus `content_type`, `contents`, and preferably `order_id` | These events and their associated commerce parameters are supported by Meta’s Pixel reference. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) ### Parameter rules - **IDs:** Use IDs that match the actual items in the connected Meta catalog. Inspect the synced catalog; do not assume a Shopify SKU, product ID, or variant ID is automatically the correct catalog identifier. - **`contents`:** Use objects such as `{id: "<catalog-item-id>", quantity: 1, item_price: 68.00}`. - **`value`:** Send a number in currency units—not cents or a formatted string. - **`currency`:** Send the actual transaction currency, such as `"USD"`, using its ISO currency code. - **Purchase value policy:** Use the final order total after discounts, including applicable shipping, taxes, and duties, consistently in both copies. If a different revenue definition is chosen, document it and apply it everywhere. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/custom-data)) The supplied lamp price is **$68**. A Purchase value of `68.00` is appropriate only when the actual order total is $68; do not hard-code the product price into every purchase. For CAPI, place commerce parameters inside `custom_data`. Also send `event_name`, original `event_time` in Unix **seconds**, `event_id`, `action_source: "website"`, `event_source_url`, and properly prepared `user_data`. Website events require the customer’s browser user agent. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ## 3. Exactly how Pixel/CAPI deduplication works For each action sent through both channels: 1. Send to the **same Pixel/dataset ID**. 2. Use the same event name: browser `"Purchase"` and server `"Purchase"`. 3. Use the exact same unique identifier: - Pixel: `eventID`, in the fourth argument. - CAPI: `event_id`, at the event’s top level—not inside `custom_data`. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ```javascript fbq("track", "Purchase", { value: orderTotal, currency: orderCurrency, content_ids: catalogItemIds, content_type: "product" }, { eventID: sharedPurchaseEventId }); ``` Meta deduplicates matching browser/server events received within **48 hours of the first matching event**. Send both promptly rather than treating that window as a delivery target. Do not rely on which copy wins; make their commerce data agree. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) **Suggested custom ID scheme:** ```text cc:<shop-id>:purchase:<canonical-order-id> ``` Normalize Shopify’s browser and webhook order identifiers into the same representation first. For other actions, generate one unique action ID and pass it to both senders. Operational rules: - Reuse the Purchase ID and original timestamp on retries. - Generate a new ID for a genuinely different action. - Do not generate unrelated browser/server UUIDs. - `order_id`, email, amount, and timestamps alone do **not** implement this event-ID matching method. - Keep your own persistent order/event ledger to suppress duplicate webhook processing and page-reload sends; Meta deduplication is not a replacement for application idempotency. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 4. Prepare customer information before server transmission Normalize supported identifiers **before SHA-256 hashing**. Send the hexadecimal digest, not raw contact information. Avoid double-hashing if an SDK already hashes its inputs. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | Field | Preparation | |---|---| | `em` | Trim surrounding whitespace; lowercase; SHA-256 | | `ph` | Parse with the correct country; include country code; remove punctuation, `+`, and formatting; SHA-256 | | `fn`, `ln` | Lowercase and normalize according to Meta’s name rules; SHA-256 | | `ct` | Lowercase; remove spaces/punctuation as specified; SHA-256 | | `st` | Normalize region; US states use lowercase two-letter codes; SHA-256 | | `zp` | Normalize postal code; US ZIP uses first five digits; SHA-256 | | `country` | Lowercase two-letter country code, such as `us`; SHA-256 | | `external_id` | Stable first-party customer identifier; hashing recommended; use a consistent representation | Follow Meta’s field-specific normalization rather than applying one generic cleanup function to everything. Omit unavailable values instead of hashing empty strings. ([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`. The IP and user agent must describe the customer’s browser—not Shopify’s webhook sender or your server. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) When permitted, preserve `_fbp` and `_fbc` from the customer’s browser and associate them with the checkout/order. Send their values as `fbp` and `fbc`. If constructing `fbc`, use a real observed `fbclid` and Meta’s prescribed format; never fabricate one for organic traffic. Preserve the click ID’s case. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/fbp-and-fbc)) Keep customer identifiers in `user_data`, not product properties, event names, URLs, or general analytics logs. Hashing does not make identifiable customer data anonymous. ([ico.org.uk](https://ico.org.uk/for-organisations/uk-gdpr-guidance-and-resources/data-sharing/anonymisation/pseudonymisation/?utm_source=openai)) ## 5. Concrete Shopify setup: native versus custom ### Which approach should Cedar & Coil use? | Approach | Benefit for this launch | Trade-off | |---|---|---| | **Native Meta sales channel — recommended** | Provides Shopify-managed Pixel/CAPI connectivity with less implementation work | Less control over payloads, triggers, and troubleshooting | | **Custom Pixel + backend CAPI** | Supports bespoke event definitions, routing, consent handling, and auditing | Cedar & Coil owns authentication, deduplication, consent enforcement, retries, monitoring, and updates | Shopify describes custom pixels as an advanced feature and does not provide implementation support for them. For a small DTC store preparing its first campaign, the native integration is the more proportionate starting point. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage)) ### A. Recommended native setup 1. In Shopify, go to **Settings → Sales channels → Shopify App Store**. 2. Install **Facebook & Instagram by Meta**. 3. Connect the appropriate Meta account and business assets. Confirm that Cedar & Coil controls the intended business portfolio, ad account, catalog, and dataset. 4. Finish the channel setup. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 5. Open **Sales channels → Facebook & Instagram → Settings → Data sharing settings**. 6. Enable customer data sharing and connect the intended Pixel. 7. Select the approved sharing level: - **Standard:** browser Pixel. - **Enhanced:** Pixel plus CAPI Purchase and additional customer information. - **Maximum:** Pixel plus CAPI Purchase and Meta’s additional advertising technology. For this implementation, prefer **Maximum only after privacy review and consent testing**; Enhanced also supports the core Pixel+CAPI architecture. Available behavior can vary with installation history. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) 8. Remove competing Meta implementations from theme code, GTM, custom pixels, or other tracking apps. Do not install another Purchase sender alongside the native one. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) **Coverage caveat:** Shopify documents all four requested events in its browser integration, but explicitly describes server-side **Purchase** for Enhanced/Maximum. Verify actual server coverage in Events Manager rather than assuming every funnel event has a CAPI copy. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) ### B. Custom implementation, only if needed Use **Settings → Customer events → Add pixel** for custom browser instrumentation. Configure its privacy permissions before connecting it. Subscribe to Shopify’s supported events rather than scraping checkout pages: ```text product_viewed → ViewContent product_added_to_cart → AddToCart checkout_started → InitiateCheckout checkout_completed → Purchase candidate ``` Shopify documents these standard customer events and the custom-pixel setup path. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?who=publisher&utm_source=openai)) For an explicitly **paid-order** Purchase definition: - Subscribe the backend to Shopify’s `orders/paid` webhook, or the corresponding supported Order Events subscription. - Align browser Purchase with verified payment completion. Deferred/unpaid checkout completion must not automatically become a paid Purchase. - Permit server-only Purchase when the confirmation page never loads. ([shopify.dev](https://shopify.dev/docs/api/admin-graphql/latest/enums/WebhookSubscriptionTopic?utm_source=openai)) Build the backend to: - Verify Shopify’s HMAC against the raw request body. - Persist and enqueue accepted events; acknowledge delivery promptly. - Enforce a unique key on `(shop, event_name, canonical_order_id)`. - Attach the permitted customer/browser context and consent record. - Retry transient delivery failures without changing the event ID or event time. ([shopify.dev](https://shopify.dev/docs/apps/build/webhooks/verify-deliveries)) Persist the browser context against a checkout token before completion where possible, then join it to the order. Current Shopify webhook versions use `checkout_token`; do not build a new join around the removed `checkout_id` field. A webhook containing an email address is not evidence of advertising consent. ([shopify.dev](https://shopify.dev/changelog/posts/removed-checkout-id-from-checkouts-and-orders-webhooks?utm_source=openai)) ### Server-side Purchase request sketch **Custom implementation only—not an addition to native tracking.** This sketch assumes an adapter has already produced a trusted, validated purchase record from Shopify. `purchase.value` and line items must come from Shopify, not an untrusted browser submission. Authentication, consent resolution, queueing, and the persistent delivery ledger are intentionally outside this request function. ```javascript // Node.js server-side only. import { createHash } from "node:crypto"; const sha256 = value => createHash("sha256").update(value, "utf8").digest("hex"); export async function sendPurchase(purchase, context, consent) { // Resolve this from the applicable privacy policy + recorded choices. if (consent.metaAdvertisingAllowed !== true) return { skipped: true }; const eventId = `cc:${purchase.shopId}:purchase:${purchase.canonicalOrderId}`; const userData = {}; const email = purchase.email?.trim().toLowerCase(); if (email) userData.em = [sha256(email)]; // Already validated, country-coded digits; not merely punctuation-stripped. if (purchase.phoneDigits) { userData.ph = [sha256(purchase.phoneDigits)]; } if (context.clientIp) userData.client_ip_address = context.clientIp; userData.client_user_agent = context.clientUserAgent; if (context.fbp) userData.fbp = context.fbp; if (context.fbc) userData.fbc = context.fbc; const payload = { data: [{ event_name: "Purchase", event_time: purchase.occurredAtUnixSeconds, event_id: eventId, action_source: "website", event_source_url: context.sanitizedEventSourceUrl, user_data: userData, custom_data: { value: purchase.value, currency: purchase.currency, content_ids: purchase.items.map(item => item.catalogId), content_type: "product", contents: purchase.items.map(item => ({ id: item.catalogId, quantity: item.quantity, item_price: item.unitPrice })), order_id: purchase.canonicalOrderId } }] }; if (process.env.META_TEST_EVENT_CODE) { payload.test_event_code = process.env.META_TEST_EVENT_CODE; } // Pin a currently supported Graph API version in deployment configuration. const url = new URL( `https://graph.facebook.com/${process.env.META_GRAPH_VERSION}` + `/${process.env.META_PIXEL_ID}/events` ); url.searchParams.set("access_token", process.env.META_CAPI_TOKEN); // Never log this URL: it contains the server-side access token. const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const result = await response.json(); if (!response.ok || result.error) { throw new Error("Meta CAPI request failed; inspect redacted diagnostics"); } return result; } ``` The request uses Meta’s `/events` endpoint and standard server/customer/commerce fields. Keep the token in server-side secret storage; never place it in Shopify theme code, a custom pixel, or browser GTM. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) Validate the complete payload before enqueueing, including matching identifiers, real browser context, currency, numeric value, and original occurrence time. Send promptly: Meta’s website-event acceptance window is seven days, distinct from the 48-hour deduplication window. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 6. Validate end to end before scaling spend ### A. Inspect receipt and payloads In **Meta Events Manager → intended data source → Test Events**, complete the product-view-to-purchase journey. For custom CAPI, add the displayed `test_event_code` at the request’s top level and remove it after testing. Do not assume Test Events is an isolated sandbox: Meta states that test-coded events can still enter measurement and targeting processing. 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 each event, inspect: - Destination dataset and event name. - Browser versus server connection method. - Event ID and timestamp. - Value, currency, catalog IDs, and quantities. - Required identifiers and hashing. - Unexpected customer information in URLs or commerce properties. Meta’s validation tools expose receipt, connection methods, freshness, deduplication, and Event Match Quality. A successful API response alone is not proof that attribution or deduplication is correct. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ### B. Run this acceptance-test matrix | Test | Pass condition | |---|---| | Normal consented purchase | Browser and server Purchase arrive with matching names/IDs; one logical conversion | | Browser Pixel blocked, sharing otherwise permitted | Backend Purchase still arrives | | Confirmation page never loads | Backend Purchase does not depend on that page | | Confirmation page refreshed | No additional logical Purchase | | Webhook replay / API retry | Same ID and original timestamp; no duplicate order processing | | Two separate orders from one customer | Two distinct Purchase IDs | | Discount, quantity change, shipping/tax | Correct final values and item quantities | | Alternate checkout/payment flow | Same order, currency, consent, and deduplication rules | | Consent denied or advertising sharing opted out | Neither path sends disallowed advertising data | | Missing `_fbc` / `_fbp` | No fabricated identifiers; permitted server processing still behaves correctly | Run the relevant cases on desktop, mobile, Safari, and Chrome. Retain a redacted QA sheet containing order ID, event ID, expected amount, actual amount, channel receipt, and deduplication result. ### C. Reconcile and establish monitoring Check **Diagnostics**, event freshness, deduplication details, and **Event Match Quality**. Treat matching quality as an identifier-quality signal—not proof of accurate order counts or incremental advertising impact. Events Manager’s received-event totals may include events before deduplication and policy processing. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) For launch QA, reconcile row-level eligible Shopify orders against the tracking ledger and available Meta diagnostics: - Use the same closed date window, time zone, currency, and Purchase definition. - Identify excluded test, unpaid, canceled, or consent-ineligible orders explicitly. - Calculate totals in a script or spreadsheet, then independently cross-check them. - Do not compare all Shopify orders directly with Meta **ad-attributed** purchases as if they were equivalent. **Approval gate:** no unexplained duplicate purchases, correct commerce values, demonstrated server fallback, passing consent tests, and an assigned owner for failed-delivery alerts. Keep campaigns in draft until approval. ## 7. Consent and compliance note **CAPI is not a consent bypass.** Configure Shopify’s customer-privacy controls or an integrated consent platform so browser and backend transmission follow the same permitted purposes. Shopify’s pixel controls account for required permissions and applicable sale/sharing opt-outs; custom backend enforcement remains your responsibility. Do not substitute email-marketing consent for advertising-tracking permission. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/code?syclid=cn0lf9oklmts738qu3q0&utm_source=openai)) - **UK/EEA visitors:** implement the applicable prior-consent requirements for advertising tracking; UK guidance expressly includes advertising measurement technologies. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/code?syclid=cn0lf9oklmts738qu3q0&utm_source=openai)) - **US visitors:** determine which state laws apply and honor relevant sale/sharing/targeted-advertising opt-outs. Covered California businesses must honor applicable Global Privacy Control signals. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/us-state-privacy-laws/state-privacy-laws-personal-info?utm_source=openai)) - Explain Meta sharing in the privacy notice; minimize collected fields, restrict access, set retention rules, and support applicable deletion requests. Hashed identifiers remain potentially identifiable data. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) Have qualified privacy counsel review Cedar & Coil’s actual markets and configuration. The implementation should improve resilience while preserving customer choices; it should not promise a specific 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 Pixel plus CAPI with deduplication and explains that CAPI captures purchases missed when the confirmation page or browser tracking fails, but it never explicitly ties this to browser privacy limits such as 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 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 sendPurchase sketch includes event_name "Purchase", event_time, event_id, action_source "website", 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 an acceptance matrix requiring matching names/IDs and one logical conversion, and it directs inspection of deduplication details.
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 order-backed on the server via orders/paid, but the guide never states per event where each of ViewContent, AddToCart and InitiateCheckout fires or what its source of truth is, and it says only that native server coverage must be verified.
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 closes with "it should not promise a specific attribution-recovery percentage," says CAPI is not a consent bypass, and covers UK/EEA and US consent constraints.
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 specifies the same event name and the same eventID (Pixel fourth argument) and event_id (CAPI top level) sent to the same 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 ID is derived deterministically as cc:<shop-id>:purchase:<canonical-order-id>, shared by browser and server, with the rule "Reuse the Purchase ID and original timestamp on 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 sketch uses purchase.occurredAtUnixSeconds, the text specifies original event_time in Unix seconds, and retries must not change the event 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 email is trimmed, lowercased and SHA-256 hashed in the code and the Section 4 table, and IP, user agent, fbp and fbc are correctly left 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 decisively recommends the native Facebook & Instagram by Meta channel, with numbered setup steps, and details the custom path only as a fallback.
✓ Attempt 2
Answer · attempt 2 the model's full response$1.18 · 236.2s · 8.3k tok
# Cedar & Coil: Shopify → Meta conversion tracking guide **Status: Draft implementation plan.** No campaign has launched, and no performance data exists. Keep campaigns draft-only until tracking, consent behavior, and launch approval are signed off. **Recommendation:** Start with the native **Facebook & Instagram by Meta** sales channel, using a consent-approved setting that enables both Pixel and Conversions API. Reserve a custom implementation for requirements the native integration cannot meet. ## 1. Recommended architecture: Pixel + Conversions API ```text Shopify storefront / checkout ├─ Consent-permitted browser events → Meta Pixel ─────────┐ └─ Shopify server events → Conversions API (CAPI) ─────────┤ ↓ Same Meta data source Deduplicate overlapping events ``` - **Browser Pixel:** Captures storefront interactions and browser context. - **Server-side CAPI:** Provides another delivery path, particularly for confirmed purchases that should not depend on a confirmation page loading successfully. - **Deduplication:** Allows both paths to describe one action without counting it twice. Meta recommends this redundant architecture. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/best-practices)) Aim to mirror the four funnel events below where supported, with **server-side Purchase coverage as the essential launch requirement**. Browser privacy restrictions can reduce Pixel delivery; Shopify’s server-to-server Purchase delivery is not blocked by browser-based ad blockers. This does not make identity matching or attribution complete. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) **Design requirement for a custom build:** Do not make CAPI Purchase depend solely on JavaScript forwarding a checkout event. Use an authoritative Shopify order/payment event. Shopify explicitly notes that its browser `checkout_completed` event can be lost when the relevant page does not load. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) ## 2. Event tracking plan Use Meta’s exact, case-sensitive standard names—not custom lowercase substitutes. The following is Cedar & Coil’s proposed tracking contract, using Meta’s supported event parameters. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | Meta event | Trigger | Parameters to send | |---|---|---| | **ViewContent** | Arc Clip Lamp product detail viewed | `content_ids`, `content_type: "product"`, `content_name: "Arc Clip Lamp"`, `value` representing the displayed variant price, `currency`; optionally `contents` | | **AddToCart** | Item successfully added—not merely an unsuccessful button click | `content_ids`, `content_type`, `contents` with `id`, `quantity`, `item_price`; `value` for the quantity added; `currency` | | **InitiateCheckout** | Checkout actually starts | Cart `content_ids`, `contents`, `num_items`, current checkout `value`, `currency` | | **Purchase** | Confirmed purchase, once per order | **`value`, `currency`, `content_ids`**, plus `content_type`, `contents`; optionally `order_id` | Meta requires Purchase `value` and `currency`; include `content_ids` as part of this implementation’s contract, even when not using catalog ads. `contents` supports item identifiers, quantities, and prices. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) ### Parameter rules - **Money:** Send numeric amounts in currency units, not formatted strings or cents. For example, `68.00`, not `"$68"` or `6800`. - **Currency:** Send the actual transaction’s ISO currency code. Examples here assume `USD`; verify Shopify’s checkout currency. - **Product identifiers:** Establish one mapping between Shopify variants and the connected Meta catalog’s item IDs. Use those identifiers consistently in `content_ids` and `contents[].id`; do not substitute the product title. - **Revenue definition:** Use the same value on both delivery paths. Document treatment of discounts, shipping, taxes, and duties. Shopify documents its native order-value events as using order total price, including duties, taxes, and discounts; inspect the actual payload rather than assuming merchandise subtotal. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/custom-data)) The Arc Clip Lamp’s supplied price is **$68**. A Purchase value of `68.00` is appropriate only when that is the actual total under the chosen revenue definition—not for every order regardless of quantity or adjustments. For each CAPI website event, also provide: - `event_name` - `event_time`: original occurrence time as Unix **seconds** - `event_id` - `action_source: "website"` - `event_source_url`: the originating page URL, sanitized of personal information and secrets - `user_data`, including the actual browser user agent and permitted matching information Send promptly. Website events older than seven days are rejected; that acceptance limit is separate from the deduplication window. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 3. Exactly how deduplication works Meta identifies overlapping browser/server events using: 1. **The same Pixel/data-source ID** 2. **The same event name**, such as `Purchase` 3. **The same event identifier:** Pixel `eventID` equals CAPI `event_id` 4. Receipt within **48 hours** of the first copy Meta counts one event rather than both. It generally prefers the first received event when their contents do not differ meaningfully; do not rely on the server copy to correct conflicting browser values. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) Browser syntax—the ID belongs in the **fourth argument**, not the event-properties object: ```javascript fbq("track", "Purchase", { value: receipt.value, currency: receipt.currency, content_ids: receipt.contentIds, content_type: "product" }, { eventID: receipt.eventId }); ``` The matching CAPI event must contain: ```javascript { event_name: "Purchase", event_id: receipt.eventId } ``` These placements are Meta’s documented deduplication mechanism. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) **Proposed ID policy:** - Purchase: `cedar-coil:purchase:<canonical-shopify-order-id>`. - Normalize Shopify numeric IDs and GraphQL IDs into the same representation. - Other actions: generate one UUID per occurrence, then share it between delivery paths. - Preserve the same ID and original timestamp on retries. - Maintain a durable “Purchase already sent” record so revisits and webhook retries cannot create new purchases. Matching emails, `fbp`, or a matching `order_id` alone are not substitutes for this explicit event-ID contract. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 4. Prepare customer information before server-side transmission For direct CAPI requests, normalize customer identifiers first, then apply **unsalted SHA-256**, producing hexadecimal hashes. Hash each field separately; omit missing values rather than hashing empty strings. Meta’s Business SDK can perform hashing, so establish which layer owns it and avoid double hashing. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | Field | Preparation | |---|---| | `em` | Trim surrounding whitespace, lowercase, SHA-256 | | `ph` | Normalize to international digits including country code; remove formatting symbols; SHA-256 | | `fn`, `ln` | Lowercase; remove punctuation according to Meta’s rules; SHA-256 | | `ct`, `st`, `zp`, `country` | Apply field-specific normalization, then hash: e.g. lowercase country code, lowercase US state abbreviation, first five digits of US ZIP | | `external_id` | Stable customer identifier; hashing is recommended. Keep its representation consistent across integrations. | Do not apply a generic “lowercase and strip everything” function to every identifier; follow the field-specific rules. ([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 context—not the webhook sender’s IP or your server’s user agent. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) When permitted, capture `_fbp` and `_fbc` and associate them with the checkout for the later server event. If `_fbc` is absent, construct `fbc` only from a genuinely received `fbclid`, following Meta’s format. Do not fabricate click identifiers for organic visitors. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/fbp-and-fbc)) Keep customer identifiers in `user_data`, not product properties, URLs, or general analytics logs. Collect only information needed for the approved purpose. ## 5. Concrete Shopify setup ### Native sales channel versus custom implementation | Approach | What it provides | Trade-off | |---|---|---| | **Native Facebook & Instagram by Meta** | Shopify-supported connection path for Pixel, server Purchase sharing, and catalog integration | Less control over payloads and implementation internals | | **Custom Pixel + CAPI service** | Explicit control over event rules, identifiers, consent enforcement, queues, and reconciliation | Cedar & Coil must maintain code, security, API upgrades, and operational monitoring | Shopify documents the native integration’s Pixel/CAPI capabilities and warns that custom-pixel troubleshooting, compliance, and updates are the merchant’s responsibility. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) **Recommendation for this small DTC store:** Use native first. It serves the stated goal—reliable purchase measurement with manageable implementation risk—without creating an unnecessary server integration to maintain. ### A. Native setup path 1. **Inventory existing tracking.** Check theme code, GTM, Customer events, and other apps. Remove overlapping Meta installations after the replacement is validated; do not leave two independent Purchase senders active. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel)) 2. In Shopify, open **Settings → Sales channels → Shopify App Store**, install **Facebook & Instagram by Meta**, and complete account connection. Connect Cedar & Coil’s intended business assets, ad account, and catalog—not an agency’s unrelated assets. ([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**. Enable customer data sharing and connect the intended Pixel. 4. Select **Maximum** if its sharing behavior is approved by the privacy review. Shopify also documents **Enhanced** as Pixel plus CAPI; **Standard** is browser Pixel only. The available privacy behavior can vary with installation history. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) 5. Record the connected Pixel/data-source ID and verify it in Events Manager. Let the native integration own event generation; do not add the custom code below alongside it. **Coverage caveat:** Shopify explicitly documents server-side **Purchase** delivery. Do not assume every upper-funnel event also has a server copy; inspect each event’s connection method during QA. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) ### B. Custom implementation path, if justified 1. **Browser collection:** Use **Settings → Customer events → Add pixel**, or an app Web Pixel implementation. Configure its privacy requirements. Map Shopify’s events as follows: - `product_viewed` → `ViewContent` - `product_added_to_cart` → `AddToCart` - `checkout_started` → `InitiateCheckout` - `checkout_completed` → browser Purchase candidate Use Shopify’s supported customer-event APIs rather than relying on old checkout-script injection. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage?utm_source=openai)) 2. **Authoritative Purchase:** For a paid-order definition, subscribe to `orders/paid`. Verify the HTTPS webhook’s HMAC against the raw body, persist the event, and process asynchronously. Filter to the intended online-store purchases and prevent duplicate processing. ([shopify.dev](https://shopify.dev/docs/api/webhooks/latest?utm_source=openai)) 3. **Join browser context to the order:** Persist consent state and permitted attribution context against a checkout correlation key. Resolve the order to one canonical event ID. If payment is pending, do not emit an early browser Purchase while treating a later payment as another conversion. 4. **Credentials:** In Meta, use **Events Manager → selected Pixel → Settings → Conversions API → Set up manually → Generate access token**. Keep the token in a server-side secret store. Use the same Pixel ID as the browser implementation. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/get-started)) ### Server-side Purchase request sketch This is **custom-path code only**, not an addition to native tracking. Inputs below are your application’s normalized records—not raw Shopify webhook fields. ```javascript import { createHash } from "node:crypto"; const sha256 = value => createHash("sha256").update(value, "utf8").digest("hex"); export async function sendPurchase(order, context, testEventCode) { // Computed from the applicable privacy policy and recorded choices. if (context.metaSharingAllowed !== true) return { skipped: true }; // Caller has verified Shopify's webhook and claimed a durable outbox job. // order.id is the canonical string also used by the browser. const eventId = `cedar-coil:purchase:${order.id}`; const email = order.email?.trim().toLowerCase(); const userData = { client_user_agent: context.userAgent }; if (email) userData.em = [sha256(email)]; if (order.customerId) { userData.external_id = [ sha256(`cedar-coil:customer:${order.customerId}`) ]; } if (context.clientIp) userData.client_ip_address = context.clientIp; if (context.fbp) userData.fbp = context.fbp; if (context.fbc) userData.fbc = context.fbc; const event = { event_name: "Purchase", event_time: Math.floor(Date.parse(order.purchasedAt) / 1000), event_id: eventId, action_source: "website", event_source_url: context.sanitizedSourceUrl, user_data: userData, custom_data: { value: Number(order.totalAmount), currency: order.currency, content_type: "product", content_ids: order.items.map(item => item.metaCatalogId), contents: order.items.map(item => ({ id: item.metaCatalogId, quantity: item.quantity, item_price: Number(item.unitAmount) })), order_id: order.id } }; // Pin a supported Graph API version in deployment configuration. const endpoint = `https://graph.facebook.com/${process.env.META_GRAPH_VERSION}` + `/${process.env.META_PIXEL_ID}/events`; const body = new URLSearchParams({ access_token: process.env.META_CAPI_TOKEN, data: JSON.stringify([event]) }); if (testEventCode) body.set("test_event_code", testEventCode); const response = await fetch(endpoint, { method: "POST", body }); const result = await response.json(); if (!response.ok || result.error) { // Classify retryable errors; never log tokens or customer payloads. throw new Error(`Meta delivery failed: HTTP ${response.status}`); } return { eventId, result }; } ``` The endpoint, event envelope, and testing parameter follow Meta’s CAPI request format. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) **Before production:** Add schema validation, timeouts, bounded retries, encrypted storage, redacted logs, and a durable delivery ledger. Validate currency, catalog IDs, original timestamp, user agent, URL, and permitted matching information before enqueueing. Retries must reuse the original event ID and timestamp; do not regenerate either. ## 6. Validate end to end before scaling spend ### A. Inspect a complete funnel Run a controlled journey: view Arc Clip Lamp → add to cart → enter checkout → complete an authorized test purchase. - Use **Shopify Pixel Helper** to inspect Shopify customer events and consent status. - Use **Meta Pixel Helper** and browser network inspection for browser delivery. - Use **Events Manager → selected data source → Test Events** for Meta receipt. - For a custom CAPI integration, supply `test_event_code`; remove it from normal production requests. Prefer a dedicated test data source for synthetic testing—do not treat a test code as an isolation boundary. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels?utm_source=openai)) If the native integration does not expose a server test-code setting, validate through its available testing workflow and Events Manager’s server connection details rather than creating an additional sender. ### B. Required test cases | Test | Acceptance criterion | |---|---| | Normal, consent-permitted purchase | Correct value, currency, items, and identifiers | | Browser and server copies arrive | Same Purchase ID and name; one deduplicated conversion | | Browser Meta requests blocked, sharing otherwise permitted | Authoritative server Purchase still arrives | | Confirmation page fails to load | Server Purchase does not depend on that page | | Thank-you page revisited / webhook replayed | No additional logical Purchase | | New order by the same customer | New Purchase ID; not suppressed as a duplicate | | Quantity changes, discount, shipping/tax, alternate currency | Correct actual totals and currency on both paths | | Consent denied, withdrawn, or applicable sharing opt-out | Disallowed browser and server transmissions suppressed | | Accelerated checkout and mobile/Safari | Same trigger, value, and consent rules hold | ### C. Verify quality—not just API success In Events Manager, inspect **connection method, event freshness, event deduplication, Event Match Quality, and diagnostics**. An accepted request is not proof that an event was matched to a person, attributed to an ad, or deduplicated correctly. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) Maintain a QA ledger containing order ID, event ID, occurrence time, permission decision, expected value/currency, and delivery outcome—without unnecessary customer data. Reconcile eligible Shopify orders against unique Purchase events using a script or spreadsheet: - Use the **same closed time window**, timezone, currency, and revenue definition. - Separately classify tests, canceled orders, refunds, non-storefront orders, and privacy-suppressed events. - Investigate every unexplained missing or duplicate order. - Do not expect Ads Manager’s attributed purchases to equal all Shopify orders. **Approval gate:** No unresolved duplicate-Purchase issue, correct monetary values, demonstrated server delivery without browser Pixel delivery, and passing consent tests. This is a proposed QA standard, not a claim that the setup has passed. ## 7. Consent and compliance **CAPI is not a consent bypass.** Configure **Shopify Settings → Customer privacy** and ensure any consent-management platform communicates choices to Shopify. For custom tracking, carry those choices into the server pipeline; a browser banner alone does not govern your webhook worker. Shopify exposes marketing and data-sharing permissions and separate mechanisms for server-side data-sale opt-outs. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings)) Obtain jurisdiction-specific review. For example, UK advertising-related storage/access technologies generally require prior consent; covered California businesses must honor applicable sale/sharing opt-outs, including qualifying Global Privacy Control signals. Do not assume one universal rule applies to every visitor. ([ico.org.uk](https://ico.org.uk/for-organisations/direct-marketing-and-privacy-and-electronic-communications/guidance-on-the-use-of-storage-and-access-technologies/how-do-we-comply-with-the-pecr-rules/?search=iss&utm_source=openai)) Document Meta sharing in the privacy notice, minimize collected fields, restrict access, set retention/deletion procedures, and exclude sensitive information. Hashing identifiers does not remove the need for lawful collection and sharing. **Expected outcome:** A more resilient, auditable measurement system—not complete attribution, guaranteed matching, or a promised attribution-recovery percentage.
Score · attempt 2 the judge's verdict, criterion by criterion11/11 criteria passed
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 server-side CAPI with deduplication and explains that browser privacy restrictions reduce Pixel delivery while server Purchase is not blocked by ad blockers or lost to a failed confirmation page.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and bolds `value`, `currency` and `content_ids` for Purchase.
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 Graph API 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 includes the test row 'Same Purchase ID and name; one deduplicated conversion', plus checking the event deduplication diagnostics.
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).
✓Section 5 uses the `orders/paid` webhook as the authoritative server Purchase, treats browser checkout_completed as only a candidate, and maps Shopify browser events to Meta events. Section 5A notes that native server coverage is documented only for Purchase.
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 'CAPI is not a consent bypass', calls for jurisdiction-specific review of UK and California rules, and ends with 'not complete attribution, guaranteed matching, or a promised attribution-recovery percentage.'
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 states the same event name and the same event ID (Pixel eventID equals CAPI event_id) within 48 hours, with the eventID in the fourth fbq argument and matching event_name and event_id on the CAPI side.
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 a deterministic ID `cedar-coil:purchase:<order id>` shared by browser and server, other events use one UUID per occurrence, and the guide says 'Retries must reuse the original event ID and timestamp'.
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 to `Math.floor(Date.parse(order.purchasedAt)/1000)`, the order's own timestamp in Unix seconds, and the text says to preserve the original timestamp on retries.
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.
✓It specifies normalizing email (trim, lowercase) and SHA-256 hashing, and the code does `order.email?.trim().toLowerCase()` then `sha256`, 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 compares native with custom, recommends 'Use native first' for a small DTC store, and gives numbered steps for settings navigation, data sharing level and verifying the Pixel ID.
✗ Attempt 3
Answer · attempt 3 the model's full response$1.20 · 228.9s · 8.3k tok
# Cedar & Coil: Shopify → Meta conversion tracking guide **Status: draft implementation plan.** No campaigns have launched and no performance data exists. Keep ads unpublished while implementing and testing. **Recommendation:** Start with Shopify’s official **Facebook & Instagram by Meta** sales channel, using browser Pixel plus server-side Conversions API (CAPI). Use a custom integration only if testing reveals a requirement the native integration cannot meet. ## 1. Recommended architecture: Pixel + CAPI ```text Consented storefront activity ── Meta Pixel ──────────┐ ├─ Same Meta data source Shopify order confirmation ── Server-side CAPI ───────┘ Matching event IDs → deduplication ``` The two paths have complementary roles: - **Browser Pixel:** captures product browsing, cart and checkout activity, alongside browser context. - **CAPI:** delivers events from Shopify or your backend. A genuinely server-originated Purchase does not depend on the shopper successfully loading a thank-you page or allowing Meta’s browser script to execute. - **Deduplication:** makes the overlapping browser/server reports represent one action, not two conversions. Meta recommends this redundant setup. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) **Important design distinction:** forwarding a browser JavaScript event through your server is not an independent purchase-confirmation path. Shopify documents that `checkout_completed` can be absent if its page never loads; a custom implementation therefore needs an order-side trigger as well. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) This architecture improves delivery resilience; it does not remove consent requirements or guarantee that every received event can be attributed to an ad. ## 2. Event tracking plan and parameters Use Meta’s exact, case-sensitive standard names—not renamed GA4-style events. The four events below describe the purchase funnel; **Purchase is the primary conversion**, while the others help diagnose where customers stop. Meta supports these events and their commerce parameters. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | Event | Trigger | Parameters to send | |---|---|---| | **ViewContent** | Arc Clip Lamp product detail view | `content_ids`, `content_type: "product"`, `content_name`, numeric `value` for the viewed item, `currency` | | **AddToCart** | Successful cart addition—not merely a button click | `content_ids`, `content_type`, `contents` with item ID and quantity, `value` for the items just added, `currency` | | **InitiateCheckout** | Customer enters checkout | `content_ids`, `contents`, `num_items`, current checkout `value`, `currency` | | **Purchase** | Confirmed purchase, once per order | **`value`, `currency`, `content_ids`**, plus `content_type`, `contents`, `num_items`, and optionally `order_id` | For Shopify custom subscriptions, map `product_viewed`, `product_added_to_cart`, `checkout_started`, and `checkout_completed` to these browser events. The server Purchase requires the separate order-side confirmation described in section 5. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?who=publisher&utm_source=openai)) ### Parameter rules - **`value`:** send a number in major currency units, such as `68.00`, not cents or `"$68"`. - **`currency`:** use the actual transaction currency, such as `"USD"`. - **`content_ids`:** use strings matching the exact item IDs in the connected Meta catalog. Do not assume that an SKU, Shopify product ID, or variant ID matches the catalog’s ID format. - **`contents`:** use objects such as `{id, quantity, item_price}`. - **`content_type`:** use `"product"` when IDs identify catalog items; use `"product_group"` only with the corresponding group IDs. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/custom-data)) The supplied Arc Clip Lamp price is **$68**. That is not automatically every Purchase’s value: quantities, discounts, shipping and taxes can change the order total. For a custom integration, document one value convention—recommended here: final order total after discounts, including shipping, taxes and duties—and apply it identically to both paths. For native tracking, inspect its actual output; Shopify documents an order-total 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_id` - `event_time`: actual occurrence time, Unix **seconds** - `action_source: "website"` - `event_source_url`: appropriate page URL, stripped of sensitive information - `user_data`: permitted matching information, including the shopper’s browser user agent - `custom_data`: the commerce fields above. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 3. Exactly how deduplication works For the same action, both events must reach the **same Pixel/data source** with: 1. The same event name, including capitalization. 2. Exactly matching browser **`eventID`** and server **`event_id`**. 3. Arrival within Meta’s **48-hour deduplication window**. Meta then treats the pair as one event rather than two. It generally prefers the first received equivalent event; do not depend on deduplication to reconcile conflicting values. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) Browser example: ```javascript // purchase is the canonical, backend-confirmed purchase record. // Run only when the applicable privacy checks permit Meta tracking. fbq("track", "Purchase", { value: purchase.value, currency: purchase.currency, content_ids: purchase.contentIds, content_type: "product" }, { eventID: purchase.eventId }); ``` `eventID` belongs in the fourth argument—not inside the commerce parameters. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) **Recommended ID scheme:** - Purchase: `cedar-coil:purchase:<canonical-shopify-order-id>`. - Other events: generate one UUID per action, then share it between the browser and server reports. - Normalize Shopify order IDs consistently; a numeric ID and its GraphQL GID are not identical strings. - Persist the Purchase ID and original timestamp. Reuse both on retries. - Give a second purchase a new ID, even for the same customer. Meta explicitly supports order/transaction identifiers for this purpose. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) Also enforce local idempotency: maintain a durable unique record for `(store, event_name, order_id)`. Shopify webhook redelivery must not create a new conversion. Customer matching fields such as email or `fbp` are not substitutes for this explicit event-ID design. ([shopify.dev](https://shopify.dev/docs/apps/build/webhooks/verify-deliveries?utm_source=openai)) ## 4. Preparing server-side customer information Place matching information in **`user_data`**, not `custom_data`. For a direct HTTP implementation, normalize first, then SHA-256 hash fields requiring hashing. Use the resulting hexadecimal string, without a salt. Do not hash twice; Meta’s Business SDK can perform hashing itself. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | Field | Preparation | |---|---| | `em` — email | Trim surrounding whitespace, lowercase, then hash. | | `ph` — phone | Normalize to a valid international number with country code; digits only, then hash. Do not guess a missing country code. | | `fn`, `ln` — names | Lowercase, remove punctuation, preserve valid UTF-8, then hash. | | `ct` — city | Lowercase, remove spaces and punctuation, then hash. | | `st`, `zp`, `country` | Follow Meta’s field-specific rules: e.g. US state `"ca"`, US ZIP’s first five digits, country `"us"`; then hash. | | `external_id` | Stable first-party customer identifier; hashing is recommended. Keep its representation consistent across channels. | These are matching fields, not a reason to collect additional information the store does not otherwise need. ([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`. Supply the shopper’s actual IP/user agent, not those of Shopify’s webhook sender or your server. Omit unavailable optional fields rather than inventing values. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) Where permitted: - Read `_fbp` and `_fbc` and associate them with the correct checkout. - Pass their values unchanged as `fbp` and `fbc`. - If `_fbc` is unavailable, construct it only from a genuine captured `fbclid`, following Meta’s format. Do not fabricate click IDs for organic visitors. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/fbp-and-fbc/)) ## 5. Shopify setup: native versus custom ### Which approach to choose | Approach | Advantages for this project | Trade-offs | |---|---|---| | **Official Meta sales channel** | Managed Shopify integration, catalog connection, Pixel and server-side Purchase delivery | Less control over payloads and event behavior | | **Custom Pixel + backend CAPI** | Explicit event definitions, IDs, consent enforcement, logging and retry control | You own hosting, security, Shopify compatibility, API maintenance and troubleshooting | Shopify recommends app pixels where they meet the requirement; custom pixels have sandbox limitations and are not supported by Shopify’s support team. **For a small DTC store, the native option best serves reliable tracking without creating unnecessary operational risk.** ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels)) ### A. Recommended native setup 1. **Audit existing tracking.** Inventory theme code, GTM, custom pixels and third-party apps. Remove overlapping Meta implementations during cutover; do not leave a second Purchase sender active. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) 2. **Install the official channel:** Shopify admin → **Settings → Sales channels → Shopify App Store** → **Facebook & Instagram by Meta**. Connect the required business assets and ad account. Confirm Cedar & Coil owns or has appropriate access to them. ([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**. 4. Activate customer data sharing and connect the intended Pixel/data source. 5. Select **Maximum**, subject to privacy approval. Shopify currently documents CAPI Purchase delivery for both **Enhanced** and **Maximum**; **Standard** is browser Pixel only. Available settings can vary with installation history. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) 6. Configure customer privacy settings and run the validation plan below before treating setup as complete. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings)) **Coverage caveat:** Shopify explicitly documents server-side **Purchase** delivery. Do not assume all upper-funnel events also arrive server-side; inspect the connection method for each event in Events Manager. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) Do **not** add the custom request below alongside native Purchase tracking. ### B. Custom implementation path If custom tracking is justified: 1. Add browser code through **Settings → Customer events → Add pixel**, configure its privacy permissions, then save and connect it. Use Shopify’s event APIs rather than relying on legacy checkout scripts. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage)) 2. Build a Shopify app/backend receiving order notifications. For a paid-order Purchase definition, use `orders/paid` or the corresponding Order Events subscription for your API version. Verify webhook HMAC against the **raw request body** before processing. ([shopify.dev](https://shopify.dev/docs/api/webhooks/latest?utm_source=openai)) 3. Make the browser Purchase use that same paid-order definition. Do not fire it for a pending payment while the server waits for payment confirmation. An asynchronously paid order may legitimately have only a server Purchase. 4. Associate consent state and permitted browser context with the checkout/order. Obtain necessary protected-customer-data access for the fields your app uses. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) 5. Persist a canonical purchase record, queue delivery, and use its ID, amount, currency and timestamp for both paths. Add idempotency, bounded retries and reconciliation for missed webhook deliveries. ([shopify.dev](https://shopify.dev/docs/apps/build/webhooks/verify-deliveries?utm_source=openai)) ### Server-side Purchase request sketch This is **custom-route reference code**, not a complete webhook service. Inputs must already be authenticated, schema-validated and mapped from authoritative Shopify data. Keep the token server-side, and pin a supported Graph API version. The request structure follows Meta’s CAPI endpoint and parameter definitions. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ```javascript import { createHash } from "node:crypto"; const sha256 = value => createHash("sha256").update(value, "utf8").digest("hex"); export async function sendPurchase(purchase, customer, context) { // Re-evaluate applicable consent/opt-out policy before dispatch. if (context.metaAdsAllowed !== true) return { skipped: true }; // customer.phoneDigits must already be validated and normalized: // country code + national number, digits only. const userData = { ...(customer.email && { em: [sha256(customer.email.trim().toLowerCase())] }), ...(customer.phoneDigits && { ph: [sha256(customer.phoneDigits)] }), ...(context.customerIp && { client_ip_address: context.customerIp }), client_user_agent: context.customerUserAgent, ...(context.fbp && { fbp: context.fbp }), ...(context.fbc && { fbc: context.fbc }) }; // Validate that userData meets Meta's matching requirements. const event = { event_name: "Purchase", event_id: purchase.eventId, // Same as browser eventID event_time: purchase.occurredAtSeconds, // Original time, not retry time action_source: "website", event_source_url: context.sanitizedEventSourceUrl, user_data: userData, custom_data: { value: purchase.totalAmount, // Number; authoritative order total currency: purchase.currency, // Actual order currency, e.g. USD content_type: "product", content_ids: purchase.items.map(item => item.metaCatalogId), contents: purchase.items.map(item => ({ id: item.metaCatalogId, quantity: item.quantity, item_price: item.unitPrice })), order_id: purchase.orderId } }; const body = { data: [event], ...(process.env.META_TEST_EVENT_CODE && { test_event_code: process.env.META_TEST_EVENT_CODE }) }; const endpoint = `https://graph.facebook.com/${process.env.META_GRAPH_VERSION}` + `/${process.env.META_PIXEL_ID}/events`; const response = await fetch(endpoint, { 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) { // Queue worker should classify transient versus permanent failures. // Do not log the access token or full customer payload. throw new Error(`Meta delivery failed: HTTP ${response.status}`); } return result; } ``` Send promptly. Keep the original timestamp on retries; Meta’s website-event age limit is seven days, distinct from the 48-hour deduplication window. Quarantine stale or ambiguous retries rather than changing their timestamps to make them appear new. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 6. Validate end to end before scaling spend ### Inspect delivery and payloads Open **Events Manager → Data Sources → selected Pixel → Test Events**. For custom CAPI, add the displayed `test_event_code` to the request and remove it after testing. Use a separate test data source for synthetic payloads where practical: Meta warns that `test_event_code` is not an isolation mechanism that automatically excludes events from measurement. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) For each event, inspect: - Event name, source and timestamp. - Browser/server IDs for overlapping events. - Purchase value, currency, item IDs and quantities. - Permitted matching fields and absence of accidental personal data in commerce fields or URLs. Check **Event Deduplication**, **Event Freshness**, **Event Match Quality** and diagnostics. Raw received-event counts can be shown **before** deduplication and policy processing; do not simply add browser and server counts. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ### Required test cases | Test | Acceptance condition | |---|---| | Normal consented purchase | Browser and server Purchase share the same ID; one logical conversion | | Meta browser request blocked, consent otherwise valid | Server Purchase still arrives | | Marketing consent denied or applicable opt-out exercised | Disallowed browser and server tracking are suppressed | | Thank-you page refreshed | No additional logical Purchase | | Webhook redelivered or CAPI retried | Same ID and timestamp; no extra conversion | | Two orders from one customer | Two distinct Purchase IDs | | Quantity change, discount, shipping/tax, supported currency change | Correct order values and catalog IDs | | Failed or abandoned checkout | No Purchase | | Mobile Safari and enabled accelerated checkout paths | Correct event behavior and server confirmation | For native tracking, use its supported testing flow. If test-mode orders are suppressed, investigate that behavior rather than immediately adding another tracker. ### Reconcile before approval Create a QA ledger containing test order ID, expected event ID, expected total/currency, consent state, delivery result and deduplication evidence. For custom tracking, reconcile eligible Shopify orders against your delivery ledger using the **same closed time window and timezone**. Explain exclusions such as test orders, consent suppression, pending payments and non-storefront orders. Separate three questions: 1. Was the event received? 2. Was it matched and deduplicated correctly? 3. Was it attributed to an ad? These are not interchangeable; Events Manager distinguishes received, matched and attributed activity. With no campaigns launched, this work establishes tracking correctness—not campaign performance. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) **Release gate:** controlled tests pass, Purchase amounts and IDs reconcile, unexplained duplicates are resolved, privacy tests pass, and an owner is assigned to monitor delivery failures and diagnostics. ## 7. Consent and compliance **CAPI is not a consent bypass.** Use Shopify’s customer privacy controls or a properly integrated consent platform. In a custom implementation, propagate the applicable permission/opt-out state to the backend and enforce it before dispatch—not only before loading the browser Pixel. Shopify exposes marketing and data-sharing permission signals through its Customer Privacy API. ([shopify.dev](https://shopify.dev/docs/api/customer-privacy?utm_source=openai)) Requirements depend on the business and customer jurisdictions: - UK advertising storage/access technologies require consent, including associated measurement; consent and withdrawal must be respected across the processing chain. ([ico.org.uk](https://ico.org.uk/for-organisations/direct-marketing-and-privacy-and-electronic-communications/guidance-on-the-use-of-storage-and-access-technologies/how-do-the-rules-apply-to-online-advertising/?search=iss&utm_source=openai)) - Where California’s CCPA applies, honor sale/sharing opt-outs and applicable Global Privacy Control signals. Do not assume every US jurisdiction has identical requirements. ([oag.ca.gov](https://oag.ca.gov/privacy/ccpa?stream=top&utm_source=openai)) Disclose Meta sharing, purposes, data categories and customer controls. Minimize collection, restrict access, define retention/deletion procedures, and protect credentials. Hashing identifiers does **not** make them anonymous or remove privacy obligations. Have qualified counsel review the final configuration for the markets Cedar & Coil serves. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings))
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 Pixel plus server-side CAPI with dedup and explains that a server-originated Purchase does not depend on the thank-you page loading or Meta's browser script executing, though it never names Safari 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 explicitly carries 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 sendPurchase sketch includes event_name "Purchase", event_id, event_time, action_source "website" 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, checks the Event Deduplication diagnostic, and has test cases such as a shared ID producing one logical conversion.
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 server source is clear (order-side trigger, orders/paid webhook), but the response doesn't say for each event whether it fires in the browser or on the server and notes that native upper-funnel server delivery must be inspected rather than stated.
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 the architecture doesn't guarantee every event can be attributed, gives no recovery percentages, and states that "CAPI is not a consent bypass" with UK and California constraints.
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 event name and matching browser eventID and server event_id within the 48-hour window, with a browser fbq example that puts eventID in the fourth argument.
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 as cedar-coil:purchase:<order-id>, and the response says to "Persist the Purchase ID and original timestamp. Reuse both on retries" and to enforce idempotency on webhook redelivery.
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.
✓event_time is the actual occurrence time in Unix seconds, the code uses purchase.occurredAtSeconds with the comment "Original time, not retry time", and the text says to keep the original timestamp on retries.
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 email is trimmed, lowercased and SHA-256 hashed (sha256(customer.email.trim().toLowerCase())), and the table gives normalization rules for the other fields and says not to hash 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).
✓It decisively recommends the native Facebook & Instagram by Meta channel for a small DTC store and gives numbered setup steps through Settings, Data sharing and the Maximum level, with the custom path as a fallback.