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

Answers & verdicts

GPT-6.2 Sol 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$0.23 · 94.1s · 5.9k tok
# Cedar & Coil: Shopify → Meta conversion tracking guide *Draft implementation plan for the Arc Clip Lamp campaign. Keep ads in draft while validating tracking.* ## 1. Recommended architecture: Meta Pixel + Conversions API Use **one Meta web dataset** for both the browser Pixel and the server-side Conversions API (CAPI). The Pixel sees storefront activity as it happens, including product views and cart additions, and can supply browser and ad-click context when available. CAPI gives eligible purchases a second delivery path from Shopify’s order system, even when a browser blocks the Pixel or the shopper never loads the confirmation page. When both paths report the same action, Meta should count it once. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) Prioritize **`Purchase` as the conversion for ad optimization**; use the other three events to diagnose where shoppers drop out. A server event being received does not mean Meta matched it to a person or attributed it to an ad. Keep Shopify as the source of truth for orders and revenue. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ## 2. Standard events and parameters Use Meta’s exact event names. The table is the target event contract for a custom build and a QA checklist for the native integration. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | Meta event | Shopify trigger | Key parameters | |---|---|---| | `ViewContent` | `product_viewed` on the Arc Clip Lamp product page | `content_ids` for the viewed item, `content_type`, numeric `value` for the displayed unit price, and `currency`. | | `AddToCart` | `product_added_to_cart` after a successful cart addition, not merely a button click | `content_ids`, `content_type`, `contents` with item ID and quantity added, `value` for the units added—not the whole cart—and `currency`. | | `InitiateCheckout` | `checkout_started` when the shopper enters checkout | `content_ids` and `contents` for checkout line items, `num_items` as total units, checkout `value` at that point, and `currency`. | | `Purchase` | A successfully completed online order, once per Shopify order | **`value`** from the final Shopify order total, **`currency`** from that same amount, and **`content_ids`** for the purchased items. Include `content_type`; `contents` can add quantities and unit prices. | Send `value` as a number in major currency units and `currency` as a three-letter code such as `USD`. Don’t hard-code the Arc Clip Lamp’s $68 list price into `Purchase`: use the actual order total after discounts, with the same tax, duty, and shipping treatment in both streams. If the shopper checked out in a different currency from the shop default, use the amount and currency they checked out in. Read `content_ids` from the actual Meta catalog mapping: use `product` for item-level IDs or `product_group` for group IDs. Don’t assume the SKU or raw Shopify variant ID is what the catalog uses. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) ## 3. Exactly how deduplication works Meta pairs the two copies when they reach the **same Pixel/dataset**, the browser event name exactly matches CAPI’s `event_name`, and the browser’s **`eventID`** exactly matches CAPI’s **`event_id`**. The two copies must arrive within **48 hours** of each other. Meta generally keeps the first equivalent copy; its server-event reference says it favors the browser copy when both arrive within about five minutes. Send consistent values and item IDs on both paths rather than assuming the server copy will win. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/get-started)) For a custom build, derive `Purchase` IDs from the canonical Shopify order ID. For example, normalize `gid://shopify/Order/123456789` and `123456789` to the same key, then use `purchase_123456789` on both paths and on every retry. The browser call is `fbq('track', 'Purchase', purchaseData, { eventID: purchaseId })`; the server puts `purchaseId` at the top level of the event as `event_id`. For other events sent twice, generate a new ID **per action** and pass it to both senders. Don’t use a customer or session ID as an event ID, or rely on browser cookies to deduplicate. Prevent repeat sends in your own integration too. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 4. Prepare customer information before sending it server-side - **Normalize, then hash once.** For a direct HTTP request, send unsalted SHA-256 hex digests in `user_data`. Trim and lowercase email (`em`). For phone (`ph`), parse with the correct country code and send digits only before hashing—no `+`, punctuation, or domestic trunk prefix. Follow Meta’s field-specific rules if sending names or location fields. Omit missing or invalid values; don’t hash empty strings. If an SDK already hashes a field, don’t hash it again. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) - **Do not hash browser and network fields.** Pass genuine `_fbp` and `_fbc` cookie values as `fbp` and `fbc`, when permitted and available. If there’s no `_fbc`, construct `fbc` only from a real `fbclid` using Meta’s format; don’t invent an identifier. For website CAPI events, use the shopper’s actual `client_user_agent` and the event’s website URL. If sending `client_ip_address`, use the shopper’s IP—not Shopify’s webhook sender or your worker’s IP. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ## 5. Shopify setup: use the native channel first **Recommended for Cedar & Coil: Facebook & Instagram by Meta.** The native channel handles browser integration, catalog sync, and the server-side Purchase path without a webhook service to maintain. Custom is worth considering only if testing exposes a specific gap or the store needs control over order eligibility, event payloads, or delivery logs. Shopify documents server-side **Purchase** for its CAPI-enabled levels; don’t assume the native channel also sends all three upper-funnel events server-side. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) **Native setup** 1. In Shopify, go to **Settings → Sales channels → Shopify App Store** and install **Facebook & Instagram by Meta**. Connect Cedar & Coil’s Meta business portfolio, Page, ad account, and intended web dataset/Pixel. If using the catalog, confirm the Arc Clip Lamp variant synced to the intended catalog. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 2. Go to **Sales channels → Facebook & Instagram → Settings → Data sharing settings** (also labeled **Share data settings**). Enable customer data sharing, connect the intended Pixel, and confirm. **Standard is browser-only. Enhanced and Maximum are documented to add CAPI for Purchase**, with options varying by installation. Choose Enhanced if available and privacy-approved; use Maximum only if its data-sharing scope is approved. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) 3. Audit **Settings → Customer events**, theme code, GTM, and other tracking apps. Disable any overlapping Meta Pixel or CAPI sender as part of the cutover. Don’t paste the custom example below on top of the native integration. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) **Custom alternative** Use a **Shopify Customer Events pixel** for the browser events and an authenticated Shopify `orders/create` webhook for the server copy of a successfully placed online order. If your business defines `Purchase` as **paid**, use `orders/paid` and don’t fire browser `Purchase` on a still-pending order. Verify webhook HMAC against the raw body, filter to eligible online-store orders, and queue one job per order with a persistent uniqueness key. Join the webhook to permitted consent and browser context captured before confirmation; the server path should not depend on a thank-you-page beacon. Request only the Shopify data access you need. ([shopify.dev](https://shopify.dev/docs/apps/build/marketing/pixels?utm_source=openai)) **Server-side Purchase request sketch (Node.js).** Generate the token in **Meta Events Manager → your dataset → Settings → Conversions API → Set up manually**. This worker takes validated Shopify order data and permitted shopper context; it is not the webhook handler. Set a supported Graph API version in `META_GRAPH_VERSION` and keep the token in a server secret store. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/get-started)) ```js import { createHash } from 'node:crypto'; const sha256 = (s) => createHash('sha256').update(s, 'utf8').digest('hex'); async function sendPurchase(order, buyer, mayShare, testCode) { if (!mayShare) return; // Server policy decision, checked at dispatch. if (!buyer.userAgent || !buyer.safeEventUrl) { throw new Error('Missing required website event context'); } const email = buyer.email?.trim().toLowerCase(); const phone = buyer.validatedE164Phone?.replace(/^\+/, ''); const event = { event_name: 'Purchase', event_id: `purchase_${order.canonicalId}`, // Same ID as Pixel and retries. event_time: Math.floor(Date.parse(order.occurredAt) / 1000), action_source: 'website', event_source_url: buyer.safeEventUrl, user_data: { client_user_agent: buyer.userAgent, ...(email && { em: [sha256(email)] }), ...(phone && { ph: [sha256(phone)] }), ...(buyer.ip && { client_ip_address: buyer.ip }), ...(buyer.fbp && { fbp: buyer.fbp }), ...(buyer.fbc && { fbc: buyer.fbc }), }, custom_data: { value: order.total, // Number, in checkout currency. currency: order.currency, content_ids: order.catalogItemIds, content_type: 'product', }, }; const { META_GRAPH_VERSION, META_PIXEL_ID, META_CAPI_TOKEN } = process.env; const url = `https://graph.facebook.com/${META_GRAPH_VERSION}/${META_PIXEL_ID}/events`; const form = new URLSearchParams({ access_token: META_CAPI_TOKEN, data: JSON.stringify([event]), }); if (testCode) form.set('test_event_code', testCode); const res = await fetch(url, { method: 'POST', body: form }); const result = await res.json(); if (!res.ok || result.events_received !== 1) { throw new Error(`CAPI send failed: HTTP ${res.status}, trace ${result.fbtrace_id ?? 'n/a'}`); } return { traceId: result.fbtrace_id }; } ``` Use the original order-event timestamp, not the retry time. Retry transient failures with backoff and the same event ID; alert on persistent failures rather than blindly replaying old orders past the deduplication window. Don’t log the token or customer payload. An API acknowledgment confirms receipt, not deduplication or attribution. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 6. Validate end to end before scaling spend 1. **Run the funnel on desktop and mobile.** In **Events Manager → Data Sources → your dataset → Test Events**, open the store and run product view → add to cart → checkout → purchase. Use Meta Pixel Helper for browser checks. Test a discounted order and multiple quantities; compare value, currency, and catalog IDs against the Shopify order and catalog. For custom CAPI, pass the top-level `test_event_code` only during testing. Meta says test-coded events can still be used for measurement, so use a separate test dataset where practical. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) 2. **Prove deduplication and the fallback separately.** In a normal permitted session, confirm Browser and Server report the same `Purchase` name and ID, and check **Overview → Purchase → Event Details → Event Deduplication**. Refresh the confirmation page and, for custom, replay the webhook: neither should create another logical purchase. Then run a separate permitted checkout with the Meta browser request blocked. Verify that its server `Purchase` still arrives. Test refusal and applicable opt-outs separately; those should suppress sends as required, not trigger the fallback. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) 3. **Reconcile before spending.** Keep an order-level QA sheet with expected sends, event ID where visible, source, value, currency, and outcome. Review Diagnostics, Event Match Quality, and freshness. Reconcile eligible Shopify orders against your test observations or custom delivery ledger over the same closed time window and time zone. Don’t compare all Shopify orders with Ads Manager’s attributed purchases or treat raw Browser + Server receipts as unique orders. When the checks pass, select the verified dataset and `Purchase` in the draft ad set. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ## 7. Consent and compliance CAPI is a second delivery path, **not a way around consent or opt-outs**. In **Shopify → Settings → Customer privacy**, configure the banner and data-sharing opt-out for the markets you serve. If you use a third-party consent tool, integrate it with Shopify’s Customer Privacy API. Verify that both browser and server honor the applicable choices, including Global Privacy Control where required. For a custom sender, suppress marketing events when required permission is denied or unknown; neither a paid order nor an email marketing opt-in grants permission to share the order with Meta. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai)) Disclose Meta sharing and its purposes in the privacy notice. Minimize the fields sent, keep personal data and checkout secrets out of URLs and logs, and set retention and deletion procedures. **Hashed identifiers are not anonymous.** Have the privacy owner approve the data-sharing level and regional rules before enabling production sends. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai))
Score · attempt 1 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 Pixel plus CAPI on one dataset with deduplication, and explains that CAPI delivers purchases "even when a browser blocks the Pixel or the shopper never loads the 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 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.js sketch builds an event with event_name 'Purchase', event_id, event_time, action_source 'website' and a user_data block, and 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 and test_event_code, and checks Event Details → Event Deduplication, page refresh and webhook replay for duplicate counting.
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).
✓The table gives Shopify triggers (product_viewed, product_added_to_cart, checkout_started) for the browser Customer Events pixel, and Purchase comes from the orders/create webhook with Shopify as source of truth and "not depend on a thank-you-page beacon".
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 guide gives no attribution recovery percentages, says "An API acknowledgment confirms receipt, not deduplication or attribution", and section 7 says CAPI is "not a way around consent or opt-outs".
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 browser event name must match CAPI event_name and browser eventID must match CAPI event_id, within 48 hours, with the fbq call and the server top-level event_id shown.
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 Shopify order ID as `purchase_123456789` "on both paths and on every retry", and the code uses `purchase_${order.canonicalId}`.
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 `Math.floor(Date.parse(order.occurredAt) / 1000)` and the text says "Use the original order-event timestamp, not the 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.
✓Email is trimmed and lowercased, phone is normalized to digits only, both are SHA-256 hashed before going into user_data, and fbp, fbc and IP are 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 recommends the native Facebook & Instagram by Meta channel for Cedar & Coil, gives numbered setup steps with menu paths, and treats custom as a fallback with its own steps.
✓ Attempt 2
Answer · attempt 2 the model's full response$0.24 · 106.9s · 6.1k tok
# Cedar & Coil: Shopify → Meta conversion tracking *Draft implementation guide for the Arc Clip Lamp. Keep campaigns in draft during setup and QA.* ## 1. Recommended architecture: Meta Pixel + Conversions API Use **Shopify’s Facebook & Instagram by Meta sales channel** to connect one Meta Pixel and its associated Events Manager dataset. Send browser events through the **Meta Pixel** and eligible purchases through the server-side **Conversions API (CAPI)**. When both report the same purchase, Meta should count it once. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) The Pixel captures the storefront funnel and browser context when it can run. CAPI gives a confirmed Shopify purchase a separate delivery path when the browser blocks the Pixel, the shopper closes the tab, or the confirmation page fails to load. That resilience is strongest when the server event comes from the order itself, not from a browser request forwarded through a server. **Delivery is not attribution:** Meta can receive a purchase without being able to match it to a person or credit it to an ad. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/best-practices)) ## 2. Standard events and parameters Use `Purchase` as the primary conversion for the draft sales campaign. Use the other three events to diagnose where shoppers drop out. The Shopify event names below are the triggers to subscribe to **if building a custom integration**; the native channel supplies its own mappings. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | Meta event | Fire when | Key parameters | |---|---|---| | `ViewContent` | The Arc Clip Lamp product detail page is viewed (`product_viewed`). | `content_ids` for the viewed item, `content_type`, displayed unit `value`, `currency`. | | `AddToCart` | Shopify confirms an item was added (`product_added_to_cart`), not merely when the button is clicked. | `content_ids`, `content_type`, `contents` with item ID and quantity added, `value` of the items just added, `currency`. | | `InitiateCheckout` | The shopper enters checkout (`checkout_started`), including through express checkout where supported. | `content_ids`, `contents`, `num_items` as total units, current checkout `value`, `currency`. | | `Purchase` | Once per successful online order. For custom tracking, pair browser `checkout_completed` with server `orders/paid` for immediately paid orders; for pending payments, wait for server confirmation. | **`value`, `currency`, `content_ids`**, plus `content_type`, `contents`, and `num_items`. Use the final Shopify order total and the currency the buyer paid in. | Use numeric values such as `68.00`, not strings such as `"$68"`, and three-letter currencies such as `USD`. **The lamp’s $68 list price is not a hard-coded Purchase value.** Reconcile against Shopify’s order total after discounts, with shipping, tax, and duties reflected as applicable. Use the same value definition on both paths. Send `content_ids` as strings that exactly match the item IDs in Meta’s catalog—not the product title or an assumed SKU. Use `content_type: "product"` for individual catalog items and `"product_group"` only for catalog group IDs. If you send `contents`, use matching IDs there too. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/custom-data)) ## 3. How deduplication works For the **same customer action**, send both copies to the **same Pixel/dataset** with exactly the same event name and ID. The browser sets `eventID` in the fourth argument to `fbq`; the server sets `event_id` at the top level of the event object, not inside `custom_data`. For example, the browser sends `fbq('track', 'Purchase', purchaseData, { eventID: 'purchase:cedar-coil:12345' })` and CAPI sends `event_name: "Purchase"` with `event_id: "purchase:cedar-coil:12345"`. Meta deduplicates matching copies received within **48 hours**. It generally considers the first copy and documents a browser preference when the two arrive within about **five minutes**. If only one arrives, there is nothing to deduplicate. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) For custom tracking, derive the Purchase ID from a canonical Shopify order ID, not the customer ID, cart ID, displayed order number, or webhook delivery ID. Normalize the Shopify ID to the same string on both paths. If you mirror an upper-funnel event, generate one ID for that occurrence and pass it to both senders; a second add-to-cart action needs a new ID. Prevent repeated browser fires and handle webhook retries in your own code rather than treating cross-channel deduplication as an idempotency system. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 4. Prepare customer information before sending it - **Normalize, then hash in `user_data`.** Trim and lowercase email (`em`). Parse phone (`ph`) with the correct country code and send digits only before hashing. If you use name or location fields, follow Meta’s field-specific rules—for example, lowercase names without punctuation and lowercase two-letter country codes. For a direct HTTP request, hash these fields **once** with unsalted SHA-256 and send the hex digest. Check whether your SDK already hashes them. If you send a stable first-party `external_id`, Meta recommends hashing it and using the same representation across channels. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) - **Do not hash** `fbp`, `fbc`, `client_ip_address`, or `client_user_agent`. Use the shopper’s actual browser context, not the webhook sender’s IP or your worker’s user agent. For website events, Meta requires the browser user agent and `event_source_url`. Use genuine `_fbp` and `_fbc` values when available and permitted; derive `fbc` only from a real `fbclid` using Meta’s format. Omit unavailable optional fields rather than inventing identifiers. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) - **Keep personal data out of commerce parameters.** Use an event URL with personal data and checkout secrets removed. Don’t put contact details, payment data, or order notes in `custom_data`, URLs, or logs. Use only the matching fields you need and are permitted to send. ([supremecourt.gov](https://www.supremecourt.gov/DocketPDF/25/25-459/415386/20260630145620820_2026-06-30%20No.%2025-459%20Meta%20Amicus%20brief%20in%20Salazar%20v.%20Paramount%20Global.pdf?utm_source=openai)) ## 5. Shopify setup: native channel vs. custom **Recommended for Cedar & Coil: use the native channel.** For a small store selling one product, the native integration provides the standard funnel, catalog connection, and server-side Purchase path without a custom webhook service to maintain. The trade-off is less control over triggers and payloads. Go custom only if testing reveals a concrete requirement the channel cannot meet, such as a different purchase qualification rule or a headless checkout flow. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) **Native setup** 1. In Shopify admin, go to **Settings → Sales channels → Shopify App Store** and add **Facebook & Instagram by Meta**. Connect Cedar & Coil’s Meta business portfolio, Page, ad account, and catalog as prompted. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 2. Go to **Sales channels → Facebook & Instagram → Settings → Data sharing settings** (also labeled **Share data settings**). Enable customer data sharing at the approved level and connect the intended Pixel. Shopify currently documents **Standard** as browser-only and both **Enhanced** and **Maximum** as supporting server-side Purchase, with behavior varying by installation. Use the lowest approved level that you verify sends both Browser and Server Purchase on this store. Don’t assume all four funnel events are sent server-side. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) 3. Make the native channel the sole owner of these Meta events. Audit **Settings → Customer events**, theme code, GTM, and other apps for duplicate Meta senders. Remove or disable overlapping tags and CAPI feeds. Use the same dataset in the draft ad set. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) **Custom alternative** Use a Shopify Web Pixel under **Settings → Customer events** or an app pixel extension for browser events. Use a Shopify app backend with an `orders/paid` subscription for server Purchase. Verify the HTTPS webhook signature against the raw body, enqueue durably, and enforce one Purchase job per shop and order. Join the paid order to a trusted checkout consent record and permitted browser context; don’t depend on the Meta Pixel having fired. Confirm the app has the order and protected-customer-data access it needs. Generate the CAPI token in **Events Manager → dataset → Settings → Conversions API → Set up manually** and store it server-side. Do not run this sender alongside native Purchase tracking. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage?utm_source=openai)) **Server-side Purchase request sketch (Node.js; custom path only).** The worker supplies a verified, eligible paid web order and validated inputs. `paidAt` is the actual payment time, `orderId` is the same canonical string used by the browser, and `contents` contains catalog IDs and quantities. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ```javascript import { createHash } from "node:crypto"; const sha256 = s => createHash("sha256").update(s, "utf8").digest("hex"); async function sendPurchase(order, ctx, testEventCode) { // Derived from the server's checkout consent record, not the webhook alone. if (ctx.adsAllowed !== true) return { skipped: "privacy" }; const email = ctx.email?.trim().toLowerCase(); const phone = ctx.phoneE164?.slice(1); // Validated E.164 upstream; remove "+" const user_data = { client_user_agent: ctx.userAgent, ...(ctx.ip && { client_ip_address: ctx.ip }), ...(ctx.fbp && { fbp: ctx.fbp }), ...(ctx.fbc && { fbc: ctx.fbc }), ...(email && { em: [sha256(email)] }), ...(phone && { ph: [sha256(phone)] }), }; const event = { event_name: "Purchase", event_id: `purchase:cedar-coil:${order.orderId}`, event_time: Math.floor(Date.parse(order.paidAt) / 1000), action_source: "website", event_source_url: ctx.safeEventUrl, user_data, custom_data: { value: order.total, // Numeric, in the buyer's order currency currency: order.currency, // Example: "USD" content_type: "product", content_ids: [...new Set(order.contents.map(item => item.id))], contents: order.contents, // [{ id: catalogItemId, quantity: 1 }] num_items: order.contents.reduce((n, item) => n + item.quantity, 0), }, }; const { META_GRAPH_VERSION, META_PIXEL_ID, META_CAPI_TOKEN } = process.env; const url = new URL( `https://graph.facebook.com/${META_GRAPH_VERSION}/${META_PIXEL_ID}/events` ); url.searchParams.set("access_token", META_CAPI_TOKEN); const res = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ data: [event], ...(testEventCode && { test_event_code: testEventCode }), }), signal: AbortSignal.timeout(8000), }); const result = await res.json(); return { accepted: res.ok && result.events_received === 1, status: res.status, metaErrorCode: result.error?.code, traceId: result.fbtrace_id ?? result.error?.fbtrace_id, }; } ``` Pin a supported Graph API version. Validate required fields before sending; route rejects to review, retry transient failures promptly with the **same ID and event time**, and do not blindly replay old jobs. Redact the token-bearing URL and payload from logs. An accepted API response confirms receipt, not deduplication or attribution. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ## 6. Validate end to end before scaling spend 1. **Run the funnel in a test environment.** Open **Meta Events Manager → Data Sources → your dataset → Test Events**. Use a test dataset where practical. For custom CAPI, add the `test_event_code` at the request’s top level and remove it for production; the code surfaces test activity but does **not** isolate it from measurement. Use Shopify’s test gateway or test mode on a non-production store. Check browser calls in DevTools or Meta Ads Data Advisor, formerly Meta Pixel Helper. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) 2. **Prove delivery and counting separately.** With ads sharing allowed, view the lamp, add it, start checkout, and pay. Confirm the four events, the correct dataset, and the actual order total, currency, catalog IDs, and quantities. Verify one Browser and one Server Purchase with the same event ID where visible, and confirm that Meta deduplicates the pair. For the native channel, check **Purchase → Event Details → Event Deduplication** if the server copy isn’t visible in Test Events. The Overview receipt count is **before** deduplication. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/best-practices)) 3. **Test the failure cases.** Block the Meta browser request while leaving ads sharing allowed: an eligible paid order should still produce one server Purchase. Decline consent where opt-in is required, and separately test applicable opt-outs: confirm the disallowed events aren’t sent on either path. Revisit the confirmation page, replay a custom webhook, and test a failed payment; none should create an extra Purchase. Repeat on mobile Safari and any enabled express checkout, and test a discount or alternate currency if offered. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) 4. **Set the spend gate.** Resolve unexplained duplicates, missing server purchases, wrong amounts, and consent failures before scaling. Check **Diagnostics**, **Event Deduplication**, **Event Freshness**, and **Event Match Quality**. Reconcile test orders individually, then monitor eligible paid online orders and purchase value over the same closed window, by currency. Use Shopify as the order ledger: Meta Ads Manager’s attributed purchases are not expected to equal all Shopify orders. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ## 7. Consent and compliance Configure **Shopify → Settings → Customer privacy** or a consent platform integrated with Shopify’s Customer Privacy API. Apply the same advertising permission rules to Pixel and CAPI: wait for opt-in where required, honor applicable sale/sharing and targeted-advertising opt-outs, including Global Privacy Control where applicable, and recheck suppression before sending queued events. Checkout completion or email/SMS marketing permission is not consent to share data with Meta for advertising. **CAPI is a second delivery path, not a consent bypass, and hashing does not make customer information anonymous.** Update the store’s privacy notice to explain Meta sharing, minimize retention and access, and have the configuration reviewed for the markets Cedar & Coil serves. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai))
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 Pixel plus CAPI and explains that CAPI gives a purchase a second delivery path when the browser blocks the Pixel, the shopper closes the tab, or the confirmation page fails to load.
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 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 "Purchase", event_id, event_time, 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 checks for one Browser and one Server Purchase with the same event ID, confirming deduplication via Event Details → Event Deduplication.
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).
✓The table gives a trigger for each event, using Shopify browser customer events for the funnel events and pairing browser checkout_completed with server orders/paid for Purchase; the server copy is said to come from the order itself. The browser-versus-server split for the three upper-funnel events is left implicit, so this is borderline.
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 guide gives no attribution-recovery percentages and says "Delivery is not attribution"; Section 7 says CAPI is not a consent bypass and that regional opt-in and opt-out rules constrain 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 specifies the same event name and ID on both paths, eventID in the fbq fourth argument versus top-level event_id on the server, the same dataset, and gives the matching purchase:cedar-coil:12345 example.
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 Shopify order ID (`purchase:cedar-coil:${order.orderId}`), not a random value, and retries use "the same ID and event 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.
✓event_time is Math.floor(Date.parse(order.paidAt)/1000), the payment time in Unix seconds, and the guide says to retry with the same ID and 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.
✓Email is trimmed, lowercased and SHA-256 hashed, phone is normalized to digits before hashing, and fbp, fbc, IP and user agent 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 states "Recommended for Cedar & Coil: use the native channel" with numbered Shopify admin steps, and describes the custom path as an alternative only if testing shows a concrete requirement the channel cannot meet.
✗ Attempt 3
Answer · attempt 3 the model's full response$0.23 · 93.4s · 5.6k tok
# Cedar & Coil: Shopify → Meta conversion tracking **Draft implementation guide · November 18, 2026** **Recommendation:** Use Shopify’s **Facebook & Instagram by Meta** sales channel as the only Meta tracking integration. Select **Maximum** data sharing if it fits Cedar & Coil’s approved privacy configuration. Validate that one eligible Arc Clip Lamp order produces one counted `Purchase` before using that event to optimize ads. Keep campaigns in draft during testing. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) ## 1. Recommended architecture: Meta Pixel + Conversions API Send browser and server events to the **same Meta Pixel/dataset**. The **Meta Pixel** captures storefront interactions and available browser context, such as product views and cart additions. **Conversions API (CAPI)** gives Shopify a separate server-to-server path for purchases, so a browser blocking the Pixel or failing to load the confirmation page doesn’t necessarily lose the purchase event. When both paths report the same action, deduplication prevents double-counting. CAPI improves delivery reliability; it doesn’t recreate missing click IDs, guarantee attribution, or override consent. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 2. Standard events and parameters Use Meta’s exact event names. Treat `Purchase` as the primary conversion; use the other three to diagnose where shoppers drop out. This table is the payload specification for a custom build and the checklist for auditing the native channel. Shopify documents server-side `Purchase` for the native integration; don’t assume every upper-funnel event also arrives from the server. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | Meta event | When to send | Key parameters | |---|---|---| | `ViewContent` | Arc Clip Lamp product detail view (`product_viewed`), not every page view | `content_ids` for the viewed item, `content_type`, displayed unit `value`, `currency` | | `AddToCart` | Successful addition (`product_added_to_cart`), not a button click that could fail | `content_ids`, `content_type`, `contents` with item ID and quantity added, `value` for the items added rather than the entire cart, `currency` | | `InitiateCheckout` | Shopper enters checkout (`checkout_started`) | `content_ids`, `contents`, `num_items` as the sum of quantities, current checkout `value`, `currency` | | `Purchase` | Once per eligible Shopify online order. For a custom build that counts paid orders, use a confirmed paid order—not a payment-button click or page reload. | **Numeric `value`, ISO 4217 `currency`, and `content_ids`** for the purchased items. Also send `content_type` and `contents` with item IDs and quantities. | Use the exact item IDs in the connected Meta catalog, not the product title or a Shopify ID you assume matches. Use `content_type: "product"` for item-level IDs, or `"product_group"` if you intentionally send group IDs. For `Purchase`, use the Shopify order total at conversion and its corresponding customer-facing currency. Use the same value definition on both paths. **$68 is the lamp’s list price, not a hardcoded purchase value**: discounts, quantities, taxes, and shipping can change the order total. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/custom-data)) ## 3. Exactly how deduplication works Meta matches three things: **the destination Pixel ID, the exact event name, and the exact event ID**. In the browser, pass `eventID` in the fourth argument to `fbq`. On the server, pass the identical string as top-level `event_id` on the event object, alongside `event_name`. Both copies must reach the same Pixel within **48 hours of the first receipt** to qualify. Meta counts one event, generally preferring the first arrival; its server-event reference notes a browser preference when the copies arrive within about five minutes. Matching order value, email, or `custom_data.order_id` is not a substitute for this event-ID setup. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) For a custom build, derive the purchase ID from a canonical Shopify order ID, for example `purchase:cedar-coil:1234567890`. Normalize the ID to the same string on both sides; don’t use a GraphQL ID on one side and a bare number on the other. For a mirrored funnel event, generate one ID per action and pass it to both senders. Keep the same ID and original timestamp on retries. Separately, make the server queue idempotent by shop and order ID: Meta deduplication is not a replacement for handling duplicate Shopify deliveries. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event/)) ## 4. Prepare customer information before sending it - **Normalize, then hash.** For `user_data.em`, trim and lowercase the email. For `user_data.ph`, parse a valid international number, keep its country code, and remove the `+`, punctuation, and spacing. Hash the normalized values once with unsalted SHA-256 and send the hex digests. If approved and needed, follow Meta’s field-specific normalization and hashing rules for names and location fields. Omit missing or invalid fields; don’t hash empty strings or hash an SDK’s output again. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) - **Don’t hash browser context.** Where permitted and available, send `_fbp` as `fbp`, `_fbc` as `fbc`, and the shopper’s actual IP and user agent as `client_ip_address` and `client_user_agent`. If `_fbc` is missing, construct `fbc` only from a genuine `fbclid` using Meta’s format. Don’t fabricate click IDs or use Shopify’s webhook IP or user agent as the shopper’s. Meta requires the actual client user agent and source URL for website events. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) - Put match fields in `user_data`, not `custom_data`. Keep personal data and checkout secrets out of URLs, payload logs, and error messages. Hashing is not anonymization and doesn’t make an otherwise disallowed transfer permissible. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ## 5. Shopify setup: native vs. custom **Native — recommended for Cedar & Coil.** It gives a small DTC team browser tracking, a server-side purchase path, and catalog integration without owning a webhook service, retry queue, or Meta API credentials. The trade-off is less control over event triggers and payloads. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 1. Install **Facebook & Instagram by Meta** from the Shopify App Store. In the channel setup, connect Cedar & Coil’s Meta business portfolio and the appropriate Page, ad account, and catalog. 2. In Shopify admin, open **Sales channels → Facebook & Instagram → Settings → Data sharing settings**. Enable customer data sharing, select **Maximum** if approved, and connect the intended Pixel. In Meta Events Manager, verify the Pixel/dataset ID matches the one the draft ad set will use. Shopify currently documents CAPI purchase delivery for both **Enhanced** and **Maximum**; **Standard** is browser-only. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 3. Audit **Settings → Customer events**, theme code, tag managers, and tracking apps. Disable any second Meta sender for these same events. Let the native integration manage its browser/server pairing; **do not deploy the sketch below alongside it**. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage?utm_source=openai)) **Custom — use only if testing reveals a requirement the native channel can’t meet.** Use a Shopify app web pixel or **Settings → Customer events → Add custom pixel** for browser events. On the backend, use Shopify **Order Events** to detect the paid transition, or an existing `orders/paid` webhook. Verify the HTTPS delivery signature, filter to eligible online orders, and enqueue once per shop/order. Join permitted browser context and privacy choices to the order via a checkout or order key. If paid status can’t be verified while the browser is present, let the server alone send that order’s `Purchase`; don’t fire a speculative browser copy. Custom gives you control over that logic, but you own permissions, protected-data access, retries, and monitoring. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage?utm_source=openai)) **Server-side `Purchase` sketch (Node.js, custom path only).** Generate the CAPI token in **Events Manager → data source → Settings → Conversions API → Set up manually** and store it in a server secret manager. `p` below is a validated record from Shopify and your consent system, not a browser request body. `p.contents` holds catalog IDs and quantities; `p.sourceUrl` is the actual event URL with sensitive values removed. Pin a supported Graph API version in configuration. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/get-started)) ```javascript import { createHash } from "node:crypto"; const sha256 = s => createHash("sha256").update(s, "utf8").digest("hex"); export async function sendPurchase(p, testEventCode) { // Recheck permission before dispatch, including on retries. if (!p.paid || p.adsAllowed !== true) return { skipped: true }; if (!p.userAgent || !p.sourceUrl) { throw new Error("Missing required website event context"); } const eventId = `purchase:cedar-coil:${p.orderId}`; const email = p.email?.trim().toLowerCase(); const phone = p.phoneE164?.slice(1); // already validated as +<country code><number> const event = { event_name: "Purchase", event_id: eventId, event_time: p.occurredAtUnixSeconds, // actual purchase time, not retry time action_source: "website", event_source_url: p.sourceUrl, user_data: { client_user_agent: p.userAgent, ...(email && { em: [sha256(email)] }), ...(phone && { ph: [sha256(phone)] }), ...(p.clientIp && { client_ip_address: p.clientIp }), ...(p.fbp && { fbp: p.fbp }), ...(p.fbc && { fbc: p.fbc }), }, custom_data: { value: p.orderTotal, // validated number from Shopify currency: p.currency, // e.g. "USD" content_type: "product", content_ids: [...new Set(p.contents.map(item => item.id))], contents: p.contents, // [{ id: "<catalog item ID>", quantity: 1 }] }, }; const body = new FormData(); body.set("access_token", process.env.META_CAPI_TOKEN); body.set("data", JSON.stringify([event])); if (testEventCode) body.set("test_event_code", testEventCode); const { META_GRAPH_VERSION, META_PIXEL_ID } = process.env; const res = await fetch( `https://graph.facebook.com/${META_GRAPH_VERSION}/${META_PIXEL_ID}/events`, { method: "POST", body, signal: AbortSignal.timeout(10_000) }, ); const result = await res.json().catch(() => null); if (!res.ok || result?.events_received !== 1) { throw new Error(`Meta did not acknowledge Purchase (HTTP ${res.status})`); } return { eventId, traceId: result.fbtrace_id }; } ``` The browser peer uses `fbq('trackSingle', pixelId, 'Purchase', purchaseParams, {eventID: eventId})` with the same ID and matching commerce values. In the worker, retry transient failures with backoff using the original ID and timestamp; send persistent failures for investigation. An API acknowledgment confirms receipt, not deduplication or ad attribution. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 6. Validate end to end before scaling spend 1. **Walk the funnel.** Open Shopify’s Pixel Helper and Meta **Events Manager → Data Sources → your Pixel → Test Events**. View the lamp, add it, enter checkout, and place a test order. Verify the four exact event names, the destination, and the payloads. Test a discount and a quantity greater than one; confirm that `Purchase` matches Shopify’s amount, currency, and catalog IDs. For custom CAPI, send `test_event_code` at request level and remove it in production. Use a separate test data source where possible: the test code itself does not isolate events from measurement. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels?utm_source=openai)) 2. **Prove deduplication and fallback.** With tracking permitted, look for Browser and Server copies of the same order with matching IDs and confirm one counted purchase in the deduplication details—not two purchases in the raw receipt view. Refresh the confirmation page and, for a custom build, replay the Shopify delivery. Then repeat with the browser Pixel blocked but sharing still permitted: verify the server purchase arrives on its own. Test denied consent separately; neither route should send when policy prohibits sharing. Include mobile and any enabled accelerated checkout. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) 3. **Reconcile before scaling.** Review Diagnostics, Event Deduplication, Event Freshness, and Event Match Quality. Use a spreadsheet or script to reconcile counts and value by currency against eligible Shopify online orders for the same closed window and time zone. For a custom build, join the delivery ledger to Shopify by order ID and investigate missing or repeated rows. Shopify is the order ledger; Ads Manager reports ad-attributed conversions, so its totals need not match Shopify’s. Start with `Purchase` as the draft ad set’s website conversion event only after these checks pass. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ## 7. Consent and compliance Configure **Shopify admin → Settings → Customer privacy** and integrate any third-party consent platform with Shopify’s Customer Privacy API. Apply the applicable consent, opt-out, withdrawal, and Global Privacy Control rules to **both** delivery paths; don’t assume that a Shopify order notification authorizes advertising use. Verify the native channel’s behavior in the markets you serve. For custom tracking, enforce the decision again in the server worker before sending. Disclose Meta sharing in the privacy notice, minimize the fields and retention, and have the setup reviewed against applicable law and Meta’s Business Tools Terms. **Server-side delivery is a reliability measure, not a way around a shopper’s privacy choice.** ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai))
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 CAPI to the same dataset with deduplication, explaining that a blocked Pixel or an unloaded confirmation page doesn't lose the server purchase.
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 bolds numeric value, ISO 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.js sketch builds an event with 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 and checks Browser and Server copies with matching IDs, confirming one counted purchase in the 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 mapped to server and browser paths, but the table doesn't say where ViewContent, AddToCart and InitiateCheckout fire; it only says "don't assume every upper-funnel event also arrives from the server", so browser versus server is unclear per event.
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 response promises no recovery percentages, says CAPI "doesn't recreate missing click IDs, guarantee attribution, or override consent", and Section 7 treats consent and regional rules as 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 states Meta matches on Pixel ID, exact event name and exact event ID, with eventID in the fbq fourth argument and the identical top-level event_id on the server.
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 (`purchase:cedar-coil:${p.orderId}`), shared by both paths, with "Keep the same 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 `event_time: p.occurredAtUnixSeconds, // actual purchase time, not retry time`, and the text says to retry with 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.
✓Email is trimmed and lowercased, phone is normalized, and both are hashed with unsalted SHA-256 (`sha256(email)`), while browser context fields are 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 Shopify channel with numbered steps (install, Data sharing settings with Maximum, audit duplicate senders) and gives custom as a fallback with its own steps.