← Run 20261118-184051-0f30aef3
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 xhigh 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.29 · 136.9s · 7.7k tok
# Cedar & Coil: Shopify → Meta conversion tracking *Draft implementation guide. Keep the Arc Clip Lamp campaigns unpublished while you validate 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 captures storefront behavior and browser context: product views, cart additions, checkout starts, and completed checkouts. CAPI gives eligible purchases a second delivery path from Shopify’s order system, even if the browser Pixel is blocked or the confirmation page never loads. Send matching IDs for overlapping events so Meta counts one action, not two. CAPI improves delivery reliability; it does not guarantee that Meta can match a purchase to a person or attribute it to an ad. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) For launch, make **`Purchase` the primary conversion**. Use the other three events to diagnose where shoppers drop out. Prioritize server coverage for `Purchase`; verify rather than assume which earlier events the Shopify integration sends server-side. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) ## 2. Standard events and parameters Use Meta’s exact event names. The Shopify event names below are the hooks for a **custom** browser implementation; the native channel supplies its own triggers. Send the product and value fields as Pixel event parameters in the browser and under `custom_data` in CAPI. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?km_TopNav_contact=%2Fblog%2Fguest-blogging-guidelines%2F&kme=Website_TopNav_click&who=support&utm_source=openai)) | Meta event | When to fire | Key parameters | |---|---|---| | `ViewContent` | Shopper views the Arc Clip Lamp product detail page (`product_viewed`). | `content_ids` for the viewed item, `content_type`, `value` for the displayed item price, `currency`. | | `AddToCart` | The item is successfully added (`product_added_to_cart`), not merely when the button is clicked. | `content_ids` for the items added, `content_type`, `value` for the quantity added—not the whole cart—and `currency`. | | `InitiateCheckout` | Shopper starts checkout (`checkout_started`). | `content_ids` for checkout items, `content_type`, `value` for the checkout total as known at that point, `currency`, `num_items` as the sum of item quantities. | | `Purchase` | One completed purchase per eligible online order. Use `checkout_completed` for the browser copy and Shopify’s order record for the server copy. | **`value`** from the final Shopify order total, **`currency`** from that same total, **`content_ids`** for the purchased items, and `content_type`. | Send `value` as a number in currency units, not cents, and `currency` as a three-letter code such as `USD`. Don’t hard-code the lamp’s $68 list price into `Purchase`: use the checkout total after discounts, with tax, shipping, and duties as reflected in Shopify. Send `content_ids` as strings that match the actual Meta catalog item IDs, not assumed SKUs or raw Shopify variant IDs. Use `content_type: "product"` for item-level IDs and `"product_group"` only for group IDs. If you need line-item quantities, Meta also supports `contents` with `id`, `quantity`, and optional `item_price`. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/custom-data)) ## 3. How deduplication works Meta pairs events sent to the **same Pixel/dataset** when the event name and ID match exactly and the two copies arrive within **48 hours** of each other. The browser sends `eventID` in the **fourth argument** to `fbq`; CAPI sends `event_id` at the **top level of the event object**. Meta generally keeps the first copy; its parameter reference says it favors the browser copy when the two arrive within about five minutes. Keep the business fields consistent on both copies rather than relying on which one wins. If only one copy arrives, there is nothing to deduplicate. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ```js // Custom browser Pixel: orderGid uses the same canonical format as the server. fbq('track', 'Purchase', purchaseParams, { eventID: `purchase:${orderGid}` }); ``` For a custom build, derive the Purchase ID from the **same canonical Shopify order ID** on both sides. Normalize numeric IDs and GraphQL IDs to one format before constructing it. Use a new occurrence ID for each distinct view, cart add, or checkout start that you send through both paths. Reuse the original ID and timestamp on retries. An email hash, `_fbp`, or `order_id` inside `custom_data` is not a substitute for the explicit event ID. Also make your order worker idempotent so a retried Shopify delivery does not create a second send job. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 4. Prepare customer information server-side - **Normalize, then SHA-256 hash contact fields** before sending a direct request. For `em`, trim and lowercase the email. For `ph`, parse the phone number with its country code and send the hash of the digits-only international form, without the `+` or domestic trunk prefix. If you use names, city, state, postal code, or country, follow Meta’s field-specific normalization rules before hashing. Use unsalted SHA-256 hex for these matching fields; don’t hash twice if your SDK handles it. Meta recommends hashing `external_id` if you use it and keeping its format consistent 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 actual shopper’s browser context, not the webhook sender’s IP or user agent. Pass `_fbp` and `_fbc` values only when available and permitted; if building `fbc` from a real `fbclid`, use Meta’s documented format. Omit unavailable optional fields rather than inventing values. Meta requires `client_user_agent` and `event_source_url` for website CAPI events. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) - Put matching data only in `user_data`. Keep contact data out of `custom_data`, URLs, and logs. Use the actual checkout page URL stripped of personal data and checkout secrets, not the webhook endpoint. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 5. Shopify setup: use the native channel first **Recommended for Cedar & Coil: Facebook & Instagram by Meta.** The native sales channel is the simpler way to get managed Pixel and server Purchase tracking without owning checkout instrumentation, API credentials, or a retry queue. A custom build gives you control over event triggers, consent rules, catalog mapping, and delivery logs, but is worth the upkeep only if testing reveals a requirement the native channel cannot meet. **Do not run both integrations for the same events.** ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 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 and relevant assets. Confirm that the intended ad account can use the web dataset you select. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup)) 2. Open **Sales channels → Facebook & Instagram → Settings → Data sharing settings**. Enable customer data sharing and connect the intended Pixel. **Standard** is browser-only. Shopify currently documents server-side `Purchase` for both **Enhanced** and **Maximum**. Start with the lowest approved level that delivers server `Purchase` on your store; verify it in Events Manager. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) 3. Audit **Settings → Customer events**, the theme, GTM, legacy checkout scripts, and any tracking apps. Disable overlapping Meta tags or server feeds so the channel owns the events. Verify the Arc Clip Lamp’s event IDs for **catalog items** against the connected catalog; these are separate from the event IDs used for deduplication. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/pixel-migration?utm_source=openai)) **Custom alternative.** Subscribe to Shopify customer events through an app pixel or **Settings → Customer events**. On the server, use a signed Shopify Order Events subscription for orders becoming paid, or `orders/paid` where supported. Cover orders created already paid, and filter out POS, drafts, and other non-web orders. Join the order to permitted checkout context and the shopper’s privacy decision. If payment is delayed and the browser cannot confirm it, send the paid `Purchase` only from the server rather than firing early at checkout completion. Verify Shopify signatures, queue one job per order, and retry transient failures with the same ID and timestamp. Generate the CAPI access token in **Meta Events Manager → dataset → Settings → Conversions API → Set up manually**, and keep it in a server-side secret store. ([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).** The worker calls this with a verified paid order, validated catalog and monetary fields, and a server-side privacy decision. The request follows Meta’s `/events` format. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ```js import { createHash } from 'node:crypto'; const sha256 = (s) => createHash('sha256').update(s, 'utf8').digest('hex'); async function sendPurchase(p, testEventCode) { if (p.adsSharingAllowed !== true) return { skipped: 'privacy' }; if (!p.clientUserAgent || !p.cleanCheckoutUrl) { throw new Error('Missing required website event context'); } const email = p.email?.trim().toLowerCase(); const user_data = { client_user_agent: p.clientUserAgent, ...(email && { em: [sha256(email)] }), // Parsed and validated upstream: country code + national number, digits only. ...(p.phoneDigits && { ph: [sha256(p.phoneDigits)] }), ...(p.clientIp && { client_ip_address: p.clientIp }), ...(p.fbp && { fbp: p.fbp }), ...(p.fbc && { fbc: p.fbc }) }; 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); // Never log this URL. const res = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ data: [{ event_name: 'Purchase', event_id: `purchase:${p.orderGid}`, event_time: Math.floor(p.occurredAtMs / 1000), action_source: 'website', event_source_url: p.cleanCheckoutUrl, user_data, custom_data: { value: Number(p.orderTotal.amount), currency: p.orderTotal.currencyCode, content_ids: p.catalogItemIds, content_type: 'product' } }], ...(testEventCode && { test_event_code: testEventCode }) }) }); const receipt = await res.json().catch(() => ({})); if (!res.ok || receipt.events_received !== 1) { throw new Error(`CAPI not acknowledged: HTTP ${res.status}`); } return { eventsReceived: receipt.events_received, traceId: receipt.fbtrace_id }; } ``` ## 6. Validate end to end before spending | Test | Pass condition | |---|---| | **Normal checkout with ads sharing allowed** | Use Meta Pixel Helper for browser calls and **Events Manager → Data Sources → your dataset → Test Events** for payload inspection. Walk through all four events. On `Purchase`, check the same name and event ID on both paths, the correct order total and currency, and catalog IDs that resolve. Use **Overview → Purchase → Event Details → Event Deduplication** to confirm overlap; two raw arrivals are not two conversions. | | **Browser delivery blocked, sharing still allowed** | In a controlled session, block the Meta browser request without changing the shopper’s consent. The eligible paid order still produces a **Server** `Purchase`. Repeat on mobile and test any express checkout offered by the store. | | **Negative and repeat cases** | Abandoned or failed checkout produces no `Purchase`. Reloading the confirmation page or replaying a custom order notification does not produce a second counted purchase. Denying or withdrawing the relevant permission suppresses both paths when sharing is not allowed. | For custom CAPI tests, put `test_event_code` at the request’s top level and remove it for production. **It is not an isolation switch**: use a separate test dataset where possible. For the managed channel, if the server event isn’t visible in Test Events, check **Overview → Connection Method**. Start with a Shopify test order; if the managed channel doesn’t surface simulated payments, use a controlled real order and record it separately. ([developers.facebook.com](https://developers.facebook.com/docs/facebook-business-extension/fbe/guides/ig-migration?utm_source=openai)) Before publishing the draft ads, check **Diagnostics**, event freshness, and Event Match Quality, and confirm the draft ad set selects the same dataset and website `Purchase` event. After launch, reconcile eligible Shopify orders and values against Meta event delivery over the same closed window, with consistent time zones and test-order exclusions. Use Shopify as the order ledger: **Ads Manager’s attributed purchases are not a count of 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** and verify that any third-party consent banner integrates with Shopify’s Customer Privacy API. Apply the relevant marketing and data-sharing decisions to **both** Pixel and CAPI, including opt-outs and Global Privacy Control where applicable. For a custom worker, check permission again before dispatch or retry; the mere existence of a paid order is not permission to send it to Meta. Disclose Meta sharing in the privacy notice, minimize the fields you collect, restrict access and retention, and treat hashed identifiers as personal data. Review the configuration against Meta’s Business Tools Terms and the rules in the markets you serve. **CAPI is a second delivery path, not a workaround for 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 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 one dataset with Pixel plus CAPI and matching IDs, and says CAPI gives a second path "even if the browser Pixel is blocked or the confirmation page never loads".
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase lists value, currency and content_ids in bold.
code_sketch
A concrete server-side Purchase event code sketch or request example is included showing event_name, event_time, event_id, action_source, and a user_data block.
✓The Node.js sketch posts to /events 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 Pixel Helper, and checks Overview → Purchase → Event Details → Event Deduplication to confirm overlap rather than two conversions.
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 stated as browser checkout_completed plus the server copy from Shopify's order record, with server-only sending for delayed payment. The other three are tied to browser customer-event hooks, and their server coverage is flagged as something to verify, so it is somewhat implicit but workable.
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 gives no recovery percentages and says CAPI "does not guarantee" matching or attribution; section 7 says CAPI is "not a workaround for a shopper's privacy choice" and consent gates both paths.
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 pairs events when the name and ID match exactly within 48 hours, with eventID as the fourth fbq argument and event_id at the top level of the CAPI event, and shows `purchase:${orderGid}` on both sides.
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 from the canonical Shopify order ID (`purchase:${orderGid}`), shared by browser and server, with "Reuse the original ID and timestamp on retries" and an idempotent worker.
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: Math.floor(p.occurredAtMs / 1000), an occurrence time in Unix seconds, and the text says to reuse the 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.
✓Email is trimmed, lowercased and SHA-256 hashed, phone is normalized to digits-only international form before hashing, and fbp, fbc, IP and user agent are explicitly 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 a small store, gives numbered setup steps and data-sharing level guidance, and outlines the custom alternative with a code sketch.
✓ Attempt 2
Answer · attempt 2 the model's full response$0.33 · 149.9s · 8.9k tok
# Cedar & Coil: Shopify → Meta conversion tracking *Draft implementation guide for the Arc Clip Lamp. Keep campaigns in draft until tracking passes QA.* ## 1. Recommended architecture: Meta Pixel + Conversions API Use **Shopify’s Facebook & Instagram by Meta sales channel** to send browser Pixel events and server-side Conversions API (CAPI) events to **one Meta web dataset**. Prioritize getting `Purchase` right on both paths. Use the earlier events to diagnose where shoppers drop out. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) - **Browser Pixel:** Captures storefront actions as they happen and provides browser and ad-click context when available and permitted. It can miss events if a script is blocked, a page fails to load, or a shopper closes checkout before the confirmation page loads. - **Server-side CAPI:** Sends eligible purchases from Shopify’s order system without depending on the confirmation-page Pixel request. A browser blocker cannot intercept the server-to-Meta request, but missing identifiers and privacy choices can still limit what can be sent, matched, or attributed. - **Deduplication:** When both paths report one purchase, Meta should count one event, not two. Shopify remains the source of truth for orders; Meta Ads Manager reports the purchases Meta credits to ads. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) ## 2. Standard events and parameters Use Meta’s exact event names. The Shopify event names below are the subscriptions to use if you build a custom pixel. Send business parameters in the browser event properties and, for any server copy, under `custom_data`. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?utm_source=openai)) | Meta event | Trigger | Key parameters | |---|---|---| | `ViewContent` | Arc Clip Lamp product detail view (`product_viewed`), not every page view | `content_ids`, `content_type`, `value` for the displayed item price, `currency` | | `AddToCart` | Item successfully added (`product_added_to_cart`), not just a button click | `contents` with catalog `id` and `quantity` (`item_price` if available), `content_type`, `value` for **what was added**, `currency`. Prefer `contents` for catalog ads. | | `InitiateCheckout` | Shopper enters checkout (`checkout_started`) | `content_ids` or `contents` for the checkout, `num_items` as the sum of quantities, `value` for the checkout amount at that point, `currency` | | `Purchase` | Successful checkout (`checkout_completed` in the browser); once per qualifying Shopify order on the server | **`value`, `currency`, `content_ids`** for the items actually purchased, plus `content_type` to indicate the ID type | Use numeric `value` in major currency units and the matching ISO 4217 currency code. For `Purchase`, use the **actual order total at checkout**, not the lamp’s $68 list price; send `68.00` and `USD` only if that is what the test order actually totals in USD. Use the same value definition on both paths. Copy IDs from the corresponding items in Meta Commerce Manager: a Shopify SKU, product ID, or variant ID is only correct if it matches the catalog key. Use `product` for item IDs and `product_group` for group IDs. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) ## 3. Exactly how deduplication works Meta compares the **destination Pixel ID**, the **exact event name**, and the **event ID**. For the same purchase, the browser sends `Purchase` with `eventID` in the **fourth argument** to `fbq`; CAPI sends `event_name: "Purchase"` and the identical `event_id` at the **top level of the event**, not inside `custom_data`. Matching copies received within **48 hours of the first receipt** are counted as one event. Meta generally prefers the first equivalent copy; its server-event reference also notes a browser preference when the two arrive within about five minutes. Do not depend on either copy winning or on their fields being merged. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ```js fbq("track", "Purchase", purchaseProps, { eventID: "shopify-purchase:123456" }); ``` The server copy must use `event_id: "shopify-purchase:123456"`. For a custom build, derive this from the same canonical Shopify order ID on both paths: normalize a Shopify Order GID and its numeric equivalent to the same string. Keep that ID on retries; give every distinct order a different ID. For other events sent twice, generate an ID **once per action** and pass it to both senders. An email hash, cookie ID, or `custom_data.order_id` is not a substitute for this event key. ([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 | Data | Preparation for `user_data` | |---|---| | Email (`em`) | Trim leading and trailing whitespace, lowercase, then SHA-256 hash. | | Phone (`ph`) | Validate the country code, normalize to international digits only, drop the `+`, punctuation, and any domestic dialing prefix, then SHA-256 hash. Do not guess the country code. | | Other permitted matching fields | If needed, normalize names and location fields per Meta’s field-specific rules before hashing. Hashing a stable first-party `external_id` is recommended if you send one. | | Browser and network fields | Send `fbp`, `fbc`, `client_ip_address`, and `client_user_agent` **unhashed**, when available and permitted. Use the shopper’s IP and user agent, not Shopify’s webhook or your worker’s. Use `_fbp` and `_fbc` as captured; if constructing `fbc`, use a real `fbclid` and Meta’s documented format. Never invent a click ID. | For direct API calls, hash normalized values **once**, using unsalted SHA-256 over UTF-8 and hex output. If the SDK or partner integration hashes for you, don’t pre-hash. Omit missing optional fields rather than sending empty strings or placeholders. Keep contact data out of URLs, `custom_data`, and logs. Website CAPI events require `action_source: "website"`, a privacy-safe `event_source_url` for where the action occurred, and the actual `client_user_agent`. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) ## 5. Shopify setup: native first, custom only if needed **Recommended for Cedar & Coil: the native sales channel.** It provides standard storefront events and server-side Purchase without a custom service to run. The trade-off is less control over event payloads and delivery logs. A custom implementation makes sense if a headless storefront, a different purchase definition, or a specific data-governance requirement cannot be handled by the native integration. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) 1. In Shopify admin, go to **Settings → Sales channels → Shopify App Store** and add **Facebook & Instagram by Meta**. Open the channel, start setup, and connect Cedar & Coil’s Meta business portfolio, Page, and intended ad account. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup)) 2. Go to **Sales channels → Facebook & Instagram → Settings → Data sharing settings** (also labeled **Share data settings**). Enable customer data sharing, select **Maximum** if approved under your privacy settings, and connect or create the intended Pixel. Shopify documents server-side `Purchase` with both **Enhanced** and **Maximum**; **Standard** is browser-only. Verify delivery by event rather than assuming all four events are sent server-side. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) 3. Record the Pixel/dataset ID and confirm the intended ad account can select it. Remove competing Meta tags from the theme, GTM, custom pixels, or other apps, and disconnect any parallel CAPI sender for the same events. Let the native integration own both paths; don’t add the sketch below on top of it. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) **If going custom:** Install an app pixel or use **Settings → Customer events → Add custom pixel** for the browser events. For server `Purchase`, subscribe to Shopify’s `Order` creation event (or `orders/create` on an existing webhook integration) and filter to qualifying online checkouts. Verify the HTTPS delivery signature before trusting it and queue one Purchase per shop and order ID. Keep permitted browser context and consent in a first-party store linked to the checkout or order; the Shopify delivery alone is not proof of permission. Get the CAPI token from **Meta Events Manager → data source → Settings → Conversions API → Set up manually** and keep it server-side. ([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).** The worker receives a verified, eligible Shopify order and approved buyer context. `order.id` is already canonical; `order.catalogIds` contains actual Meta catalog keys; `ctx.sourceUrl` has been stripped of personal data and checkout secrets. Pin a supported Graph API version in server configuration. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ```js import { createHash } from "node:crypto"; const sha256 = (s) => createHash("sha256").update(s, "utf8").digest("hex"); async function sendPurchase(order, ctx, testCode) { if (ctx.metaAllowed !== true) return { status: "suppressed" }; if (!ctx.userAgent || !ctx.sourceUrl) throw new Error("Missing web context"); const email = order.email?.trim().toLowerCase(); const eventId = `shopify-purchase:${order.id}`; const event = { event_name: "Purchase", event_id: eventId, event_time: order.occurredAtUnixSeconds, // Order time, not retry time action_source: "website", event_source_url: ctx.sourceUrl, user_data: { client_user_agent: ctx.userAgent, ...(email && { em: [sha256(email)] }), ...(ctx.phoneE164 && { ph: [sha256(ctx.phoneE164.slice(1))] }), ...(ctx.ip && { client_ip_address: ctx.ip }), ...(ctx.fbp && { fbp: ctx.fbp }), ...(ctx.fbc && { fbc: ctx.fbc }), }, custom_data: { value: order.total, // Numeric amount in the buyer's currency currency: order.currency, content_ids: order.catalogIds, content_type: "product", }, }; const { META_GRAPH_VERSION, META_PIXEL_ID, META_CAPI_TOKEN } = process.env; const form = new FormData(); form.set("access_token", META_CAPI_TOKEN); form.set("data", JSON.stringify([event])); if (testCode) form.set("test_event_code", testCode); // QA only const res = await fetch( `https://graph.facebook.com/${META_GRAPH_VERSION}/${META_PIXEL_ID}/events`, { method: "POST", body: form, signal: AbortSignal.timeout(8000) } ); const result = await res.json().catch(() => ({})); if (!res.ok || result.events_received !== 1) { throw new Error(`CAPI unconfirmed: HTTP ${res.status}, code ${result.error?.code ?? "none"}`); } return { eventId, traceId: result.fbtrace_id }; } ``` Validate inputs before enqueueing, including a usable matching signal beyond user agent alone and a validated E.164 phone if present. Retry transient failures promptly using the **same** event ID and original timestamp. Log delivery status and trace ID, not the request body or access token. An API acknowledgment confirms receipt, not matching, deduplication, or ad 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 a clean checkout.** On the intended dataset, open **Events Manager → Data Sources → Test Events**. With marketing sharing permitted, view the lamp, add it, start checkout, and complete a Shopify test order. Check all four names, then compare the Purchase amount, currency, and catalog IDs with the Shopify order. For browser inspection, use DevTools or Meta Ads Data Advisor (formerly Meta Pixel Helper); for a custom Shopify pixel, also use Shopify Pixel Helper. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) 2. **Prove deduplication and fallback.** For a normal order, verify Browser and Server delivery for `Purchase`, matching IDs where visible, and one logical Purchase. Reload the confirmation page to check that it creates no new Purchase. Then place a separate permitted order with only the browser Pixel request blocked: verify that the server Purchase still arrives. For native events not visible in Test Events, use **Overview → Connection Method** and the Purchase **Event Deduplication** details. For custom QA, use a test dataset where possible: `test_event_code` helps surface events but does not isolate them from measurement. Remove it from production requests. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) 3. **Run negative and edge tests.** Verify that a checkout that never completes creates no Purchase, and that declining marketing tracking or exercising an applicable sharing opt-out suppresses both paths. Test mobile Safari and any accelerated checkout you offer. In Events Manager, review **Diagnostics**, **Event Freshness**, deduplication key overlap, and **Event Match Quality**. Use match quality to troubleshoot permitted identifiers, not as a reason to collect more data. ([shopify.dev](https://shopify.dev/docs/api/customer-privacy?utm_source=openai)) 4. **Reconcile before scaling.** In a spreadsheet or script, compare eligible Shopify order rows and available delivery records over the same closed window and time zone. Check distinct order counts and independently sum values by currency; investigate duplicate, missing, or mismatched rows. With the native channel, use controlled test orders for order-level checks and Events Manager for aggregate monitoring. Don’t compare Shopify’s all-order total to Meta’s ad-attributed count as a pass/fail test. Once QA passes, confirm the draft Sales ad set selects **Website**, the correct dataset, and **Purchase**. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ## 7. Consent and compliance Configure **Shopify → Settings → Customer privacy** for the markets you serve. If you use a third-party consent banner, sync it through Shopify’s Customer Privacy API. Apply the same marketing permissions and applicable sale, sharing, or targeted-advertising opt-outs—including Global Privacy Control where required—to **both** the Pixel and the server worker. A completed order or email-marketing signup is not permission to forward the order to Meta. For custom sends, check permission again before dispatch or retry; if required permission cannot be established, don’t send. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai)) Disclose the Meta sharing and its purposes in the privacy notice, minimize the fields sent, restrict access, and set retention and deletion procedures. Hashing is not anonymization or consent. CAPI is a way to make permitted event delivery more reliable, not a way around a shopper’s privacy choice. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs))
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 to one dataset with deduplication, and explains that the browser can miss events when scripts are blocked or checkout closes early while the server request cannot be intercepted by 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 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, checks Browser and Server delivery with matching IDs and one logical Purchase, and reviews Event Deduplication details and a reload test.
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 per event, Purchase is `checkout_completed` in the browser and once per Shopify order on the server, and Shopify is named as the source of truth for orders; the browser-versus-server split for the other three events is only implied.
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 recovery percentages, says privacy choices and missing identifiers limit sending and matching, and states "CAPI is a way to make permitted event delivery more reliable, not a way around a shopper's privacy choice."
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓Section 3 says Meta matches on Pixel ID, exact event name and event ID, with `eventID` in fbq's fourth argument and `event_id` at the top level of the server event; both use "shopify-purchase:123456".
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 from the canonical Shopify order ID on both paths and the guide says "Keep that ID on retries" and "Retry transient failures promptly using the same event ID".
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: order.occurredAtUnixSeconds, // Order 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, lowercased and SHA-256 hashed (the code does `order.email?.trim().toLowerCase()` then `sha256`), phone is normalized 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).
✓The guide recommends the native Facebook & Instagram sales channel for a small store, gives numbered setup steps with Shopify admin paths, and says when a custom build would be warranted.
✗ Attempt 3
Answer · attempt 3 the model's full response$0.36 · 182.1s · 9.3k tok
# Cedar & Coil: Shopify → Meta conversion tracking guide **Draft · Pre-launch.** Use Shopify’s native **Facebook & Instagram by Meta** sales channel to send browser and server events to one Meta dataset. Make `Purchase` the primary conversion for the Arc Clip Lamp launch. Use the other three events to diagnose where shoppers drop out, and keep the campaign unpublished until tracking passes the checks below. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) ## 1. Recommended architecture: Meta Pixel + Conversions API - **Browser Meta Pixel:** Captures product views, cart additions, checkout starts, and completed checkouts with browser and session context. Browser privacy controls, content blockers, or a confirmation page that never loads can limit what gets through. - **Server-side Conversions API (CAPI):** Sends eligible conversion events from Shopify or an authorized backend directly to Meta. An eligible `Purchase` can reach Meta even when the browser copy doesn’t. Server delivery does not guarantee that Meta can match the purchase to a person or attribute it to an ad. - **One destination, one event per action:** Send both copies to the same Meta Pixel/dataset. When both paths report the same action, give them the same event ID so Meta counts it once. Prioritize dual delivery for `Purchase`; verify which other events the native integration actually sends server-side rather than assuming all four are mirrored. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels?utm_source=openai)) ## 2. Standard events and parameters This is the event contract to implement on a custom build and the checklist to verify on the native integration. Shopify’s Customer Events names are shown for the custom browser mapping. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?utm_source=openai)) | Meta event | Fire when | Key parameters | |---|---|---| | `ViewContent` | A shopper views the Arc Clip Lamp product page (`product_viewed`). | `content_ids` for the item viewed, `content_type`, numeric `value` for the displayed price, and `currency`. | | `AddToCart` | The item is successfully added (`product_added_to_cart`), not merely when the button is clicked. | `content_ids`, `content_type`, `contents` with item ID and quantity, `value` for the items just added—not the whole cart—and `currency`. | | `InitiateCheckout` | The shopper enters checkout (`checkout_started`), not on each checkout step. | `content_ids` for the checkout items, `contents`, `num_items` as total quantity, `value` for the checkout subtotal at entry, and `currency`. | | `Purchase` | An eligible online checkout completes (`checkout_completed` in the browser; the corresponding Shopify completion on the server). Fire once per order. | **`value`**, **`currency`**, and **`content_ids`** for the purchased items. Include `content_type`; add `contents` for line-level quantities and `order_id` for reconciliation if useful. | Use numeric amounts in major units and the actual three-letter transaction currency, such as `USD`. For `Purchase`, use the order total recorded at checkout, after discounts and with any shipping, taxes, and duties reflected in that total. A one-lamp order can be `68.00 USD` if nothing changes the total; don’t hard-code the list price. Copy `content_ids` from the exact item IDs in the connected Meta catalog—not the product title or an assumed Shopify ID format. Use `content_type: "product"` for item IDs and `"product_group"` for group IDs. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) ## 3. Exactly how deduplication works Meta compares **the same Pixel/dataset ID, the exact event name, and the exact event ID**. The browser puts `eventID` in the **fourth argument** to `fbq`; CAPI puts `event_id` at the **top level of the individual event**, not inside `custom_data`. Matching copies must arrive within **48 hours** of the first receipt. Meta generally keeps the first copy, with a documented preference for the browser copy when the two arrive within about five minutes. Don’t rely on Meta to merge fields from the two copies: send consistent order data on both. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ```js // orderId is the same canonical Shopify Order ID string used by the server. fbq("track", "Purchase", { value: orderTotal, currency: orderCurrency, content_ids: catalogItemIds, content_type: "product" }, { eventID: `purchase:${orderId}` }); ``` For a custom build, normalize the browser’s `checkout.order.id` and the server’s order ID to the same string representation. Don’t mix a Shopify global ID, a numeric ID, and a display order number, or convert a large ID to a JavaScript `Number`. Reuse that ID and the original event time on retries. For mirrored funnel events, generate or obtain one ID per action and pass it to both senders; don’t use a session or customer ID for every action. Prevent repeated browser fires and duplicate server jobs yourself. Meta’s cross-source deduplication is not a substitute for an idempotent sender. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?trk=article-ssr-frontend-pulse_little-text-block&utm_source=openai)) ## 4. Prepare customer information before sending server-side | Data | Preparation for CAPI `user_data` | |---|---| | Email (`em`) and phone (`ph`) | Trim and lowercase email. Normalize phone to digits with the country calling code, without `+`, punctuation, or a domestic trunk prefix. Hash each normalized value once with unsalted SHA-256 over UTF-8 and send the hex digest. Omit absent or invalid values; don’t hash empty strings. | | Other identifiers | If approved and necessary, apply Meta’s field-specific normalization before hashing names and location fields. Meta recommends hashing `external_id` if you use it; keep its format consistent across channels. Check whether your SDK already hashes fields to avoid double hashing. | | Browser and click context | Send `fbp` from `_fbp` and `fbc` from `_fbc` **without hashing**, when available and permitted. If `_fbc` is absent, only construct `fbc` from a genuine `fbclid` using Meta’s format. Send the actual shopper IP and user agent un-hashed where permitted, never those of the webhook, proxy, or worker. Meta requires the shopper user agent for website CAPI events. | Capture permitted browser context before checkout completes and associate it with the checkout or order so the server can use it without depending on the thank-you page. Keep customer identifiers out of `custom_data`, URLs, and routine logs. Hashing helps prepare data for matching; it does **not** make it anonymous. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) ## 5. Shopify setup: native first, custom only if needed **Native path — recommended for Cedar & Coil.** It provides the browser integration and server-side `Purchase` without requiring Cedar & Coil to maintain its own checkout listener, event IDs, or API worker. The trade-off is less control over triggers, payloads, and logs. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 1. In Shopify admin, go to **Settings → Sales channels → Shopify App Store** and install **Facebook & Instagram** by Meta. Open the channel, choose **Start setup → Connect account**, and connect the correct business portfolio, ad account, and catalog if used. 2. Go to **Sales channels → Facebook & Instagram → Settings → Share data settings**. Enable customer data sharing, connect the intended Pixel, and confirm its ID in Meta Events Manager. Choose **Maximum** if approved for your privacy configuration. Shopify documents that **Enhanced** also sends `Purchase` via CAPI; **Standard** is browser-only. Verify the actual connection methods in Meta. 3. Give the native channel sole ownership of these Meta events. Remove or disable overlapping Meta tags in theme code, GTM, **Settings → Customer events**, and other apps or server integrations. Don’t paste the custom sketch below on top of the native setup. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) **Custom path — only for a verified gap.** If you need event rules or logs the native channel can’t provide, use a sandbox-compatible browser pixel under **Settings → Customer events**, plus a backend fed by a Shopify-authorized server source. Shopify Server Pixels can deliver `checkout_completed` to EventBridge or Pub/Sub and require approved scopes. Confirm the intended data transfer with Shopify before building; Shopify describes ordinary order webhooks as transactional, not a substitute for its marketing pixel controls. Use authoritative Shopify totals, not prices submitted by the browser. Queue one job per order/event, recheck permission before sending, and retry transient failures with the same ID and timestamp. Generate the CAPI token in **Events Manager → Data Sources → your dataset → Settings → Conversions API → Set up manually** and store it server-side. ([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).** This is the send step, not a checkout handler. `p` is a validated purchase from the authorized Shopify feed, with the same order ID and catalog IDs used by the browser. Pass `testCode` only in isolated testing. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ```js import { createHash } from "node:crypto"; const sha256 = s => createHash("sha256").update(s, "utf8").digest("hex"); async function sendPurchase(p, testCode) { if (p.adSharingAllowed !== true) return { skipped: "privacy" }; if (!p.userAgent || !p.safeEventUrl) return { skipped: "missing web context" }; const email = p.email?.trim().toLowerCase(); // Validated upstream const event = { event_name: "Purchase", event_id: `purchase:${p.orderId}`, event_time: p.occurredAtUnixSeconds, // Actual event time, not retry time action_source: "website", event_source_url: p.safeEventUrl, // Actual page URL, stripped of secrets user_data: { client_user_agent: p.userAgent, ...(email && { em: [sha256(email)] }), ...(p.phoneDigits && { ph: [sha256(p.phoneDigits)] }), ...(p.clientIp && { client_ip_address: p.clientIp }), ...(p.fbp && { fbp: p.fbp }), ...(p.fbc && { fbc: p.fbc }) }, custom_data: { value: p.orderTotal, currency: p.orderCurrency, content_ids: p.catalogItemIds, content_type: "product", order_id: p.orderId } }; const { META_GRAPH_VERSION, META_PIXEL_ID, META_CAPI_TOKEN } = process.env; const form = new FormData(); form.set("access_token", META_CAPI_TOKEN); form.set("data", JSON.stringify([event])); if (testCode) form.set("test_event_code", testCode); const res = await fetch( `https://graph.facebook.com/${META_GRAPH_VERSION}/${META_PIXEL_ID}/events`, { method: "POST", body: form, signal: AbortSignal.timeout(8000) } ); const result = await res.json().catch(() => ({})); if (!res.ok || result.events_received !== 1) { throw new Error(`Meta send failed: HTTP ${res.status}; trace ${ result.fbtrace_id ?? result.error?.fbtrace_id ?? "unavailable" }`); } return { received: 1, traceId: result.fbtrace_id }; } ``` Pin a supported Graph API version. Record delivery status and trace IDs, not tokens or payloads. An API receipt confirms ingestion, not deduplication, a customer match, or ad 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 a normal checkout.** In **Events Manager → Data Sources → your dataset → Test Events**, walk through product view, add to cart, checkout, and purchase. Use Meta Pixel Helper or browser network tools to inspect browser requests. Use an isolated test store and dataset where possible; `test_event_code` makes events visible for debugging but does not keep them out of measurement. For native server events not shown in Test Events, check **Overview → Purchase → Connection Method** and **Event Deduplication**. ([developers.facebook.com](https://developers.facebook.com/docs/facebook-business-extension/fbe/guides/ig-migration?utm_source=openai)) 2. **Prove the edge cases.** For a permitted order with both sources active, verify matching IDs and one counted `Purchase`. Reload the confirmation page and, on custom builds, replay the server job: neither should create another purchase. Then block only the browser Pixel request on a permitted test and verify a server-only `Purchase`. Test a declined payment and a denied or withdrawn advertising permission separately. Neither should produce an ineligible `Purchase`, and the privacy test should show no Meta advertising sends from either path. Check mobile and any enabled express checkout, discounts, and additional currencies. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) 3. **Reconcile before increasing spend.** Compare eligible Shopify orders and their values by currency with deduplicated `Purchase` events over the same closed dates and time zone. Use order-level records where available; don’t add browser and server receipt counts together. Review Diagnostics, event freshness, and Event Match Quality. In the draft Sales ad set, confirm **Website → the same dataset → Purchase**. Shopify is the order ledger; Ads Manager reports purchases attributed to ads, so the two totals should not be expected to match. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ## 7. Consent and compliance Configure **Shopify → Settings → Customer privacy** and make sure any third-party consent banner syncs with Shopify’s Customer Privacy API. Apply the same advertising permissions to Pixel and CAPI: obtain opt-in where required, honor withdrawals and applicable sale/sharing or targeted-advertising opt-outs, including Global Privacy Control where required, and suppress sends when permission cannot be established. A checkout email or an email-marketing opt-in is not permission to share an order with Meta for advertising. Disclose the sharing in the privacy notice, minimize what you send and retain, and never transmit payment details or sensitive data. CAPI is a more reliable delivery path for **permitted** events, 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 the browser Pixel plus CAPI with a shared event ID, and explains that privacy controls, blockers, or a confirmation page that never loads can stop the browser copy while the server copy can still reach Meta.
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, then POSTs it to the /events endpoint.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Events Manager Test Events and the Event Deduplication check, and has the tester verify matching IDs and a single counted Purchase.
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 Purchase row says browser `checkout_completed` and server-side "the corresponding Shopify completion", but the response never lays out per-event browser vs server firing or the source of truth, and it says to "verify which other events the native integration actually sends server-side".
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 promises no recovery percentages, says server delivery "does not guarantee" matching or attribution, and Section 7 treats consent and regional rules as limits on what may be sent.
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓It specifies the same dataset ID, exact event name and exact event ID, with eventID as the fourth fbq argument and event_id at the top level of the CAPI event, a 48-hour window and the same `purchase:${orderId}` ID on both paths.
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 deterministically from the order ID (`purchase:${orderId}`), and the text says "Reuse that ID and the original event time 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 code sets event_time to p.occurredAtUnixSeconds with the comment "Actual event time, not retry time", and the text says retries keep the same ID and timestamp.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓The table and code trim and lowercase email, normalize phone to digits, and SHA-256 hash them before sending, while fbp, fbc, IP and user agent are sent 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 channel for Cedar & Coil, with numbered admin steps for installing, connecting, sharing data and removing overlapping tags, and it reserves the custom path for a verified gap.