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

Answers & verdicts

GPT-6.2 Astra high effort

Task failed
Task the exact prompt the model was given — assignment, source material, and skill guidance
Cedar & Coil sells the Arc Clip Lamp on Shopify and is preparing Meta ads. Write an implementation guide a technical marketer can follow to get reliable conversion tracking from the Shopify store into Meta, resilient to browser privacy limits. Cover, with labeled sections: (1) recommended architecture - browser Meta Pixel plus server-side Conversions API with deduplication - and why both are needed; (2) which standard events to send (ViewContent, AddToCart, InitiateCheckout, Purchase) with the key parameters for each, including value, currency, and content_ids on Purchase; (3) exactly how deduplication works between Pixel and CAPI; (4) how customer information must be prepared before sending server-side; (5) the concrete Shopify setup path - compare the native Meta sales channel app against a custom implementation, recommend one for a small DTC store, and include a code sketch of a server-side Purchase event request; (6) how to validate the setup end to end before scaling spend; (7) a consent and compliance note. Do not promise specific attribution recovery percentages. --- ## Supplied source: product-marketing.md # Cedar & Coil Cedar & Coil is a fictional direct-to-consumer brand for people who work or make things in compact spaces. Its first product is the Arc Clip Lamp, a rechargeable task light designed to move between a desk, shelf, and bedside. The approved positioning is adaptable light without surrendering permanent surface space. The voice is practical, warm, and visually specific—not luxury, medical, or productivity-maximizing. All campaign work must remain draft-only. Do not invent reviews, awards, scarcity, environmental claims, performance guarantees, or customer results. --- ## Supplied source: facts.md # Authoritative synthetic facts - Product: Arc Clip Lamp. - Price: $68. - Included: lamp, padded clamp, USB-C charging cable, and storage sleeve. - Lighting: three brightness settings and two color-temperature settings. - Battery statement allowed: up to eight hours on the lowest brightness. - Clamp opening: surfaces up to 2.25 inches thick. - Audience: renters, students, and makers with limited desk or counter space. - Approved CTA: Explore the Arc Clip Lamp. - No campaign has launched and no performance data exists. --- ## Skill guidance you should follow --- name: analytics description: "Set up or audit tracking — GA4, GTM, Mixpanel, Segment; tracking plans, event naming, UTM conventions, conversion and attribution debugging. Rate metrics divide matching closed windows — never full-period spend by partial-period results." metadata: version: 2.2.0 --- # Analytics Tracking You are an expert in analytics implementation and measurement. Your goal is to help set up tracking that provides actionable insights for marketing and product decisions. ## Initial Assessment **Check for product marketing context first:** If `.agents/product-marketing.md` exists (or `.claude/product-marketing.md`, or the legacy `product-marketing-context.md` filename, in older setups), read it before asking questions. Use that context and only ask for information not already covered or specific to this task. **Apply the project's brand:** If `BRAND.md` exists, read it before asking questions and apply it to everything you produce — its voice, messaging, and audience for anything written, and its colors, typography, and logo for anything visual. Never ask for a brand fact it already answers. If it lacks something you need, name the missing fact instead of inventing one or quietly falling back to a generic default. Before implementing tracking, understand: 1. **Business Context** - What decisions will this data inform? What are key conversions? 2. **Current State** - What tracking exists? What tools are in use? 3. **Technical Context** - What's the tech stack? Any privacy/compliance requirements? --- ## Core Principles ### 1. Track for Decisions, Not Data - Every event should inform a decision - Avoid vanity metrics - Quality > quantity of events ### 2. Start with the Questions - What do you need to know? - What actions will you take based on this data? - Work backwards to what you need to track ### 3. Name Things Consistently - Naming conventions matter - Establish patterns before implementing - Document everything ### 4. Maintain Data Quality - Validate implementation - Monitor for issues - Clean data > more data ### 5. Compute, Don't Eyeball - Derive every total, rate, and delta from row-level data with a script or spreadsheet — never by scanning rows and summing mentally. One silently dropped row corrupts every figure downstream of it. - Cross-check each headline figure a second, independent way (a reconciliation total, a recomputation from a different grouping) before reporting it, and chase any mismatch to the exact row. - When a claim is about one segment — a single campaign, ad set, channel, or week — report that segment's own numbers. Never fold it into a neighboring group and let the group's total speak for it. ### 6. Match Observation Windows - A rate or efficiency metric divides a numerator and denominator that cover the same closed observation window. Never divide a full period's spend by a partial period's conversions or revenue — restate both over the weeks that actually have data, and say which weeks those are. - Cohort rates use only cohorts whose observation window has ended. A trial or signup still inside its window is pending, not failed — exclude it from the denominator and label it as pending rather than counting it against the rate. ### 7. Recommend Against the Stated Goal - Analysis ends in a recommendation, and the recommendation must be argued from the goal the brief states — the launch target, audience, revenue, or positioning objective — not only from what is operationally easiest. Name which stated goal each option serves and what it trades away. --- ## Tracking Plan Framework ### Structure ``` Event Name | Category | Properties | Trigger | Notes ---------- | -------- | ---------- | ------- | ----- ``` ### Event Types | Type | Examples | |------|----------| | Pageviews | Automatic, enhanced with metadata | | User Actions | Button clicks, form submissions, feature usage | | System Events | Signup completed, purchase, subscription changed | | Custom Conversions | Goal completions, funnel stages | **For comprehensive event lists**: See [references/event-library.md](references/event-library.md) --- ## Event Naming Conventions ### Recommended Format: Object-Action ``` signup_completed button_clicked form_submitted article_read checkout_payment_completed ``` ### Best Practices - Lowercase with underscores - Be specific: `cta_hero_clicked` vs. `button_clicked` - Include context in properties, not event name - Avoid spaces and special characters - Document decisions --- ## Essential Events ### Marketing Site | Event | Properties | |-------|------------| | cta_clicked | button_text, location | | form_submitted | form_type | | signup_completed | method, source | | demo_requested | - | ### Product/App | Event | Properties | |-------|------------| | onboarding_step_completed | step_number, step_name | | feature_used | feature_name | | purchase_completed | plan, value | | subscription_cancelled | reason | **For full event library by business type**: See [references/event-library.md](references/event-library.md) --- ## Event Properties ### Standard Properties | Category | Properties | |----------|------------| | Page | page_title, page_location, page_referrer | | User | user_id, user_type, account_id, plan_type | | Campaign | source, medium, campaign, content, term | | Product | product_id, product_name, category, price | ### Best Practices - Use consistent property names - Include relevant context - Don't duplicate automatic properties - Avoid PII in properties --- ## GA4 Implementation ### Quick Setup 1. Create GA4 property and data stream 2. Install gtag.js or GTM 3. Enable enhanced measurement 4. Configure custom events 5. Mark conversions in Admin ### Custom Event Example ```javascript gtag('event', 'signup_completed', { 'method': 'email', 'plan': 'free' }); ``` **For detailed GA4 implementation**: See [references/ga4-implementation.md](references/ga4-implementation.md) --- ## Google Tag Manager ### Container Structure | Component | Purpose | |-----------|---------| | Tags | Code that executes (GA4, pixels) | | Triggers | When tags fire (page view, click) | | Variables | Dynamic values (click text, data layer) | ### Data Layer Pattern ```javascript dataLayer.push({ 'event': 'form_submitted', 'form_name': 'contact', 'form_location': 'footer' }); ``` **For detailed GTM implementation**: See [references/gtm-implementation.md](references/gtm-implementation.md) --- ## UTM Parameter Strategy ### Standard Parameters | Parameter | Purpose | Example | |-----------|---------|---------| | utm_source | Traffic source | google, newsletter | | utm_medium | Marketing medium | cpc, email, social | | utm_campaign | Campaign name | spring_sale | | utm_content | Differentiate versions | hero_cta | | utm_term | Paid search keywords | running+shoes | ### Naming Conventions - Lowercase everything - Use underscores or hyphens consistently - Be specific but concise: `blog_footer_cta`, not `cta1` - Document all UTMs in a spreadsheet --- ## Debugging and Validation ### Testing Tools | Tool | Use For | |------|---------| | GA4 DebugView | Real-time event monitoring | | GTM Preview Mode | Test triggers before publish | | Browser Extensions | Tag Assistant, dataLayer Inspector | ### Validation Checklist - [ ] Events firing on correct triggers - [ ] Property values populating correctly - [ ] No duplicate events - [ ] Works across browsers and mobile - [ ] Conversions recorded correctly - [ ] No PII leaking ### Common Issues | Issue | Check | |-------|-------| | Events not firing | Trigger config, GTM loaded | | Wrong values | Variable path, data layer structure | | Duplicate events | Multiple containers, trigger firing twice | --- ## Privacy and Compliance ### Considerations - Cookie consent required in EU/UK/CA - No PII in analytics properties - Data retention settings - User deletion capabilities ### Implementation - Use consent mode (wait for consent) - IP anonymization - Only collect what you need - Integrate with consent management platform --- ## Output Format ### Tracking Plan Document ```markdown # [Site/Product] Tracking Plan ## Overview - Tools: GA4, GTM - Last updated: [Date] ## Events | Event Name | Description | Properties | Trigger | |------------|-------------|------------|---------| | signup_completed | User completes signup | method, plan | Success page | ## Custom Dimensions | Name | Scope | Parameter | |------|-------|-----------| | user_type | User | user_type | ## Conversions | Conversion | Event | Counting | |------------|-------|----------| | Signup | signup_completed | Once per session | ``` --- ## Task-Specific Questions 1. What tools are you using (GA4, Mixpanel, etc.)? 2. What key actions do you want to track? 3. What decisions will this data inform? 4. Who implements - dev team or marketing? 5. Are there privacy/consent requirements? 6. What's already tracked? --- ## Tool Integrations For implementation, see the [tools registry](../../tools/REGISTRY.md). Key analytics tools: | Tool | Best For | MCP | Guide | |------|----------|:---:|-------| | **GA4** | Web analytics, Google ecosystem | ✓ | [ga4.md](../../tools/integrations/ga4.md) | | **Mixpanel** | Product analytics, event tracking | - | [mixpanel.md](../../tools/integrations/mixpanel.md) | | **Amplitude** | Product analytics, cohort analysis | - | [amplitude.md](../../tools/integrations/amplitude.md) | | **PostHog** | Open-source analytics, session replay | - | [posthog.md](../../tools/integrations/posthog.md) | | **Segment** | Customer data platform, routing | - | [segment.md](../../tools/integrations/segment.md) | --- ## Related Skills - **ab-testing**: For experiment tracking - **seo-audit**: For organic traffic analysis - **cro**: For conversion optimization (uses this data) - **revops**: For pipeline metrics, CRM tracking, and revenue attribution
✓ Attempt 1
Answer · attempt 1 the model's full response$0.72 · 115.8s · 5.5k tok
# Cedar & Coil | Shopify → Meta conversion tracking guide **Draft only — no campaign has launched.** For the Arc Clip Lamp, use Shopify’s native **Facebook & Instagram by Meta** sales channel with **Enhanced** data sharing, subject to privacy approval. That gives a small store the two paths it needs most: the Pixel for shopping activity and a server-side `Purchase` that does not depend on the buyer loading the confirmation page. The acceptance test is **one eligible Shopify order → one Meta `Purchase`, with the correct amount, currency, and catalog item**. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) ## 1. Recommended architecture: two delivery paths, one conversion | Path | What it contributes | Where it falls short | |---|---|---| | **Browser: Shopify customer event → Meta Pixel** | Captures the product view, successful cart addition, and checkout start as they happen, with available browser and ad-click context. | A blocker can stop the request, cookies can be restricted, and the buyer can close the page before the purchase callback fires. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels)) | | **Server: Shopify order → Meta Conversions API (CAPI)** | Reports an eligible website order from Shopify’s records even if the browser `Purchase` request never reaches Meta. | An order record cannot establish that a product view or cart addition happened. Server delivery also does not guarantee that Meta can match the buyer or attribute the sale to an ad. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) | Send both paths to the **same Meta pixel/dataset**. Make `Purchase` the primary conversion; use the other three events to locate funnel drop-off. Shopify explicitly documents server-side `Purchase` for Enhanced and Maximum. **Verify**, rather than assume, which earlier events the installed channel also sends from the server. A custom implementation can mirror an earlier event when it observes the actual action and can share its ID across both paths. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/get-started/)) ## 2. Standard events and parameters Use Meta’s exact, case-sensitive event names. The table is the tracking contract: inspect the native channel against it, or implement it directly on the custom path. On Pixel, the commerce fields go in the `fbq` event-parameters object; on CAPI, they go in `custom_data`. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | Meta event | Shopify trigger | Key parameters and meaning | |---|---|---| | `ViewContent` | `product_viewed` on the Arc Clip Lamp detail page, not every page view | `content_ids`: viewed catalog item; `content_type`: `product` for an item-level ID; `value`: displayed unit price; `currency`: display currency. An undiscounted US view would be `68.00`, `USD`. | | `AddToCart` | `product_added_to_cart`, **after** the cart addition succeeds | `content_ids` and/or `contents` identifying the item added; `contents` can carry `id` and `quantity`. Use `value` for the quantity **just added**, not the whole cart; send its `currency` and `content_type`. | | `InitiateCheckout` | `checkout_started`, not each checkout step | `content_ids` for the checkout lines, `num_items` as the sum of quantities, `value` as the checkout total then known, and `currency`. | | `Purchase` | Completed online checkout, once per order; never a Pay-button click or a thank-you-page refresh | **`value`**: numeric final order total; **`currency`**: the order’s three-letter presentment currency; **`content_ids`**: array of purchased catalog item IDs. Include `content_type`; `num_items` is useful for quantity checks. | **Two checks matter more than the example price.** First, copy the Arc Clip Lamp’s actual retailer/item ID from the connected Meta catalog. Do not assume it is the Shopify product ID, variant ID, SKU, or product name. Use `product_group` only if sending group IDs. Second, read the order’s **amount and currency as a pair**. Do not hard-code `$68`, send cents as dollars, or mix a shop-currency amount with a presentment-currency code. Shopify documents its native order-value basis as the order total reflecting discounts, taxes, and duties; validate shipping treatment against an order with a shipping charge. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/custom-data)) ## 3. Exactly how deduplication works Meta’s recommended method matches **the same dataset, the same event name, and the same event ID**. For an illustrative order, the browser and server copies would look like this: ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ```js // Browser: eventID belongs in the FOURTH argument, not in purchaseParams. fbq("track", "Purchase", purchaseParams, { eventID: "cc:purchase:12345" }); // CAPI: these are fields on the event itself, not inside custom_data. { event_name: "Purchase", event_id: "cc:purchase:12345" } ``` - **One action, one ID.** For a custom `Purchase`, derive the ID on both sides from the same immutable Shopify order ID. Normalize its representation first: a Shopify GID on one side and a bare numeric string on the other must produce the same result. For a repeated action such as adding another lamp, generate a new occurrence ID and pass it to both senders. Never use the lamp’s catalog ID or the buyer’s email as the event ID. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) - **Send both copies promptly.** Meta documents a 48-hour matching window. A matched browser/server pair represents one event; if only the server copy arrives, it needs no counterpart to be processed. Keep the commerce parameters identical rather than depending on which copy Meta retains. Customer matching fields such as email serve a different purpose from this event-ID match. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) - **Prevent duplicates at the source, too.** The native channel should own both copies. For custom delivery, store one outbound job per `(dataset, event_name, event_id)` with a uniqueness constraint. A webhook redelivery must not create a second job; a transient API failure must retry the original ID **and occurrence time**, not generate new ones. ([shopify.dev](https://shopify.dev/docs/apps/build/webhooks/verify-deliveries)) ## 4. Prepare customer information before server-side transmission Put permitted matching information in **`user_data`**, not in `custom_data`, event IDs, or URLs. For a direct HTTP integration, normalize first, then hash each applicable field separately with **unsalted SHA-256**, encoded as lowercase hex. If a partner integration or SDK already hashes a field, do not hash it again. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | Field | Preparation | |---|---| | `em`, `ph` | Email: trim surrounding whitespace and lowercase, then hash. Phone: validate with the known country, normalize to international digits including country code, remove formatting, then hash. Omit missing or ambiguous values. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | | Optional name, location, `external_id` | If approved and needed, follow Meta’s field-specific rules before hashing: for example, lowercase two-letter country and five-digit US ZIP. For a stable first-party customer `external_id`, hashing is recommended; use the same representation across integrations. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | | `client_user_agent`, `client_ip_address`, `fbp`, `fbc` | **Do not hash.** Use the shopper’s actual browser user agent and, if permitted and available, shopper IP—not the Shopify webhook sender’s or your worker’s. Use the observed `_fbp` and `_fbc` values; `fbc` can also be formed from a genuine incoming `fbclid` using Meta’s format. Do not invent a click ID for organic traffic. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | For website CAPI events, include `action_source: "website"`, the actual event’s sanitized `event_source_url`, and `user_data.client_user_agent`. Remove email addresses, checkout access tokens, and other secrets from URL paths or queries. If required context or permission is missing, flag the event rather than fabricating a value. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters)) ## 5. Shopify setup: native channel versus custom implementation **Recommended — native channel.** It meets the immediate goal of reliable order measurement without making Cedar & Coil responsible for a webhook service, credentials, retries, and API upgrades. Use custom delivery only if testing reveals a material requirement the channel cannot meet—for example, a paid-only purchase definition or a required server-side funnel event. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) 1. In Shopify Admin, go to **Settings → Sales channels → Shopify App Store**. Add **Facebook & Instagram by Meta**. Start setup, connect the authorized Facebook account, and select Cedar & Coil’s business assets. Confirm the intended ad account, catalog, and pixel/dataset IDs rather than relying on their display names. ([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**. Activate customer data sharing, select **Enhanced**, and connect the intended pixel. **Standard** is browser-only; **Enhanced** and **Maximum** both document Pixel plus CAPI `Purchase`. Maximum is not necessary merely to turn on server-side purchases. Review the data-sharing choice before enabling it. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) 3. Audit **Settings → Customer events**, theme code, tag-manager containers, and tracking apps. Remove or disable competing Meta senders for the same events. **Do not install the sample below on top of the native channel.** ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) **Custom alternative.** Configure a consent-aware browser pixel under **Settings → Customer events** and subscribe to the Shopify events in section 2. For an *order-placed* definition, pair `checkout_completed` with a verified `orders/create` webhook filtered to completed online-store checkouts—not POS, draft, or manually created orders. If the business instead requires *paid* purchases, use `orders/paid` and fire the browser copy only when payment is confirmed; a delayed payment can legitimately be server-only. Verify the webhook HMAC over the raw request body, join it to the permitted checkout context and consent decision, and enqueue the job before acknowledging delivery. Obtain a server-only token in **Meta Events Manager → dataset → Settings → Conversions API → Generate access token**. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage?utm_source=openai)) **Server-side `Purchase` request sketch — custom path only.** Here `j` is the validated queued job, not an untrusted browser payload. Its total and line items come from Shopify; its URL and browser context come from the corresponding checkout. Pin a supported Graph API version in configuration. ([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(j, cfg) { if (!(await cfg.mayShareWithMeta(j))) return "suppressed"; // recheck on retries const email = j.permittedEmail?.trim().toLowerCase(); const event = { event_name: "Purchase", event_id: `cc:purchase:${j.canonicalOrderId}`, // identical to browser eventID event_time: j.occurredAtUnixSeconds, // not webhook delivery time action_source: "website", event_source_url: j.safeCheckoutUrl, user_data: { client_user_agent: j.browserUserAgent, ...(email && { em: [sha256(email)] }), ...(j.permittedShopperIp && { client_ip_address: j.permittedShopperIp }), ...(j.fbp && { fbp: j.fbp }), ...(j.fbc && { fbc: j.fbc }) }, custom_data: { value: j.presentmentTotal, // validated number in major units currency: j.presentmentCurrency, content_ids: [...new Set(j.lines.map(x => x.catalogItemId))], content_type: "product" } }; const body = { data: [event] }; if (cfg.isTest && cfg.testEventCode) body.test_event_code = cfg.testEventCode; const res = await fetch( `https://graph.facebook.com/${cfg.graphVersion}/${cfg.datasetId}/events`, { method: "POST", headers: { Authorization: `Bearer ${cfg.serverOnlyToken}`, "Content-Type": "application/json" }, body: JSON.stringify(body) } ); const ack = await res.json(); if (!res.ok || ack.events_received !== 1) throw new Error(`CAPI delivery failed: HTTP ${res.status}, code ${ack.error?.code ?? "unknown"}`); return "accepted"; // receipt, not proof of deduplication or ad attribution } ``` Keep the token in a server secret store. Retry transient failures with backoff; route invalid payloads and authorization errors for correction. Log the event ID, status, and trace ID—not the token, full payload, or customer identifiers. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/get-started/)) ## 6. End-to-end validation before scaling spend Use a test store and separate test dataset with no live ads. Open **Shopify Admin → Settings → Customer events → pixel → Test** and **Meta Events Manager → Data Sources → test dataset → Test Events**. For custom CAPI, put `test_event_code` at the **top level** of the request and remove it for production. The code makes events visible for debugging; **it does not discard them or isolate them from measurement**. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels)) | Test | Pass condition | |---|---| | **Consented checkout, desktop and mobile** | View the lamp, add it, start checkout, and complete a test order. Inspect names, connection methods, IDs, values, and currencies. For `Purchase`, confirm browser and server receipt **and** matching IDs in Meta; check **Event Details → Event Deduplication**. Two raw receipts are not two sales. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels)) | | **Amount and catalog check** | Place a second test order with two lamps and a discount; include shipping/tax if applicable. Compare the event to that exact Shopify order, not `68 × quantity`. Verify the ID resolves to the lamp in the connected catalog. A second actual order must have a different event ID. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) | | **Browser loss versus consent denial** | With sharing allowed, block only the Meta browser request: the eligible server `Purchase` should still arrive. In a separate session, deny advertising consent or exercise an applicable sharing opt-out: expect **neither** advertising path to send. Test withdrawal before a queued retry, too. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) | | **False positives and replays** | Abandon checkout without placing an order: no `Purchase`. Refresh the order-status page: no new purchase. On the custom path, replay the same verified webhook: no second outbound job. ([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)) | **Release gate:** Reconcile eligible Shopify order IDs, counts, and totals by currency for the **same closed time window and time zone**. Compare against the custom delivery ledger where available and Meta’s deduplication diagnostics—not raw Browser + Server totals or Ads Manager attributed sales. Investigate each unexplained test-order discrepancy. Review **Diagnostics**, **Event Match Quality**, and event freshness; match quality is not proof that values or counts are correct. Keep ads draft-only until the purchase, privacy, and replay tests pass. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ## 7. Consent and compliance Configure **Shopify Admin → Settings → Customer privacy** and connect any third-party consent platform to Shopify’s Customer Privacy API. Gate both paths on the applicable marketing and data-sharing permissions. Where prior opt-in is required, wait for it; where sale/sharing or targeted-advertising opt-outs apply, honor them, including applicable **Global Privacy Control** signals. Completing a purchase or subscribing to email is not permission for Meta advertising. A custom order worker must enforce the decision itself rather than assuming the browser banner governs a webhook. ([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, its purpose, the data categories, and how customers can change their choice. Minimize fields and retention, restrict access, and have the applicable regional settings and Meta Business Tools terms reviewed before activation. **Hashing is for matching, not anonymization; server-side delivery is for reliability, not a way around a customer’s choice.** ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters))
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 sets out a browser Pixel path and a server CAPI path sent to the same dataset, explains each path's shortfall (blockers, restricted cookies, closed page), and section 3 covers deduplication.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase explicitly carries value, currency and content_ids.
code_sketch
A concrete server-side Purchase event code sketch or request example is included showing event_name, event_time, event_id, action_source, and a user_data block.
✓The sendPurchase sketch includes event_name "Purchase", event_id, event_time, action_source "website" and a user_data block.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Meta Events Manager Test Events and says to check "Event Details → Event Deduplication" and that "Two raw receipts are not two sales".
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).
✓Funnel events are tied to Shopify customer events in the browser, while server Purchase comes from the Shopify order record/orders webhook "even if the browser Purchase request never reaches Meta", with a caveat to verify what the native channel 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.
✓No attribution-recovery percentages are given; the guide says server delivery "does not guarantee" matching or attribution, and section 7 treats consent and regional opt-outs as gating what is 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, event name and event ID, with fbq eventID in the fourth argument and event_id on the CAPI event, matched within 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.
✓The Purchase event ID is derived from the immutable Shopify order ID on both sides, uniquely constrained per job, and a transient failure must "retry the original ID and occurrence time, not generate new ones".
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: j.occurredAtUnixSeconds with the comment "not webhook delivery time", and the retry guidance preserves the original occurrence time.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓Email is trimmed, lowercased and SHA-256 hashed (sha256(email)), 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).
✓It recommends the native Facebook & Instagram channel with Enhanced data sharing, gives numbered Admin steps, and states when to choose custom instead.
✗ Attempt 2
Answer · attempt 2 the model's full response$0.61 · 107.0s · 5.0k tok
# Cedar & Coil | Shopify → Meta conversion tracking guide **Draft only.** For the Arc Clip Lamp, use Shopify’s **Facebook & Instagram by Meta** sales channel as the sole Meta tracking integration. The acceptance test is simple: **one eligible Shopify order produces one Meta `Purchase`, at the actual order value, even if the browser copy is missing.** A shopper who declines the relevant tracking should produce neither copy. No campaign spend is needed to test this. ([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 - **Browser — Meta Pixel:** Records what the shopper does: views the lamp, adds it to the cart, starts checkout, and completes the purchase. It supplies browser context when available. But a blocked Pixel request or a confirmation page that never loads can leave the browser record incomplete. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) - **Server — Conversions API (CAPI):** Reports an eligible purchase from Shopify’s order data to the **same Meta pixel/dataset**. This path does not require the shopper’s browser to deliver the Meta request. It is most useful when the order succeeds but the browser signal does not. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) - **Where both paths report the same action:** Use a shared event ID so Meta counts one conversion, not two. Shopify documents server-side `Purchase` for its CAPI-enabled settings; do **not** assume it also sends all three earlier events server-side. Verify the connection method for each event in Events Manager. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 2. Standard events and parameter contract Use Meta’s exact, case-sensitive event names. In a custom setup, the Shopify event names below are the source triggers, not the names sent to Meta. Use numeric amounts in major currency units (`68.00`, not `6800` or `"$68"`), paired with the shopper’s actual three-letter currency code. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?who=publisher&utm_source=openai)) | Meta event | Shopify trigger | Parameters and value rule | |---|---|---| | `ViewContent` | `product_viewed` on the Arc Clip Lamp detail page | `content_ids`: viewed catalog item; `content_type`: `product` for an individual item; `value`: displayed unit price; `currency`: displayed currency. For the supplied US price, `68.00`, `USD`. | | `AddToCart` | `product_added_to_cart`, after a successful add, not merely a button click | Identify the added item and quantity with `contents` (`id`, `quantity`); include `content_type`, `value`, and `currency`. Value the **quantity just added**, not the whole cart. | | `InitiateCheckout` | `checkout_started`, when the shopper enters checkout | `content_ids` or `contents` for the checkout lines; `num_items`: sum of quantities; `value`: checkout total at entry; `currency`: checkout currency. Do not fire again on each checkout step. | | `Purchase` | Completed online-store order; count once per order, not per thank-you-page view | **`value`**: actual final Shopify order total; **`currency`**: currency of that total; **`content_ids`**: array of purchased catalog item IDs. Include `content_type`; on CAPI, `order_id` is useful for reconciliation. Never substitute the lamp’s $68 list price for the order total. | **Catalog and revenue checks:** Copy the lamp’s item ID from the connected Meta catalog; do not guess that it is the Shopify SKU, product ID, or variant ID. If the feed uses variant-level items, send those exact IDs as strings. Use the same order-total definition on both paths and in the Shopify comparison: discounts, quantities, shipping, taxes, and duties can make the final total differ from list price. Meta requires `value` and `currency` on `Purchase`; Cedar & Coil’s contract also calls for `content_ids` so the sale resolves to the advertised item. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) ## 3. Exactly how deduplication works Meta’s recommended key is **same pixel ID + same event name + same event ID**. The two copies must arrive within **48 hours of the first receipt**. The browser field is `eventID`, in the **fourth** argument to `fbq`; the server field is `event_id`, directly on the event, **not** inside `custom_data`. Send promptly rather than treating 48 hours as a delivery target. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ```js // Custom path only. Both sides use the same canonical Shopify order ID string. const id = `cc:purchase:${canonicalOrderId}`; fbq("track", "Purchase", {value: orderTotal, currency: orderCurrency, content_ids: catalogItemIds, content_type: "product"}, {eventID: id}); ``` The matching CAPI event has `event_name: "Purchase"` and `event_id: id`. **One order gets one ID for its lifetime.** Normalize the order ID the same way on both sides—for example, use the numeric part as a string rather than a Shopify global ID on one side and a display order number on the other. For a repeated action such as adding the lamp twice, use a **new ID per successful add**, but share that ID between the two copies of that add. Email, `fbp`, price, and `custom_data.order_id` are not substitutes for the event ID in this design. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) **Prevent duplicates at the source, too.** In a custom implementation, persist a unique send record keyed by `(dataset, event_name, event_id)`. A webhook replay must not create a second job; a retry of an unacknowledged request must reuse the original ID **and** event time. With the native channel, let it own both copies—do not add the snippet above. ([shopify.dev](https://shopify.dev/docs/apps/build/webhooks/verify-deliveries?utm_source=openai)) ## 4. Prepare customer information before sending it server-side Put permitted matching identifiers in **`user_data`**, separate from product and revenue fields in `custom_data`. For a direct HTTP implementation: ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) | Field | Preparation | |---|---| | `em`, `ph` | Trim and lowercase email. Parse phone using its known country, then keep international digits including country code, without `+`, punctuation, or a domestic trunk prefix. Hash each normalized value **once** with unsalted SHA-256; send lowercase hexadecimal. Omit missing or invalid values rather than hashing an empty string. | | Optional name, location, `external_id` | If permitted and needed, normalize each name/location field by Meta’s field-specific rule and hash it separately. For example, `country` is a lowercase two-letter code before hashing. Meta recommends hashing a stable merchant `external_id`; keep its representation consistent across channels. | | `client_user_agent`, `client_ip_address`, `fbp`, `fbc` | **Do not hash.** Use the shopper’s actual browser user agent and, if permitted and available, their IP—not Shopify’s webhook IP or the worker’s user agent. Map `_fbp` and `_fbc` cookie values to `fbp` and `fbc`. Only construct `fbc` from a real observed `fbclid`; omit it for a visit with no click signal. | Meta requires the client user agent for website CAPI events, along with `action_source` and `event_source_url`. If a required field is unavailable, diagnose the collection gap rather than inventing a value. If using an SDK that hashes contact fields automatically, do not pre-hash them again. Keep contact details and checkout access tokens out of event IDs, URLs, product fields, and logs. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ## 5. Shopify setup: native channel versus custom implementation **Recommended — native channel.** It gives a small DTC store the two things it needs most: an order-backed `Purchase` and one integration responsible for both delivery paths. The tradeoff is less control over event triggers and payloads. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) 1. **Audit existing senders first.** Check Shopify **Settings → Customer events**, theme code, tag-manager containers, and tracking apps for an existing Meta Pixel or CAPI sender. Record its pixel ID. Plan to disable overlapping senders when the channel takes ownership. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels?utm_source=openai)) 2. In **Shopify admin → Settings → Sales channels → Shopify App Store**, add **Facebook & Instagram by Meta**. Choose **Start setup → Connect account**. Connect Cedar & Coil’s business assets; confirm the intended ad account, catalog, and pixel rather than creating a second pixel by accident. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 3. In **Sales channels → Facebook & Instagram → Settings → Data sharing settings**, enable customer data sharing, choose a level approved for the store, and **Connect** the intended pixel. Shopify lists **Standard** as browser-only and both **Enhanced** and **Maximum** as Pixel + CAPI for `Purchase`. Start with **Enhanced** if the installed channel describes that behavior and the data sharing is approved. Maximum is not necessary just to get server-side `Purchase`. Verify rather than relying on the setting’s name. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) **Custom alternative.** Choose this only for a concrete requirement the native channel cannot meet—for example, recognizing only **paid** orders when payment can be delayed. Use Shopify Customer Events for the browser funnel and a verified `orders/paid` webhook for the server purchase. For that policy, let `checkout_completed` send a browser `Purchase` only when the backend confirms paid status; otherwise let the later paid webhook stand alone. Store the permitted checkout context and privacy decision against the checkout/order **before** the confirmation page, so closing that page does not break the server path. Verify Shopify’s HMAC on the raw webhook body, durably enqueue once, then acknowledge Shopify. This route makes Cedar & Coil responsible for consent, secrets, retries, and monitoring. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?who=publisher&utm_source=openai)) **Server-side `Purchase` request sketch — custom route only.** Here `j` is a validated job for a paid online-store order, not a raw webhook. Its total, currency, catalog IDs, and payment timestamp come from the order; its permitted browser fields come from the associated checkout. Keep the CAPI token server-side and pin a supported Graph API version. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ```python import hashlib, os, requests def send_purchase(j, sharing_allowed_now, test_event_code=None): if not (j.sharing_allowed_at_event and sharing_allowed_now): return "suppressed" user = {"client_user_agent": j.shopper_user_agent} if j.email and j.email.strip(): # permitted, validated email email = j.email.strip().lower().encode("utf-8") user["em"] = [hashlib.sha256(email).hexdigest()] for key in ("client_ip_address", "fbp", "fbc"): if j.permitted_context.get(key): user[key] = j.permitted_context[key] # genuine values; never hashed event = { "event_name": "Purchase", "event_id": f"cc:purchase:{j.canonical_order_id}", "event_time": j.paid_at_unix_seconds, # original time, even on retry "action_source": "website", "event_source_url": j.safe_checkout_url, # real URL, no PII/access tokens "user_data": user, "custom_data": { "value": float(j.final_presentment_total), "currency": j.presentment_currency, "content_ids": j.catalog_item_ids, "content_type": "product", "order_id": j.canonical_order_id, }, } body = {"data": [event]} if test_event_code: body["test_event_code"] = test_event_code # top-level; QA dataset only version, pixel = os.environ["META_GRAPH_VERSION"], os.environ["META_PIXEL_ID"] r = requests.post( f"https://graph.facebook.com/{version}/{pixel}/events", headers={"Authorization": "Bearer " + os.environ["META_CAPI_TOKEN"]}, json=body, timeout=10, ) r.raise_for_status() if r.json().get("events_received") != 1: raise RuntimeError("Purchase not acknowledged") return "received" # not proof of ad attribution ``` Have the worker retry transient failures with backoff and the **same** stored event; surface invalid-payload or credential errors for correction. Record the event ID, status, and Meta trace ID where available—not the token or customer payload. ([developers.facebook.com](https://developers.facebook.com/docs/graph-api/guides/error-handling?utm_source=openai)) ## 6. Validate end to end before scaling spend Use a QA store/dataset where possible. Open **Meta Events Manager → Data Sources → the intended pixel → Test Events**. For custom CAPI, use its top-level `test_event_code` only in QA and remove it for production. **A test code is not a sandbox:** Meta says those events can still be used for measurement and targeting. For a managed channel that does not expose the code, inspect server receipt and connection method in the QA dataset’s Overview and Event Details. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) | Test | Pass condition | |---|---| | **Normal consented checkout** | View the lamp, add it, enter checkout, and complete one test order. Check all four names, triggers, currency, and catalog IDs. Inspect browser traffic with Pixel Helper or developer tools. For `Purchase`, verify **Browser** and **Server**, matching IDs, and deduplication—not just two receipts. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | | **Value and repeat actions** | Buy multiple units with a discount. Both purchase copies agree with the Shopify order total and currency. Reload confirmation; in the custom path also replay the webhook. Neither creates another purchase. A genuinely separate order gets a new ID. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) | | **Browser loss versus refusal** | With sharing permitted, block only the browser’s Meta request: expect one server `Purchase`. In a fresh session deny the relevant sharing, then complete checkout: expect **no Meta marketing event on either path**. Also test withdrawal before a queued send. These are different cases with different expected results. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) | | **Checkout variants** | Repeat on mobile/Safari and an accelerated checkout if offered. Abandon checkout: no `Purchase`. If using the custom paid-order policy, a pending payment must produce none until paid. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) | **Sign-off:** Keep a test ledger with order ID, eligibility, expected value/currency, event ID, and observed result. In a spreadsheet or script, count distinct eligible orders and sum their values **by currency**; compare against deduplicated purchases for the **same closed time window and time zone**. Investigate each unexplained missing or extra order. Do not add Browser and Server receipt counts together, and do not expect Ads Manager’s *attributed* purchases to equal all Shopify orders. Review **Diagnostics**, **Event Deduplication**, **Event Match Quality**, and **Event Freshness** after setup and after checkout changes. Match quality is a customer-matching diagnostic, not proof that orders were counted once. ([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 Cedar & Coil serves. Disclose Meta sharing and its purpose; connect any third-party consent manager to Shopify’s Customer Privacy API. Where prior consent is required, wait for it before collecting advertising identifiers or sending either event copy. Honor applicable sale/sharing or targeted-advertising opt-outs, including Global Privacy Control where required. Do not treat an email-marketing checkbox as permission for Meta tracking. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai)) **CAPI is a delivery fallback, not a consent fallback.** If the custom worker cannot establish permission, suppress the send. Hashing contact data enables matching; it does not supply permission. Collect only approved fields, restrict access, set retention and deletion rules, and have the store’s privacy owner approve the configuration before production. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters))
Score · attempt 2 the judge's verdict, criterion by criterion10/11 criteria passed · failed: sources_defined
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends Pixel plus CAPI to the same dataset with a shared event ID, and explains that blocked Pixel requests or an unloaded confirmation page leave browser data incomplete, which CAPI covers.
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 Python sketch builds an event with event_name 'Purchase', event_id, event_time, action_source 'website' and a user_data block, and posts it to the /events endpoint.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Events Manager Test Events with test_event_code and says to verify Browser and Server receipt, matching IDs and deduplication, not just two receipts.
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, and Purchase is order-backed, but the browser-versus-server firing location is not stated per event. The response itself says not to assume the earlier three events are sent server-side and to verify in Events Manager.
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 makes no attribution-recovery percentage claims, says Ads Manager attributed purchases will not equal all orders, and states that CAPI is not a consent fallback and that regional consent limits what is 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 pixel ID, event name and event ID, the browser eventID in the fourth fbq argument versus the server event_id, and the 48-hour window.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓The ID is derived from the canonical order ID ('cc:purchase:{canonicalOrderId}'), 'One order gets one ID for its lifetime', and retries must reuse the original 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 uses j.paid_at_unix_seconds with the comment 'original time, even on retry', and the text says a retry must reuse the original event time.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓Email is trimmed, lowercased and SHA-256 hashed in both the table and the code, with phone normalization described and fbp, fbc, IP and user agent 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 decisively recommends the native Facebook & Instagram by Meta channel, gives numbered setup steps with menu paths and a recommended Enhanced data-sharing level, and reserves custom for specific needs.
✓ Attempt 3
Answer · attempt 3 the model's full response$0.73 · 117.5s · 5.5k tok
# Cedar & Coil | Shopify → Meta conversion tracking guide **Draft only.** Use Shopify’s **Facebook & Instagram by Meta** sales channel as the sole tracking integration. Start with **Enhanced** data sharing if approved: Shopify documents that it includes both the browser Pixel and a server-side `Purchase` event. The acceptance test is simple: **one eligible Arc Clip Lamp order produces one logical `Purchase`, at the Shopify order value—not two purchases and not automatically $68.** No campaign needs to run to test this. ([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: two delivery paths, one conversion | Path | What it contributes | What it cannot establish alone | |---|---|---| | **Shopper’s browser → Meta Pixel** | Captures product views, cart additions, checkout starts and completed checkouts, with browser context where permitted. | A blocker can stop the Pixel request. If the shopper closes the confirmation page before it loads, the browser may never report the purchase. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) | | **Shopify → Meta Conversions API (CAPI)** | Reports an eligible order from the server, without depending on the shopper’s browser successfully sending a Pixel request. | An order record does not prove which ad drove the sale, supply missing browser identifiers, or grant permission to share customer data. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) | Point both paths at the **same Meta web dataset/Pixel ID**. Make `Purchase` the primary conversion; use the other three events to locate where shoppers leave the funnel. Shopify documents server-side **Purchase** for its Enhanced and Maximum settings. Verify the connection method for each event in Events Manager rather than assuming all four are sent server-side. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/get-started)) ## 2. Event plan: triggers, IDs and money Use Meta’s standard event names exactly as shown. For product IDs, inspect the Arc Clip Lamp entry in the connected Meta catalog and copy its **retailer item ID format**. A Shopify product ID, variant ID and SKU are not interchangeable. The plan below assumes item-level IDs (`content_type: "product"`); use `"product_group"` only if the IDs actually represent catalog groups. Send monetary values as numbers in major currency units and currencies as three-letter codes such as `"USD"`. ([developers.facebook.com](https://developers.facebook.com/documentation/meta-pixel/reference)) | Meta event | Shopify trigger | Key parameters and meaning | |---|---|---| | `ViewContent` | `product_viewed` on the lamp’s product detail page—not a collection impression. | `content_ids: [catalogItemId]`, `content_type`, `value`: displayed unit price, `currency`. For the full-price US lamp: `68`, `"USD"`. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events)) | | `AddToCart` | `product_added_to_cart` after a successful addition—not merely a button click. | `content_type`, `contents: [{id, quantity, item_price}]`, `value`: value of the **quantity just added**, `currency`. Adding a second lamp in a separate action is a second event, not a duplicate. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events)) | | `InitiateCheckout` | `checkout_started` when the shopper enters checkout—not on each checkout step. | `content_ids`: items in checkout, `num_items`: total unit quantity, `value`: checkout total at that point, `currency`. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_started?utm_source=openai)) | | `Purchase` | Once per completed web order. For a custom paid-order definition, use the payment-confirmation rule in §5. | **`value`: actual Shopify order total; `currency`: currency of that total; `content_ids`: array of purchased catalog item IDs.** Include `content_type` and `num_items`. Take amount and currency from the same order snapshot on both paths. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) | The lamp’s **$68 list price is a test fixture, not a production fallback**. For example, a discount changes the purchase value without changing the catalog item ID. Use Shopify’s order total rather than rebuilding it from list prices; document the treatment of discounts, shipping, taxes and duties so QA compares like with like. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) ## 3. Exactly how Pixel–CAPI deduplication works Meta’s recommended key is **same Pixel ID + same event name + same event ID**. For one order, the browser and server must produce the identical ID string. In the Pixel call, `eventID` belongs in the **fourth argument**; in CAPI, `event_id` belongs on the **event object**, not in `custom_data`. Meta deduplicates matching copies received within **48 hours of the first copy**. Send promptly rather than relying on the edge of that window. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ```js // Custom browser path only. orderId is the same canonical Shopify ID used by the worker. const eventId = `cc:purchase:${orderId}`; fbq("track", "Purchase", { value, currency, content_ids, content_type: "product" }, { eventID: eventId }); // Server counterpart: event_name: "Purchase", event_id: `cc:purchase:${orderId}` ``` For a custom build, normalize the order ID to the same string on both sides—do not use a display order number on one side and a Shopify global ID on the other. For a cart addition or view sent over both paths, generate **one ID per occurrence** and pass it to both senders; do not generate two independent UUIDs or reuse one ID per shopper. A webhook retry must reuse the original ID **and occurrence time**. Keep a durable sent-record keyed by event name and ID so a replay cannot create a fresh purchase later. Customer email, order value and timestamp are not substitutes for the shared event ID. With the native channel, **verify its IDs; do not add a second tag to supply your own**. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 4. Prepare customer information before server delivery For direct CAPI requests, put permitted matching fields in **`user_data`**, separate from product and order fields in `custom_data`. Omit unavailable or unauthorized fields; never hash an empty string as a placeholder. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | Field | Preparation | |---|---| | `em` — email | Trim leading and trailing whitespace, lowercase, then hash the normalized UTF-8 value **once** with unsalted SHA-256; send the hexadecimal digest. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | | `ph` — phone | Normalize to a valid international number using the known country, keep digits including country code, remove formatting, then SHA-256 hash once. Omit an ambiguous number rather than guessing its country. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | | Names, address fields, `external_id` | If approved and necessary, apply Meta’s **field-specific** normalization before hashing names and address fields. Hashing is recommended for a stable `external_id`. Check whether the SDK already hashes a field; do not double-hash. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | | `fbp`, `fbc`, `client_ip_address`, `client_user_agent` | **Do not hash.** Use the shopper’s actual, permitted context—not the webhook sender’s IP or user agent. Pass `_fbp`/`_fbc` cookie values where available; only construct `fbc` from a genuinely observed `fbclid`. No Meta click means no invented click ID. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) | For website events, Meta specifies `action_source: "website"`, the actual `event_source_url`, and the shopper’s `client_user_agent`. Strip personal information, checkout access tokens and unnecessary query parameters from the source URL. Keep contact data, hashes and access tokens out of URLs, `custom_data` and routine logs. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/?utm_source=openai)) ## 5. Shopify setup: choose one owner ### Native channel — recommended for Cedar & Coil 1. **Audit existing senders.** Check **Settings → Customer events**, theme code, GTM, old checkout scripts and tracking apps. Disable overlapping Meta sends before connecting the channel. Do not remove unrelated analytics tags. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage)) 2. **Install and connect.** In Shopify admin, go to **Settings → Sales channels → Shopify App Store → Facebook & Instagram by Meta → Add channel**. Start setup, connect the authorized Facebook account and select Cedar & Coil’s business assets. Verify that the intended ad account has access to the dataset and that the lamp is in the intended catalog. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup)) 3. **Enable the approved sharing level.** Go to **Sales channels → Facebook & Instagram → Settings → Data sharing settings → Customer data sharing**. Enable sharing, choose the level and connect the intended Pixel. **Standard** is browser-only. **Enhanced** adds CAPI Purchase; **Maximum** also uses Pixel and CAPI and incorporates Meta’s additional advertising technology. Choose Enhanced for this measurement goal if the privacy review permits it; Maximum is not a prerequisite for server-side Purchase. Record the dataset ID for QA. ([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 gives this small store a server-side purchase signal without a worker, access token or retry queue to maintain. Choose **custom instead** if Cedar & Coil needs a materially different purchase definition, explicit control over shared fields, or auditable server delivery that the channel cannot provide. **Do not run the custom sketch alongside native Purchase tracking.** ([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-side `Purchase` sketch Use **Settings → Customer events** for a consent-configured custom browser pixel subscribed to Shopify’s standard events. For this alternative, define `Purchase` as a **paid online-store order**: use an authenticated `orders/paid` webhook for the server copy. Send the browser copy on `checkout_completed` only if payment is confirmed; if payment is deferred or uncertain, let the paid webhook report it alone. Verify the webhook HMAC against the raw body, filter out non-web orders, and queue a single record per canonical order ID. Join permitted shopper context and the privacy decision to the checkout/order before dispatch; the webhook request itself is not shopper context. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage)) Generate a CAPI token in **Events Manager → selected dataset/Pixel → Settings → Conversions API → Generate access token**. Keep it in a server secret store and pin a supported Graph API version. The Node.js sketch below shows the outbound request, not a public webhook handler. `p` is a validated order snapshot; `metaSharingAllowedNow` represents a fresh policy check, including any withdrawal. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/get-started)) ```js import { createHash } from "node:crypto"; const sha256 = s => createHash("sha256").update(s, "utf8").digest("hex"); async function sendPurchase(p, config) { if (!p.metaSharingAllowedNow) return "suppressed"; if (!p.shopperUserAgent || !p.safeCheckoutUrl) throw Error("Missing web context"); const user_data = { client_user_agent: p.shopperUserAgent }; const email = p.permittedEmail?.trim().toLowerCase(); if (email) user_data.em = [sha256(email)]; if (p.permittedShopperIp) user_data.client_ip_address = p.permittedShopperIp; if (p.permittedFbp) user_data.fbp = p.permittedFbp; if (p.permittedFbc) user_data.fbc = p.permittedFbc; const body = { data: [{ event_name: "Purchase", event_id: `cc:purchase:${p.canonicalOrderId}`, // identical to browser eventID event_time: p.paidAtUnixSeconds, // original occurrence, not retry time action_source: "website", event_source_url: p.safeCheckoutUrl, user_data, custom_data: { value: p.orderTotalAmount, // validated number in major units currency: p.orderCurrency, // currency of that exact amount content_ids: p.catalogItemIds, // validated array of strings content_type: "product", num_items: p.totalQuantity } }] }; if (config.isQA && config.testCode) body.test_event_code = config.testCode; const url = `https://graph.facebook.com/${config.graphVersion}/${config.pixelId}/events`; const res = await fetch(url, { method: "POST", headers: { Authorization: `Bearer ${config.token}`, "Content-Type": "application/json" }, body: JSON.stringify(body) }); const reply = await res.json(); if (!res.ok || reply.events_received !== 1) throw Error(`CAPI not acknowledged: HTTP ${res.status}, code ${reply.error?.code ?? "unknown"}`); return "acknowledged"; } ``` Mark the queued record sent only after acknowledgment. Retry transient failures with backoff and the **same** ID and time; route invalid payloads, missing required context and stale ambiguous deliveries for review instead of repeatedly resending them. An API acknowledgment proves receipt—not deduplication, customer matching 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 Use an isolated QA store/dataset where possible. In **Events Manager → Data Sources → selected Pixel → Test Events**, open the storefront and run the journey. For a custom server sender, include the displayed `test_event_code` at the **request-body level** and remove it for production. The code is **not** a sandbox: Meta says these events can still be used for measurement and targeting. For the native channel, inspect its own events rather than adding a test sender. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) | Test | Pass condition | |---|---| | **Normal order, sharing allowed** | On desktop and mobile, view the lamp, add it, enter checkout and complete a controlled order. Use Meta Pixel Helper for the browser and Events Manager for Browser/Server delivery. See the four expected names. Inspect `Purchase` details: same dataset, name, ID, amount, currency and catalog item IDs; the two deliveries represent **one purchase**. Check **Event Details → Event Deduplication**, not just raw receipt totals. ([developers.facebook.com](https://developers.facebook.com/docs/facebook-business-extension/fbe/guides/ig-migration?utm_source=openai)) | | **Money and identity** | Test a discounted or multi-unit order. Compare the event against that exact Shopify order and catalog entry. Place another order using the same test customer: it must get a **different** purchase ID. Refresh the confirmation page and, for custom, replay the webhook: neither should create another purchase. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) | | **Browser delivery unavailable** | With sharing allowed, block the Meta browser request and complete a test order. Verify a **server-only `Purchase`** with the correct value. An abandoned checkout or failed payment must not produce a purchase under the custom paid-order rule. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) | | **Sharing not allowed** | Repeat after refusal, applicable sale/sharing opt-out, and withdrawal. Verify no prohibited Pixel request **and no prohibited server event**, including queued retries. Inspect requests and redacted logs for contact data or checkout secrets in the wrong fields. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai)) | **Release gate:** Reconcile distinct eligible Shopify orders and their totals, **by currency**, over the same closed interval and time zone. For controlled orders, trace each discrepancy to its order ID or test session. Don’t sum Browser and Server receipt counts or compare all Shopify sales with Ads Manager’s *ad-attributed* purchases. Review **Diagnostics, Event Deduplication, Event Freshness and Event Match Quality**; the last measures customer matching, not whether duplicates were removed. Keep spend in draft while duplicates, wrong values, consent failures or unexplained missing test orders remain. ([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 Cedar & Coil serves. Integrate any third-party consent banner with Shopify’s Customer Privacy API. Apply the same advertising-sharing decision to the Pixel **and** CAPI; an email-marketing opt-in is not that decision. Where prior consent is required, withhold advertising tracking until granted. Where applicable, honor sale/sharing and targeted-advertising opt-outs, including recognized Global Privacy Control signals. A custom worker must not treat a missing privacy record as permission. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai)) Disclose what is sent to Meta, why, and how shoppers can change their choice. Minimize fields and retention, restrict access, and have the policy owner review the setup against applicable law and Meta’s terms. **Hashing supports matching; it does not anonymize the data or replace permission.** The purpose of CAPI here is to make an authorized purchase delivery reliable—not to bypass a shopper’s choice. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters))
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 sets out browser Pixel plus Shopify→CAPI to the same dataset, and explains that blockers or a closed confirmation page can stop the Pixel while the server path does not depend on the browser.
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 sketch builds a body with event_name "Purchase", event_id, event_time, action_source "website", and a user_data block, and posts it to the /events endpoint.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Events Manager → Test Events with test_event_code and says to check "Event Details → Event Deduplication, not just raw receipt totals" so Browser and Server copies count as one 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).
✓Each event is tied to a Shopify trigger (product_viewed, product_added_to_cart, checkout_started), Purchase uses the server orders/paid webhook or native CAPI with the Shopify order total as source of truth, though the browser/server split for the other three events is only partly explicit ("verify the connection method for each event").
limits_stated
Limitations are stated honestly: no promised attribution-recovery percentages, and consent/regional rules are noted as constraints on what may be sent.
✓The guide gives no recovery percentages, says an API acknowledgment proves neither dedup nor attribution, and section 7 treats consent and regional opt-outs 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 Pixel ID, event name and event ID, with eventID as the Pixel's fourth argument and event_id on the CAPI event object, plus the 48-hour window.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓The ID is derived as `cc:purchase:${orderId}` for both senders, one ID per occurrence for views and carts, and "A webhook retry must reuse the original ID and occurrence time".
event_time_stable
The server Purchase event uses the purchase/order occurrence timestamp in Unix seconds and preserves it across retries; using the current send or retry time fails.
✓The sketch sets `event_time: p.paidAtUnixSeconds, // original occurrence, not retry time` and the text says to retry "with the same ID and time".
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓The email is trimmed, lowercased and SHA-256 hashed once (`sha256(email)` in code), and non-hashed fields (fbp, fbc, IP, user agent) are correctly called out.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓It decisively recommends the native Facebook & Instagram by Meta channel with numbered steps (audit, install, enable Enhanced sharing) and says when to choose custom instead.