← Run 20261118-191832-b44be15d
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 low 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.063 · 42.2s · 3.3k tok
# Cedar & Coil: Shopify → Meta conversion tracking guide **Recommendation:** Start with Shopify’s native **Facebook & Instagram by Meta** sales channel, using **Maximum** data sharing if it fits Cedar & Coil’s privacy requirements. Keep campaigns in draft until a test order proves that Meta receives one logical `Purchase` with the correct amount, currency, and catalog IDs. Use Shopify as the source of truth for orders and Meta for ad attribution and optimization. ([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: browser Pixel + server Conversions API - **Browser → Meta Pixel:** Capture product views, successful cart adds, checkout starts, and completed checkouts. The browser can provide page context and permitted browser or ad-click identifiers, but blockers, privacy settings, or an unloaded confirmation page can prevent delivery. - **Shopify → Conversions API (CAPI):** Send eligible purchase events from the server, independently of whether the browser Pixel fires. This makes Purchase delivery more resilient to browser blocking. It does not recreate missing click identifiers, override consent, or guarantee that Meta can attribute an order to an ad. - **Both → one Meta web data source:** When both paths report the same action, send matching deduplication keys. Use both for `Purchase`; don’t assume the native channel mirrors every upper-funnel event server-side. Shopify specifically documents server delivery of Purchase, so verify actual coverage 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)) ## 2. Standard events and parameters Use Meta’s event names exactly as shown. The Shopify event names below are the subscriptions you’d use in a custom browser implementation. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?page=2&utm_source=openai)) | Meta event | Fire when | Key parameters | |---|---|---| | `ViewContent` | The Arc Clip Lamp product detail page is viewed (`product_viewed`). | `content_ids`, `content_type`, `value` for the displayed item price, and `currency`. | | `AddToCart` | Shopify confirms a successful add (`product_added_to_cart`), not merely a button click. | `content_ids`, `content_type`, `contents` with ID and quantity, `value` for the items added in this action, and `currency`. | | `InitiateCheckout` | The shopper starts checkout (`checkout_started`). | `content_ids`, `content_type`, `contents`, `num_items`, `value` for the checkout total at that point, and `currency`. | | `Purchase` | A qualifying online order completes; use the server order record as the authoritative source. The browser signal is `checkout_completed`. | **`value`**, **`currency`**, **`content_ids`**, plus `content_type` and `contents` with IDs and quantities. Send one event per order, not one per line item. | Use numeric major-unit amounts (`68.00`, not `6800`) and an uppercase ISO currency code such as `USD`. For `Purchase`, use the actual checkout-currency order total after discounts, including shipping and taxes if they’re in that total. Document that definition and use it on both paths. Don’t hard-code the lamp’s $68 list price: even a one-lamp order can have a different total. With `content_type: "product"`, send the exact item IDs in the connected Meta catalog as strings; verify the mapping rather than assuming a Shopify SKU or raw variant ID matches. ([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)) ## 3. Exactly how deduplication works Meta matches the browser and server copies on the **same web data source**, with the **same event name** and **same event ID**, within its **48-hour deduplication window**. For one order, the browser sends `fbq('track', 'Purchase', params, {eventID: id})`; CAPI sends `event_name: "Purchase"` and top-level `event_id: id`. The ID is case-sensitive in practice: generate the same string on both sides rather than normalizing it separately. The two deliveries should count as one logical purchase; if only the server copy arrives, there is no browser duplicate to remove. Email hashes, `fbp`, `fbc`, and an order number in `custom_data` are not substitutes for the shared event ID. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) For a custom integration, derive the ID from a stable shop key and the same canonical Shopify order ID on both paths, for example `purchase:cedar-coil:<canonical-order-id>`. Normalize the order ID consistently if one path exposes a global ID and the other a numeric ID. Reuse that key and the original event timestamp on retries. Also enforce server-side idempotency in a persistent outbox: Meta’s browser/server deduplication is not a substitute for handling duplicate webhook deliveries. If you mirror any upper-funnel event, generate a fresh ID per action and pass it to both paths; don’t reuse a product ID as an event ID. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ## 4. Prepare customer information before sending it Put matching fields in CAPI `user_data`, not `custom_data`. Send only fields you’re permitted to use. Normalize each field according to Meta’s rules **before** SHA-256 hashing it; don’t hash an already hashed value. For example, trim and lowercase email, and normalize phone to digits with the country calling code before hashing. If you add name or address fields, follow the field-specific normalization rules rather than applying the email rule to everything. Omit unknown or empty fields instead of hashing placeholders. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) Send permitted `_fbp` and `_fbc` values as `fbp` and `fbc` **without hashing**. Use `fbc` only when supported by an actual Meta click identifier; don’t invent one. The shopper’s IP and user agent, when used, are also unhashed. Use genuine shopper context—not the Shopify webhook sender’s IP or user agent—and use a real event-source URL stripped of personal data and checkout secrets. Meta documents `client_user_agent` and `event_source_url` for website events; plan how to obtain them lawfully before choosing custom. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ## 5. Shopify setup: native first; custom only for a documented gap ### Native setup — recommended 1. In Shopify admin, install or open **Sales channels → Facebook & Instagram**. Connect the Meta business and ad account Cedar & Coil will use. Select the intended Pixel/web data source and verify the associated catalog if you’ll run catalog ads. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta?utm_source=openai)) 2. Go to **Settings → Data sharing settings**, enable customer data sharing as appropriate, select **Maximum**, confirm the Pixel, and save. Shopify currently documents both **Enhanced** and **Maximum** as using Pixel plus CAPI for Purchase; **Standard** is browser Pixel only. Choose a level your privacy configuration can support. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) 3. Audit Shopify **Customer events**, theme code, GTM, and other apps for existing Meta senders. Remove or disable overlapping senders when cutting over. Don’t add the custom request below on top of the native Purchase sender. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) The native channel is the better starting point for a small DTC store because it gives Cedar & Coil a server Purchase path without owning webhook processing, retry logic, or customer-data handling. Choose custom only if testing reveals a specific gap worth maintaining, such as a required order-eligibility rule or a need for auditable payloads. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) ### Custom alternative — server Purchase request sketch Use Shopify Web Pixels customer events for the browser path and a verified Shopify order webhook for the server path. If using `orders/paid`, test delayed-payment methods: `checkout_completed` and payment can occur at different times. Don’t send both as copies of one Purchase if they represent different milestones or can fall outside the deduplication window. For those methods, choose one authoritative trigger, such as server-only Purchase at payment. Verify webhook signatures, queue accepted deliveries, and use an allowlist of eligible storefront orders. Persist permitted browser context and the privacy decision under a key that can be joined to the order; the webhook alone is not that context. ([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)) The sketch assumes an authenticated webhook worker has already validated order eligibility, consent, catalog mapping, and idempotency. Keep the access token in a server-side secret store and pin a supported Graph API version. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ```javascript import { createHash } from "node:crypto"; const sha256 = s => createHash("sha256").update(s, "utf8").digest("hex"); async function sendPurchase(order, context, testCode) { if (!context.metaAdsSharingAllowed) return; const email = order.email?.trim().toLowerCase(); // Validate genuine user agent and sanitized source URL before calling. const user_data = { client_user_agent: context.userAgent, ...(email && { em: [sha256(email)] }), ...(context.fbp && { fbp: context.fbp }), ...(context.fbc && { fbc: context.fbc }), }; const event = { event_name: "Purchase", event_id: `purchase:cedar-coil:${order.canonicalId}`, // same as Pixel eventID event_time: order.purchaseUnixSeconds, // original event time, not retry time action_source: "website", event_source_url: context.safeSourceUrl, user_data, custom_data: { value: order.totalInCheckoutCurrency, // validated number, major units currency: order.checkoutCurrency, content_type: "product", content_ids: [...new Set(order.lines.map(line => line.metaCatalogId))], contents: order.lines.map(line => ({ id: line.metaCatalogId, quantity: line.quantity, })), }, }; const { META_GRAPH_VERSION, META_PIXEL_ID, META_CAPI_TOKEN } = process.env; const response = await fetch( `https://graph.facebook.com/${META_GRAPH_VERSION}/${META_PIXEL_ID}/events`, { method: "POST", headers: { Authorization: `Bearer ${META_CAPI_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ data: [event], ...(testCode && { test_event_code: testCode }), }), }, ); const result = await response.json(); if (!response.ok || result.events_received !== 1) { // Worker: retry transient failures with the same ID/time; alert on final // rejection. Do not log request bodies, tokens, or customer information. throw new Error(`Meta Purchase not acknowledged (HTTP ${response.status})`); } } ``` ## 6. Validate end to end before scaling spend 1. **Run a clean checkout with marketing sharing allowed.** Open the lamp page, add it to cart, begin checkout, and complete a controlled test order. Use Meta Events Manager **Test Events** and a browser Pixel inspection tool. For custom CAPI tests, use the Test Events code at the request-body level. Verify each funnel action and compare Purchase amount, currency, quantity, and IDs against the Shopify order and Meta catalog. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) 2. **Prove deduplication, not just delivery.** Inspect browser and server Purchase details for the same order. Confirm matching IDs where exposed and verify deduplication in Events Manager. Two received copies can be correct; two counted purchases for one order are not. Revisit the confirmation page; for custom, also replay the webhook and confirm the outbox doesn’t create a second purchase. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) 3. **Test the failure cases.** Repeat on mobile and with the browser Pixel blocked while marketing sharing remains allowed: the server Purchase should still arrive if the implementation has the required permitted context. Separately test declined consent or an applicable opt-out: neither path should send when sharing is disallowed. Include a discounted or multi-quantity order and any accelerated checkout method you plan to offer. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) 4. **Reconcile before launch.** Check Events Manager diagnostics for duplicate events, missing parameters, and catalog mismatches. For a closed test window, reconcile eligible Shopify orders to observed Purchase events; for custom, use a row-level export keyed by order/event ID and investigate each missing or extra row. An API acknowledgment confirms receipt, not deduplication or attribution. Shopify orders and Ads Manager attributed purchases are different measures; don’t expect them to match. Remove test codes from production requests and keep campaigns in draft until the checks pass. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ## 7. Consent and compliance Configure Shopify’s customer privacy settings or a compatible consent platform before enabling data sharing. Apply the same regional consent and opt-out rules to **both** paths; a custom server worker needs its own enforcement and must not infer advertising permission from an order or an email-marketing subscription. Where opt-in is required and the status is unknown, don’t send. Update the privacy notice to describe Meta sharing, minimize and protect customer data, and have the store’s privacy owner verify applicable obligations and Meta terms. Hashing helps protect identifiers in transit but does not replace permission to share them. CAPI is a more reliable delivery path for permitted events, not a way around privacy choices. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai))
Score · attempt 1 the judge's verdict, criterion by criterion10/11 criteria passed · failed: sources_defined
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends browser Pixel plus server CAPI, explains blockers/privacy settings can stop the browser, and that server delivery is more resilient; dedup is covered in section 3.
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 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.
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 a step titled "Prove deduplication, not just delivery" that verifies matching IDs and 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).
✗Purchase's source is clear (server order record, browser checkout_completed), but the response says the native channel may not mirror upper-funnel events server-side and never states browser versus server for ViewContent, AddToCart or InitiateCheckout.
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 gives no attribution-recovery percentages, says CAPI "does not recreate missing click identifiers, override consent, or guarantee" attribution, and section 7 treats consent as a constraint on what may be sent.
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓Section 3 states the same event name and event ID on the same data source within the 48-hour window, with fbq eventID matched to CAPI event_id.
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 order ID (`purchase:cedar-coil:<canonical-order-id>`), shared by both paths, and the response says to "Reuse that key and the original event 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 code uses `order.purchaseUnixSeconds` with the comment "original event time, not retry time", and the text says to reuse the original timestamp on retries.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓Email is trimmed and lowercased before SHA-256 hashing, and section 4 says to normalize before hashing and not to hash fbp, fbc, IP or user agent.
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 response decisively recommends the native Facebook & Instagram channel with Maximum data sharing, gives numbered setup steps, and reserves custom for documented gaps.
✗ Attempt 2
Answer · attempt 2 the model's full response$0.070 · 45.5s · 3.5k tok
# Cedar & Coil: Shopify → Meta conversion tracking **Draft implementation guide.** Use `Purchase` as the primary conversion for the Arc Clip Lamp campaign. Use the other three events to diagnose where shoppers drop out. Keep ads in draft until the tracking checks below pass. ## 1. Recommended architecture: Meta Pixel + Conversions API Send browser events through the **Meta Pixel** and server events through **Meta Conversions API (CAPI)** to the **same Meta dataset/pixel**. The Pixel observes storefront actions and provides browser context when available. CAPI gives a confirmed Shopify purchase a second delivery path that does not depend on the browser loading the confirmation page or reaching Meta. When both paths report the same action, deduplicate it so Meta counts one conversion, not two. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) Prioritize redundant delivery for `Purchase`. Shopify documents server-side Purchase delivery through its native integration; verify which upper-funnel events actually arrive from each source rather than assuming all four are mirrored. A server endpoint that only forwards browser events does not provide the same resilience as a Shopify order trigger: if the browser never observes the action, it has nothing to forward. Server delivery improves resilience, but does not guarantee user matching or ad attribution. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) ## 2. Event map and parameters Use Meta's exact, case-sensitive standard event names. The Shopify event names below are the subscription points for a custom browser implementation. In Pixel calls, pass the commerce fields in the event parameters; in CAPI, put them in `custom_data`. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?utm_source=openai)) | Meta event | Shopify trigger | Key commerce parameters | |---|---|---| | `ViewContent` | `product_viewed`: Arc Clip Lamp product detail viewed | `content_ids` for the displayed item, `content_type`, displayed unit `value`, `currency` | | `AddToCart` | `product_added_to_cart`: item successfully added, not just a button click | `content_ids`, `content_type`, `contents` with item ID and quantity added, `value` of the items added, `currency` | | `InitiateCheckout` | `checkout_started`: checkout actually starts | `content_ids`, `content_type`, `contents` with quantities, `num_items` as total units, checkout `value`, `currency` | | `Purchase` | `checkout_completed` for the browser; authoritative paid online order for a custom server path | **`value`, `currency`, `content_ids`**; also `content_type` and `contents` with item IDs and quantities | Use numeric amounts in major currency units and a three-letter ISO currency code. For `Purchase`, use the actual Shopify order total in the buyer's checkout currency, not a hard-coded `68`: a one-lamp order is `68.00 USD` only if that is the actual total. Document the treatment of discounts, shipping, and tax, and use the same value definition on both paths. Use the exact IDs in the Meta catalog—not the product title or an assumed Shopify ID format. Use `content_type: "product"` for catalog item IDs, or `"product_group"` if intentionally sending group IDs. ([developers.facebook.com](https://developers.facebook.com/docs/facebook-business-extension/fbe/guides/pixel-events?utm_source=openai)) ## 3. How deduplication works Meta matches duplicates when the **same pixel ID**, **same event name**, and **same event ID** arrive through browser and server within **48 hours** of the first receipt. The browser field is `eventID`, in the fourth argument to `fbq('track', ...)`; the server field is `event_id`, at the top level of the individual CAPI event. Meta generally keeps the first receipt when the payloads are materially equivalent. If only one copy arrives, there's no pair to deduplicate. Email, order value, and catalog IDs are not the keys for this method. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ```js fbq('track', 'Purchase', purchaseParams, { eventID: purchaseEventId }); ``` For a custom build, derive `purchaseEventId` on both sides from the same canonical shop and order identifiers, such as `purchase:<shop-key>:<order-key>`. Normalize the order ID representation so a Shopify GraphQL ID and a numeric ID cannot produce different strings. Use a different ID for each distinct action; for mirrored upper-funnel events, generate one ID per occurrence and pass it to both senders. Keep the original ID and timestamp on retries. Separately, prevent duplicate browser fires and make the server job idempotent per shop and order; don't rely on Meta to clean up webhook replays or multiple installs. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 4. Prepare customer information before sending - **Normalize, then SHA-256 hash fields that require it.** For `em`, trim and lowercase the email before hashing. For `ph`, use digits only with the real country calling code, then hash. Apply Meta's field-specific normalization if you send names or location fields. Send lowercase hex digests, omit missing or invalid fields, and do not double-hash. Meta recommends hashing `external_id` if you use it. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) - **Do not hash browser and network match fields.** Send `fbp`, `fbc`, `client_ip_address`, and `client_user_agent` as specified by Meta when available and permitted. Use the actual shopper context, not the Shopify webhook sender's IP or your worker's user agent. Use a real `_fbc` value or derive it from a genuine `fbclid` using Meta's format; don't invent one. Meta documents `client_user_agent` and `event_source_url` for website events, so capture that context lawfully before relying on the order webhook. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) - **Keep customer identifiers in `user_data`.** Do not put raw contact details in `custom_data`, URLs, or operational logs. Strip sensitive query strings from the source URL and keep the CAPI access token on the server. Hashing does not make customer information anonymous or remove the need for permission to share it. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ## 5. Shopify setup: native first, custom only for a specific gap **Recommended for Cedar & Coil: Facebook & Instagram by Meta.** For a small store preparing its first campaign, the native channel provides browser tracking and server-side Purchase delivery without a custom checkout integration, order queue, or retry system to maintain. A custom build gives you control over event IDs, payloads, triggers, and monitoring, but makes you responsible for consent propagation, protected customer data access, and delivery reliability. Choose it only if testing uncovers a concrete gap the native integration cannot close. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) **Native setup** 1. Audit existing Meta emitters in theme code, tag managers, Shopify **Settings → Customer events**, and third-party apps. At cutover, turn off overlapping senders so the native channel owns the event stream. 2. Install or open **Facebook & Instagram by Meta** in Shopify. Connect the intended Meta business assets, ad account, and catalog where applicable. In **Sales channels → Facebook & Instagram → Settings → Data sharing settings**, enable sharing and select the intended pixel/dataset. Verify the ID against Meta Events Manager before testing. 3. Choose **Maximum** if it fits Cedar & Coil's approved data-sharing policy. Shopify currently documents both **Enhanced** and **Maximum** as using Pixel plus CAPI for Purchase; **Standard** is browser-only. Verify behavior in Events Manager rather than inferring it from the setting label. Do not deploy the custom sender below alongside native Purchase delivery. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) **Custom alternative.** Subscribe to Shopify's Web Pixels events for the browser path. For CAPI Purchase, use a Shopify order event that identifies the transition to paid; Shopify documents `orders/paid` for existing webhook integrations and points new builds to Order Events. Verify webhook authenticity, durably enqueue work, and filter for eligible online-store orders. Join the order to permitted checkout context using a stable checkout-to-order mapping. Fire browser `Purchase` only when it represents the same conversion; if payment is delayed, let the paid-order path report it rather than reporting an unpaid checkout as a sale. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?utm_source=openai)) **Server-side Purchase sketch (Node.js).** Here, `p` is a validated paid order joined to permitted checkout context. `p.contents` contains `{id, quantity, item_price}` entries with Meta catalog IDs. The worker supplies timestamps in Unix seconds and uses the same `p.eventId` as the browser. Pin a supported Graph API version in configuration. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ```js import { createHash } from 'node:crypto'; const sha256 = s => createHash('sha256').update(s, 'utf8').digest('hex'); async function sendPurchase(p, { testEventCode } = {}) { if (!p.metaSharingAllowed) return { skipped: 'privacy' }; if (!p.userAgent || !p.sourceUrl) { return { skipped: 'missing required website context' }; } const user_data = { client_user_agent: p.userAgent }; const email = p.email?.trim().toLowerCase(); if (email) user_data.em = [sha256(email)]; if (p.phoneDigitsWithCountryCode) { user_data.ph = [sha256(p.phoneDigitsWithCountryCode)]; } if (p.clientIp) user_data.client_ip_address = p.clientIp; if (p.fbp) user_data.fbp = p.fbp; if (p.fbc) user_data.fbc = p.fbc; const body = { data: [{ event_name: 'Purchase', event_id: p.eventId, event_time: p.paidAtUnixSeconds, action_source: 'website', event_source_url: p.sourceUrl, // Sanitized checkout source URL user_data, custom_data: { value: p.total, currency: p.currency, content_type: 'product', content_ids: [...new Set(p.contents.map(item => item.id))], contents: p.contents } }], ...(testEventCode ? { test_event_code: testEventCode } : {}) }; const { META_API_VERSION, META_PIXEL_ID, META_CAPI_TOKEN } = process.env; const response = await fetch( `https://graph.facebook.com/${META_API_VERSION}/${META_PIXEL_ID}/events`, { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${META_CAPI_TOKEN}` }, body: JSON.stringify(body) } ); const result = await response.json(); if (!response.ok || result.events_received !== 1) { throw new Error(`CAPI send failed: HTTP ${response.status}`); } return { received: result.events_received, traceId: result.fbtrace_id }; } ``` In production, use bounded retries with backoff for transient failures, alert on permanent failures and missing context, and retain the original event ID and timestamp. An API acknowledgment confirms receipt, not deduplication, matching, or attribution. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ## 6. Validate end to end before scaling spend 1. **Run a clean checkout with sharing permitted.** In Meta Events Manager → **Test Events**, follow the Arc Clip Lamp from product view through paid order. For custom CAPI testing, put the Test Events code in the request's top-level `test_event_code` field; remove it from production requests. Check all four event names, the destination dataset, catalog IDs, quantities, and the Purchase amount and currency against the Shopify order. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) 2. **Prove deduplication and fallback separately.** In a normal checkout, verify browser and server Purchase receipts and one processed conversion for that order; for custom tracking, inspect the matching IDs. Then run a second, consented checkout with the Meta browser request blocked and verify that server Purchase still arrives. For custom tracking, replay the order notification and confirm it does not create a second send; reload the confirmation page and confirm it does not create another Purchase. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) 3. **Test edge cases and consent.** Try mobile and any accelerated checkout offered, a discounted or multi-item order, and a session with sharing denied or opted out. Confirm the order still works when sharing is denied and neither path sends events that the shopper's settings prohibit. Check Events Manager diagnostics for deduplication, missing parameters, and match quality where available. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) 4. **Reconcile before scaling.** Compare eligible paid online Shopify orders with processed Meta Purchase events over the same closed window and timezone, allowing for reporting delay. For custom tracking, reconcile order by order against a restricted delivery ledger; for native tracking, use controlled test orders plus aggregate checks. Investigate differences by trigger, consent state, and delivery source. Don't reconcile all Shopify orders directly to Ads Manager's attributed purchases: event receipt and ad attribution answer different questions. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) ## 7. Consent and compliance **CAPI is a delivery path, not a consent bypass.** Configure Shopify's customer privacy settings and any consent banner to reflect the store's requirements. For custom tracking, carry the applicable marketing and data-sharing permission into the server workflow, respect opt-outs and withdrawals, and suppress sends when required permission is absent or cannot be established. A paid order or an email-marketing subscription is not proof of permission to share data with Meta for ads. Update the privacy notice, minimize what you send and retain, restrict access, and have the privacy owner confirm the settings for the markets Cedar & Coil serves. ([shopify.dev](https://shopify.dev/docs/api/customer-privacy?utm_source=openai))
Score · attempt 2 the judge's verdict, criterion by criterion10/11 criteria passed · failed: sources_defined
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓It recommends Pixel plus CAPI to the same dataset with deduplication, and says CAPI gives a second delivery path that "does not depend on the browser loading the confirmation page or reaching Meta"; this covers browser limits only loosely.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The table covers ViewContent, AddToCart, InitiateCheckout and Purchase with content_ids, value, currency and contents, and bolds value/currency/content_ids on 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 posts a body with event_name 'Purchase', event_id, event_time, action_source 'website' and a user_data block 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 separately checks deduplication (matching IDs, one processed conversion, replayed webhook, reloaded confirmation page).
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 tied to the paid-order server path, but for the upper-funnel events it only says "verify which upper-funnel events actually arrive from each source rather than assuming all four are mirrored", so browser versus server origin is not defined 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.
✓No attribution-recovery percentages are promised, it states that "Server delivery improves resilience, but does not guarantee user matching or ad attribution", and Section 7 says CAPI is "not a consent bypass".
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 pixel ID, event name and event ID within 48 hours, with browser `eventID` in the fbq fourth argument and server top-level `event_id`.
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 canonical shop and order identifiers (`purchase:<shop-key>:<order-key>`), shared by both senders, with "Keep the original ID and 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.paidAtUnixSeconds` (Unix seconds from the paid order) and says to retain the original timestamp on retries.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓Email is trimmed and lowercased, then SHA-256 hashed (the code does `p.email?.trim().toLowerCase()` then `sha256`), phone is digits-only with country code and hashed, and fbp, fbc, IP and user agent are not hashed.
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, with numbered setup steps (audit emitters, connect assets, choose data sharing level) and a stated condition for going custom.
✓ Attempt 3
Answer · attempt 3 the model's full response$0.074 · 45.0s · 3.5k tok
# Cedar & Coil: Shopify-to-Meta conversion tracking guide **Draft implementation plan.** Start with Shopify’s **Facebook & Instagram by Meta** sales channel. Use its browser Pixel and server-side Conversions API (CAPI), then verify that one eligible Arc Clip Lamp order counts as one `Purchase` before scaling spend. Use Shopify orders to reconcile sales and Meta Ads Manager to evaluate ad-attributed results; those totals answer different questions. ([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: browser Pixel + server-side CAPI Send both streams to the **same Meta Pixel/data source**. The browser Pixel captures storefront actions and browser context when it can run. CAPI gives an eligible purchase a second delivery path from Shopify’s servers, independent of whether the browser tag fired or the confirmation page loaded. Use both for `Purchase` and deduplicate the two copies. For upstream events, start with the browser stream and verify what the partner integration actually sends server-side rather than assuming all four events are mirrored. CAPI improves delivery resilience; it does not guarantee that Meta can match or attribute a purchase, and it is not a consent bypass. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) ## 2. Standard events and parameters Use Meta’s event names exactly as written. The Shopify event names below are the recommended trigger mapping for a **custom** implementation; validate the native integration against the same customer actions. Send commerce properties in the Pixel event parameters and in CAPI’s `custom_data` for any server copy. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api?utm_source=openai)) | Meta event | Trigger | Key parameters | |---|---|---| | `ViewContent` | Arc Clip Lamp product detail viewed (`product_viewed`), not a collection impression | `content_ids`, `content_type`, `value` for the displayed item price, `currency` | | `AddToCart` | Item successfully added (`product_added_to_cart`), not just an add-button click | `content_ids`, `content_type`, `contents` with ID and quantity, `value` for the items added in that action, `currency` | | `InitiateCheckout` | Customer starts checkout (`checkout_started`) | `content_ids`, `content_type`, `contents`, `num_items` as total quantity, `value` for the checkout at that point, `currency` | | `Purchase` | One eligible completed order, not a payment-button click or a thank-you-page reload | **`value`**, **`currency`**, **`content_ids`**, plus `content_type` and `contents` with purchased IDs and quantities | Use the **exact item IDs in the connected Meta catalog**, including variant IDs if that is how items are listed; don’t assume the Shopify product ID or SKU is the catalog ID. Use `content_type: "product"` for item-level IDs. Send a numeric `value` in major currency units and a three-letter currency code such as `USD`. For a custom `Purchase`, use the actual order total in the customer’s checkout currency, after discounts and including shipping and tax, and mirror that basis in both streams. Don’t hard-code the lamp’s $68 list price: a $68 USD order should send `68.00` and `USD`, but another order may have a different total. With the native channel, inspect and document its actual value basis before using Meta purchase value for reporting. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) ## 3. Exactly how deduplication works Meta compares the **event name and event ID** on the same Pixel. The browser sends the ID as `eventID` in the fourth argument to `fbq`; the server sends the identical string as top-level `event_id` on the CAPI event. Meta deduplicates matching copies received within **48 hours of the first receipt**. If only one copy arrives, there is no duplicate to remove. Customer hashes, catalog IDs, and the order value are not the matching keys for this method. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) For a custom integration, use a stable ID such as `shopify:<shop-key>:purchase:<canonical-order-id>`. Normalize the Shopify order ID the same way in both paths. Reuse the ID and original event timestamp on retries; never mint a new ID on page reload or webhook redelivery. For an upstream event sent both ways, generate one ID per action and pass it to both paths—two legitimate adds of the same variant need two IDs. Keep server-side idempotency as well: Meta deduplication is not your webhook retry strategy. With the native channel, let the integration own the IDs; don’t add an independent sender for the same events. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ```js // Custom browser Purchase, after the Pixel is initialized and sharing is allowed. fbq('track', 'Purchase', purchaseProperties, { eventID: purchaseEventId }); ``` ## 4. Prepare customer information before sending it server-side - **Normalize, then SHA-256 hash** the allowed identifiers that Meta requires hashed. For `em`, trim surrounding whitespace and lowercase the email. For `ph`, use digits only, including the correct country calling code. Follow Meta’s field-specific rules for any additional identifiers, such as name or postal code. Send unsalted SHA-256 hex digests under `user_data`; omit blank or invalid values and don’t hash an already-hashed value again. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) - **Do not hash** `fbp`, `fbc`, `client_ip_address`, or `client_user_agent`. Use the actual customer browser context where available and permitted, not the webhook sender’s IP or your worker’s user agent. Pass the genuine `_fbp` and `_fbc` values when available; construct `fbc` only from a real `fbclid` using Meta’s prescribed format, never from a fabricated click ID. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) - Keep customer identifiers out of `custom_data`, event IDs, page URLs, and routine logs. Send only the fields needed and permitted for matching. Hashing does not make customer information anonymous or remove the need to honor privacy choices. ([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 unless there’s a verified gap **Recommended for Cedar & Coil: the native sales channel.** It provides the Pixel, server-side Purchase delivery, and a connected catalog without requiring Cedar & Coil to maintain a webhook receiver, retry queue, or browser-to-order identity join. A custom integration is justified if testing reveals a business-critical gap, such as a required purchase definition the channel cannot support. It gives you control over triggers and payloads, but makes you responsible for deduplication, consent, data quality, and uptime. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) **Native setup** 1. In Shopify admin, go to **Settings → Sales channels → Shopify App Store**, install **Facebook & Instagram by Meta**, and complete setup with an account that has access to the intended business assets. Confirm the ad account, catalog, and Pixel/data source are the ones Cedar & Coil intends to use. ([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**. Enable sharing, connect the intended Pixel, and choose **Maximum** if approved for the store’s privacy setup. Shopify also documents **Enhanced** as Pixel plus server-side Purchase; **Standard** is browser-only. Use the approved level that meets the measurement requirement. ([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**, theme code, tag managers, and other apps for existing Meta senders. Remove overlapping emitters for this Pixel at cutover, then verify the catalog IDs and events. Don’t deploy the sketch below alongside the native sender for the same Purchase. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api?utm_source=openai)) **Custom alternative.** Subscribe to storefront and checkout events through Shopify Web Pixels. For a paid-order purchase definition, use a verified Shopify `orders/paid` webhook as the server trigger, filter to eligible online-store orders, and queue one job per canonical order ID. Join any permitted browser context to the order and verify the webhook HMAC before processing. Only pair the browser `checkout_completed` event with the paid-order event when both represent the same conversion. If checkout completion can precede payment, don’t fire a browser `Purchase` for an unpaid checkout; use the confirmed server event on that path. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) **Server-side Purchase request sketch (Node.js).** This runs in a worker *after* webhook verification, order validation, and the marketing-sharing check. The worker should supply the actual purchase time, order total, catalog IDs, and permitted customer context. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ```js import { createHash } from 'node:crypto'; const sha256 = s => createHash('sha256').update(s, 'utf8').digest('hex'); async function sendPurchase(order, context, testEventCode) { const { META_GRAPH_VERSION, META_PIXEL_ID, META_CAPI_TOKEN } = process.env; const endpoint = new URL( `https://graph.facebook.com/${META_GRAPH_VERSION}/${META_PIXEL_ID}/events` ); endpoint.searchParams.set('access_token', META_CAPI_TOKEN); const email = context.email?.trim().toLowerCase(); const user_data = { client_user_agent: context.userAgent, ...(email && { em: [sha256(email)] }), ...(context.phoneWithCountryCodeDigits && { ph: [sha256(context.phoneWithCountryCodeDigits)] }), ...(context.fbp && { fbp: context.fbp }), ...(context.fbc && { fbc: context.fbc }), ...(context.ip && { client_ip_address: context.ip }) }; const payload = { data: [{ event_name: 'Purchase', event_id: order.purchaseEventId, // identical to browser eventID event_time: order.purchasedAtUnixSeconds, action_source: 'website', event_source_url: context.sanitizedPurchaseUrl, user_data, custom_data: { value: order.totalInMajorUnits, currency: order.currency, content_type: 'product', content_ids: [...new Set(order.items.map(item => item.catalogId))], contents: order.items.map(item => ({ id: item.catalogId, quantity: item.quantity })) } }], ...(testEventCode && { test_event_code: testEventCode }) }; const response = await fetch(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); const result = await response.json(); if (!response.ok || result.events_received !== 1) { throw new Error(`Meta Purchase not accepted (HTTP ${response.status})`); } return { eventsReceived: result.events_received, traceId: result.fbtrace_id }; } ``` Pin a supported Graph API version and keep the token in server-side secrets. Validate required website fields before sending; don’t invent missing browser context. Retry transient failures with backoff and the same ID and timestamp. Surface permanent errors for review, and redact tokens, token-bearing URLs, and customer data from logs. An accepted response confirms receipt, not deduplication, matching, or attribution. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ## 6. Validate end to end before scaling spend In **Meta Events Manager → Test Events**, select the intended data source. For custom CAPI tests, pass the displayed `test_event_code` at the request-body level; remove it from production sends. Use Meta Pixel Helper or browser network inspection for the browser stream, then check Events Manager for server receipt and deduplication. If a partner-managed server event isn’t visible in the test session, check live event activity and Diagnostics after a controlled order rather than adding a second sender. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) | Test | Pass condition | |---|---| | Accepted marketing consent, normal browser | View the lamp, add it, start checkout, and complete a controlled order. Each event fires at the intended step. Where both Purchase copies arrive, they share an ID and count as one. | | Accepted consent, browser Pixel blocked | The browser copy is missing, but the eligible Purchase still arrives server-side when the integration has the required data. | | Declined consent or applicable opt-out | Both streams honor the configured choice. Inspect outbound requests, not just what the banner displays. | | Reload, repeated cart action, webhook replay | Reloading or replaying doesn’t create another Purchase. A separate successful add-to-cart action produces its own event. | | Discount, multiple units, or alternate currency if offered | Purchase value follows the documented basis, currency matches the order, quantities match, and every `content_ids` entry resolves in the catalog. | Run the core flow on desktop and mobile and through any accelerated checkout you offer. Review Diagnostics, browser/server coverage, deduplication, and Event Match Quality where available; match quality is not proof of correct counting. Before scaling, reconcile controlled Shopify orders one by one against Meta event receipt. For ongoing reporting, compare eligible Shopify orders and Meta event counts over the same closed window, excluding tests and documenting consent-related gaps. Don’t expect Ads Manager’s attributed purchases to equal Shopify orders, and don’t calculate efficiency using spend and conversions from different windows. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ## 7. Consent and compliance Configure Shopify Customer Privacy settings or a compatible consent platform, and make sure the same marketing-sharing decision governs both Pixel and CAPI. In a custom build, carry that decision into the server workflow: receiving an order webhook is **not** permission to send an advertising event. Honor applicable opt-outs and withdrawals, disclose Meta sharing in the privacy notice, and limit access to and retention of customer data and logs. Have the store’s privacy owner confirm the regional requirements and approved sharing level before production use. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai))
Score · attempt 3 the judge's verdict, criterion by criterion11/11 criteria passed
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends browser Pixel plus CAPI with deduplication, and says CAPI gives a second delivery path independent of whether the browser tag fired or the confirmation page loaded.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The table covers ViewContent, AddToCart, InitiateCheckout and Purchase with key parameters, and Purchase lists bold 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 has event_name 'Purchase', event_time, event_id, action_source 'website', and a user_data block.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Events Manager Test Events with test_event_code and checks that duplicate Purchase copies share an ID and count as one, with deduplication checked in Events Manager.
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 trigger events for the browser side, and the custom path uses the orders/paid webhook as the server Purchase trigger, though upstream-event server-side firing is left as 'verify'.
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 CAPI 'does not guarantee that Meta can match or attribute a purchase' and 'is not a consent bypass', 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.
✓Section 3 says Meta compares event name and event ID, with browser eventID and server event_id as the identical string, and a 48-hour window.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓It uses a stable ID `shopify:<shop-key>:purchase:<canonical-order-id>` and says 'never mint a new ID on page reload or webhook redelivery'.
event_time_stable
The server Purchase event uses the purchase/order occurrence timestamp in Unix seconds and preserves it across retries; using the current send or retry time fails.
✓The code uses order.purchasedAtUnixSeconds, and the text says to 'Reuse the ID and original event timestamp on retries' and to retry 'with 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.
✓Email is trimmed and lowercased then SHA-256 hashed in both text and code, phone is digits-only and hashed, and fbp, fbc, IP and user agent are not hashed.
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 with numbered steps and Maximum/Enhanced data sharing, and compares it against a custom build.