← Run 20261118-190631-e37fa037
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 medium 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.14 · 58.9s · 4.1k tok
# Cedar & Coil: Shopify → Meta conversion tracking *Draft implementation guide. Keep campaigns unpublished during setup and testing.* ## 1. Recommended architecture: Meta Pixel + Conversions API Use **one Meta dataset for the store**, with two ways to report eligible events: the **Meta Pixel** in the browser and the **Conversions API (CAPI)** from the server. Use `Purchase` as the primary sales conversion and the other three events to diagnose where shoppers drop out. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) - **Browser Pixel** observes storefront actions as they happen and can provide browser and ad-click context when available. It can miss events if a browser blocks the tag or the confirmation page never loads. - **Server-side CAPI** can report an eligible Shopify purchase without relying on the confirmation page or a browser request to Meta. It can’t restore identifiers that were never collected or guarantee that Meta will match the event to an ad. - **Deduplication** lets the two paths report the same purchase without counting it twice. Make `Purchase` the priority for dual delivery. Verify which other events arrive server-side rather than assuming the native integration sends all four through both paths. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) ## 2. Event plan: what to send and when Use Meta’s exact, case-sensitive standard event names. The table is the target tracking contract for a custom build and a checklist for auditing the native integration. Put commerce parameters in the Pixel event’s third argument and in CAPI’s `custom_data`. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) | Meta event | Trigger | Key parameters | |---|---|---| | `ViewContent` | Shopper views the Arc Clip Lamp product detail page. | `content_ids` for the viewed item, `content_type`, numeric `value` for the displayed price, and `currency`. | | `AddToCart` | Shopify confirms the item was added, not merely that the button was clicked. | `content_ids`, `content_type`, `contents` with item IDs and quantities added, numeric `value` for the items added, and `currency`. | | `InitiateCheckout` | Shopper starts checkout, not on each subsequent checkout step. | `content_ids`, `content_type`, `contents`, `num_items` as total units, numeric `value` for the checkout at entry, and `currency`. | | `Purchase` | Once per successful online order. In the custom design below, the order must be paid. | **`value`** as the actual Shopify order total under the chosen accounting rule, **`currency`** as its ISO 4217 code (e.g. `USD`), and **`content_ids`** for the purchased items. Also send `content_type` and `contents` with quantities. | Use the exact item IDs in the connected Meta catalog, not product titles or an assumed SKU format. Use `content_type: "product"` for item-level IDs or `"product_group"` for group IDs. For `Purchase`, take the amount and currency from the same Shopify money field pair, using the shopper’s checkout currency. Document how discounts, shipping, taxes, and duties are treated, and keep the browser and server values consistent. The lamp’s $68 list price is not a substitute for the actual order total. ([developers.facebook.com](https://developers.facebook.com/docs/facebook-business-extension/fbe/guides/pixel-events?utm_source=openai)) ## 3. Deduplication: one action, one shared ID Meta’s recommended method matches **the same Pixel ID, exact event name, and exact event ID** across the browser and server copies. The browser supplies `eventID` in the fourth argument to `fbq`; CAPI supplies `event_id` at the top level of the event object. Both copies must reach Meta within **48 hours of the first receipt** to deduplicate. If only one copy arrives, there is nothing to deduplicate. Email, click IDs, and `content_ids` are not substitutes for this shared event ID. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ```js // Browser, after the same paid order has been confirmed: fbq("track", "Purchase", purchaseParams, { eventID: `purchase:${canonicalOrderId}` }); // CAPI sends event_name: "Purchase" and the same string as event_id. ``` For a custom build, normalize Shopify’s order ID to the same string on both sides. Use a new ID for each distinct action you send through both paths, but **reuse the original ID and event timestamp on retries**. Don’t generate separate browser and server UUIDs. Prevent repeated browser sends and enforce server-side idempotency separately; Meta deduplication is not your webhook retry strategy. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 4. Prepare customer information before sending it For direct CAPI requests, put permitted match fields in **`user_data`**, not `custom_data`, event IDs, or URLs. Normalize each field first, then apply **unsalted SHA-256** where required. Don’t hash a value twice if your SDK or integration already handles it. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | Data | Preparation | |---|---| | Email (`em`) | Trim leading and trailing whitespace, lowercase, then hash. | | Phone (`ph`) | Normalize to an international number with the country calling code; remove formatting and the `+` so only digits remain, then hash. | | Name, city, state, postal code, country | If needed and permitted, apply Meta’s field-specific normalization rules, then hash. For example, use lowercase two-letter country codes. | | First-party customer ID (`external_id`) | If used, use a stable ID and follow Meta’s recommendation to hash it. It is not the event ID. | | Browser ID (`fbp`), click ID (`fbc`), shopper IP and user agent | **Do not hash.** Use actual shopper context, not the webhook sender’s IP or user agent. Use `_fbp` and `_fbc` when available and permitted; derive `fbc` only from a genuine `fbclid` using Meta’s format. Omit unavailable optional fields. Meta requires the shopper user agent for website CAPI events; don’t fabricate it. | Hashing is for matching, not anonymization. Start with the minimum permitted fields, and keep both raw and hashed identifiers out of routine logs. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) ## 5. Shopify setup: native first, custom only if needed **Recommendation: use Shopify’s Facebook & Instagram by Meta sales channel.** For a small DTC launch, it gives Cedar & Coil a server-side Purchase path without having to maintain a webhook service, catalog mapping, retry queue, and consent integration. The trade-off is less control over triggers and payloads. Choose custom only if testing reveals a concrete gap the native channel cannot meet, such as a different definition of when an order counts as paid. ([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**. Find **Facebook & Instagram by Meta**, add the channel, and connect the intended Meta business assets. Confirm the ad account, catalog, and Pixel/dataset are the ones you intend 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 customer data sharing, connect the correct Pixel, and select **Maximum** if approved under your privacy configuration. Shopify documents that **Enhanced and Maximum** both use Pixel plus CAPI for Purchase; **Standard** is browser Pixel only. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) 3. Audit theme code, GTM, **Settings → Customer events**, and other apps for existing Meta senders. Remove overlapping tags or integrations as part of the cutover. Let the native channel own both paths; don’t add the custom sender below on top of it. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage?utm_source=openai)) **Custom alternative** Use Shopify Customer Events/Web Pixels for browser events. For server-side `Purchase`, subscribe to `orders/paid`, verify the webhook HMAC against the raw body, and durably queue the verified event before acknowledging it. Key the Purchase job by shop and canonical order ID, not just by webhook delivery ID. Join permitted shopper context and privacy state to the order, and recheck eligibility before sending. On the browser side, don’t assume `checkout_completed` proves payment: fire only if you can confirm the same paid order. For delayed payments without a confirmed browser event, use the server copy only. ([shopify.dev](https://shopify.dev/docs/apps/build/marketing/pixels?utm_source=openai)) **Server-side Purchase sketch (Node.js).** The input is a validated, idempotent job for a paid order, not the raw Shopify webhook. `sourceUrl` is the actual website event URL with personal data and checkout access tokens removed. Pin a supported Graph API version and keep the CAPI token in a server-side secret store. ([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"); export async function sendPurchase(order, { testEventCode } = {}) { if (order.maySendMetaAds !== true) return { skipped: true }; if (!order.shopperUserAgent) throw new Error("Missing website user agent"); const email = order.email?.trim().toLowerCase(); const user_data = { client_user_agent: order.shopperUserAgent, ...(email && { em: [sha256(email)] }), ...(order.shopperIp && { client_ip_address: order.shopperIp }), ...(order.fbp && { fbp: order.fbp }), ...(order.fbc && { fbc: order.fbc }), }; const event = { event_name: "Purchase", event_id: `purchase:${order.canonicalOrderId}`, event_time: Math.floor(Date.parse(order.paidAt) / 1000), action_source: "website", event_source_url: order.sourceUrl, user_data, custom_data: { value: order.totalAmount, // Numeric Shopify total, not cents currency: order.currencyCode, // Currency of that same total content_type: "product", content_ids: [...new Set(order.items.map((i) => i.catalogItemId))], contents: order.items.map((i) => ({ id: i.catalogItemId, quantity: i.quantity, })), }, }; const { META_GRAPH_VERSION, META_PIXEL_ID, META_CAPI_TOKEN } = process.env; const url = new URL( `https://graph.facebook.com/${META_GRAPH_VERSION}/${META_PIXEL_ID}/events` ); url.searchParams.set("access_token", META_CAPI_TOKEN); const res = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ data: [event], ...(testEventCode && { test_event_code: testEventCode }), }), }); const result = await res.json(); if (!res.ok || result.events_received !== 1) { throw new Error(`CAPI Purchase not accepted (HTTP ${res.status})`); } return { accepted: true, traceId: result.fbtrace_id }; } ``` Have the worker retry transient failures with backoff and the same ID and timestamp. Alert on permanent errors rather than retrying indefinitely. Redact the request URL from logs because it contains the token. A successful API response confirms receipt, not deduplication, user 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 1. **Run the funnel.** In Meta Events Manager, select the intended dataset and open **Test Events**. On desktop and mobile, view the lamp, add it to cart, start checkout, and complete a controlled Shopify test order. Confirm the four event names, triggers, parameter values, and catalog IDs. For custom CAPI, use `test_event_code` only for testing, preferably on an isolated dataset: the code makes events visible for testing but does not exclude them from measurement. Remove it for production. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) 2. **Prove deduplication and resilience separately.** With tracking permitted and the browser Pixel working, verify Browser and Server `Purchase` have the same ID and deduplicate to one conversion. Don’t use the raw Overview receipt count as the deduplicated count. Then block the Pixel while keeping tracking permitted and check that an eligible paid order still arrives via Server. Refresh the confirmation page and, for a custom build, replay the webhook to confirm neither creates an extra Purchase. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) 3. **Test the edge cases.** Check discounts, multiple quantities, any enabled alternate currency or payment flow, failed payments, and denied or withdrawn tracking permission. When sharing is not permitted, neither path should send the ads event. Review Events Manager **Diagnostics**, **Event Deduplication**, **Event Freshness**, and **Event Match Quality**. Treat match quality as a diagnostic, not proof of attribution. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) 4. **Reconcile before increasing spend.** Match controlled Shopify order records to event evidence and verify the amount and currency order by order. After launch, compare eligible Shopify orders with Meta event reporting over the same closed window and time zone; use order-level delivery records where available to investigate gaps. Keep that check separate from Ads Manager attribution: Shopify records orders, while Ads Manager reports conversions credited to ads. Scale only after the consent, duplicate, and order-value checks pass. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ## 7. Consent and compliance **CAPI makes delivery less dependent on the browser; it does not bypass a shopper’s privacy choice.** Configure **Shopify admin → Settings → Customer privacy**, or integrate your consent platform with Shopify’s Customer Privacy API. Apply the relevant marketing consent, sale/sharing or targeted-advertising opt-outs, and Global Privacy Control where applicable to **both** paths. For custom CAPI, don’t treat an order webhook as permission to share: if you can’t establish permission under the applicable rules, suppress the event. Disclose the Meta sharing in your privacy notice, minimize the data retained, and have the responsible privacy reviewer confirm the configuration against applicable law and Meta’s Business Tools Terms before enabling production sharing. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai))
Score · attempt 1 the judge's verdict, criterion by criterion10/11 criteria passed · failed: sources_defined
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends Pixel plus CAPI with deduplication and explains that the browser misses blocked tags or unloaded confirmation pages while server-side doesn't 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 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase explicitly lists value, currency and content_ids.
code_sketch
A concrete server-side Purchase event code sketch or request example is included showing event_name, event_time, event_id, action_source, and a user_data block.
✓The Node.js sketch builds an event with event_name, event_id, event_time, action_source and a user_data block, then POSTs it to the Graph API events endpoint.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Events Manager Test Events and checks that Browser and Server Purchase share the same ID and deduplicate to one conversion, using the Event Deduplication diagnostic.
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).
✗Only Purchase has a clear source (server via orders/paid plus browser); ViewContent, AddToCart and InitiateCheckout don't say browser versus server and the guide admits to 'Verify which other events arrive 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.
✓The guide promises no recovery percentages, says CAPI 'can't restore identifiers... or guarantee that Meta will match', and Section 7 states consent as a constraint on sending.
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, exact event name and exact event ID, with eventID in fbq's fourth argument and event_id at the top level in CAPI.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓The event_id is derived as `purchase:${canonicalOrderId}`, shared between browser and server, with 'reuse the original ID and 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.
✓event_time is Math.floor(Date.parse(order.paidAt)/1000), the paid timestamp in Unix seconds, and the text says to reuse the timestamp on retries.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓The guide says to trim and lowercase email then apply unsalted SHA-256, and the code does so with sha256(order.email.trim().toLowerCase()).
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 and gives numbered setup steps, including the Data sharing settings and removing overlapping senders, with custom as a fallback.
✗ Attempt 2
Answer · attempt 2 the model's full response$0.15 · 64.3s · 4.4k tok
# Cedar & Coil: Shopify → Meta conversion tracking guide **Draft implementation plan.** Use Shopify’s native **Facebook & Instagram by Meta** sales channel for launch. Make `Purchase` the primary conversion for the Arc Clip Lamp campaign, and use the other three events to diagnose where shoppers drop out. Keep campaigns in draft while you validate the setup. ## 1. Recommended architecture: Meta Pixel + Conversions API Send browser events through the **Meta Pixel** and eligible server events through **Conversions API (CAPI)** to the **same Meta dataset/pixel**. Where both paths report the same action, deduplicate them so one order counts as one `Purchase`. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) - **Browser Pixel:** Captures storefront actions and browser context as shoppers browse, add to cart, and check out. It can miss events when a browser blocks the request or the page that would fire the event never loads. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) - **Server CAPI:** Lets Shopify or your backend report an eligible order without relying on the browser’s request to Meta. It makes Purchase delivery more reliable, but it does not restore missing identifiers, override consent, or guarantee that Meta can attribute the order to an ad. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) Prioritize redundancy on **Purchase**. Shopify documents server-side Purchase delivery for its native integration; verify the actual connection method for each event in Events Manager rather than assuming all four arrive from both sources. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) ## 2. Event plan and key parameters Use Meta’s exact standard event names. The Shopify event names below are the subscriptions to use on a **custom** browser implementation; with the native channel, use the table to check what the integration sends. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?utm_source=openai)) | Meta event | Trigger | Parameters to verify | |---|---|---| | `ViewContent` | Arc Clip Lamp product detail viewed (`product_viewed`) | `content_ids` for the viewed item, `content_type`, displayed item `value`, and `currency`. | | `AddToCart` | An item is successfully added (`product_added_to_cart`), not merely when the button is clicked | `content_ids`, `content_type`, `contents` with item ID and quantity added, `value` for the items just added—not the whole cart—and `currency`. | | `InitiateCheckout` | Shopper starts checkout (`checkout_started`) | `content_ids`, `content_type`, `contents`, `num_items` as the sum of unit quantities, current checkout `value`, and `currency`. | | `Purchase` | One eligible completed storefront order (`checkout_completed` on the browser; a matching order record on the server) | **`value`, `currency`, `content_ids`**, plus `content_type` and `contents` with IDs and quantities. A custom implementation can also send `order_id` for reconciliation; it does not replace the deduplication ID. | Use the **exact item IDs in the Meta catalog**, not a guessed SKU or Shopify variant ID. Send them as strings. Use `content_type: "product"` for item-level IDs, or `"product_group"` if you intentionally send catalog group IDs. Send monetary values as numbers in major units and pair each with its actual ISO 4217 currency, such as `USD`. For `Purchase`, use the actual Shopify order total in the checkout currency, not a hard-coded `$68` list price. Document the value definition and keep it consistent across browser, server, and reconciliation. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/custom-data)) ## 3. Exactly how deduplication works For the same action, Meta matches the **same destination pixel ID**, **same event name**, and **same event ID**. The browser sends `eventID` in the Pixel call’s options argument; the server sends `event_id` at the top level of the CAPI event object. When both copies arrive within Meta’s **48-hour** matching window, Meta treats them as one event. If only the server copy arrives, there is no browser duplicate to remove. Meta documents that it generally favors the first comparable event, with a browser preference for near-simultaneous arrivals; don’t depend on arrival order or on Meta combining the two payloads. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ```js // Custom browser example; purchaseParams contains value, currency, and item data. fbq("track", "Purchase", purchaseParams, { eventID: "purchase:123456789" }); ``` The matching CAPI event must use `event_name: "Purchase"` and `event_id: "purchase:123456789"`. In a custom setup, derive both from the same canonical Shopify order ID. If one path supplies a Shopify GID and the other a numeric ID, normalize them to the same string without converting large IDs to JavaScript numbers. For other events sent on both paths, generate one ID per action and pass it to both senders. Keep the ID stable on retries, and use your own idempotency controls for repeated webhook deliveries or page loads. Email, `_fbp`, and `_fbc` are not substitutes for this event-ID scheme. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 4. Prepare customer information before sending it server-side Put permitted matching fields in CAPI **`user_data`**, not in `custom_data`, the event ID, or the source URL. For a direct API integration, normalize fields first, then hash fields that require it **once** with unsalted SHA-256 and encode the digest as hex. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) | Field | Preparation | |---|---| | `em` — email | Trim leading/trailing whitespace, lowercase, then hash. | | `ph` — phone | Normalize to an international number with country code, remove the `+`, punctuation, and national trunk prefix as applicable, then hash the digits. If the country code can’t be established reliably, omit the field. | | Other contact fields, if needed | Follow Meta’s field-specific normalization and hashing rules for fields such as first name, last name, city, state, postal code, and country. | | `fbp`, `fbc`, `client_ip_address`, `client_user_agent` | **Do not hash.** Send genuine values only when available and permitted. Use the shopper’s browser IP and user agent, not the webhook sender’s. Use `_fbc` or derive `fbc` from a real `fbclid` in Meta’s documented format; don’t invent click IDs. | Omit empty optional fields. Meta documents `client_user_agent` as required for website CAPI events, so plan how to obtain it from eligible checkout context and flag missing context rather than fabricating it. If you use an SDK that hashes for you, don’t prehash fields it will hash again. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) ## 5. Shopify setup: native channel vs. custom ### Recommended: native Facebook & Instagram by Meta channel For a small DTC store, the native channel is the best starting point: it provides the browser Pixel, server-side Purchase delivery, and catalog integration without requiring Cedar & Coil to maintain webhook infrastructure. The tradeoff is less control over triggers, payloads, and event IDs. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 1. In Shopify admin, go to **Settings → Sales channels → Shopify App Store** and install **Facebook & Instagram by Meta**. Connect the correct Meta business assets. Confirm that the intended ad account can use the dataset and that the Arc Clip Lamp appears in the connected catalog. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 2. Go to **Sales channels → Facebook & Instagram → Settings → Data sharing settings**. Turn on customer data sharing, select **Maximum** if approved under your privacy configuration, and connect the intended pixel. Shopify also documents CAPI Purchase delivery on **Enhanced**; **Standard** is browser-only. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) 3. Audit **Settings → Customer events**, the theme, GTM, and tracking apps. Remove or disconnect redundant Meta senders for this dataset. Let the native integration own both paths; don’t paste the custom code below on top of it. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels?utm_source=openai)) ### Custom: use only if the native channel cannot meet a verified requirement Use Shopify Customer Events/Web Pixels for the browser path and a Shopify app with an order webhook and backend worker for the server path. For order-completion semantics, pair `checkout_completed` with `orders/create`, filtered to eligible online checkout orders. If the business instead defines a purchase as a paid order, use `orders/paid` and make the browser trigger reflect the same paid-only definition; checkout completion alone does not prove payment. Verify the Shopify webhook HMAC, enqueue the work, and enforce one logical send per order. Bind the shopper’s permitted checkout context to the order so the worker does not depend on the thank-you page loading. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) **Server-side sketch (Node.js).** This runs after webhook verification and order filtering. `p` is a validated record containing the canonical order ID, actual order amount, catalog IDs, sanitized checkout URL, and permitted shopper context. `maySendToMeta` is your server-side privacy decision, not a browser-supplied flag. Use a supported Graph API version and keep the CAPI token in a server-side secret store. ([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"); export async function sendPurchase(p, { testEventCode } = {}) { if (p.maySendToMeta !== true) return; if (!p.userAgent) throw new Error("Missing shopper user agent"); const email = p.email?.trim().toLowerCase(); const user_data = { client_user_agent: p.userAgent, ...(email ? { em: [sha256(email)] } : {}), ...(p.phoneDigits ? { ph: [sha256(p.phoneDigits)] } : {}), ...(p.clientIp ? { client_ip_address: p.clientIp } : {}), ...(p.fbp ? { fbp: p.fbp } : {}), ...(p.fbc ? { fbc: p.fbc } : {}), }; const event = { event_name: "Purchase", event_id: `purchase:${p.orderId}`, // Same string as Pixel eventID event_time: Math.floor(p.occurredAtMs / 1000), // Not the retry time action_source: "website", event_source_url: p.sanitizedCheckoutUrl, user_data, custom_data: { value: p.orderTotal, // Number in major currency units currency: p.currency, // e.g. "USD" content_ids: [...new Set(p.items.map(item => item.catalogId))], content_type: "product", contents: p.items.map(item => ({ id: item.catalogId, quantity: item.quantity, })), order_id: p.orderId, }, }; const { META_GRAPH_VERSION, META_PIXEL_ID, META_CAPI_TOKEN } = process.env; const body = new URLSearchParams({ access_token: META_CAPI_TOKEN, data: JSON.stringify([event]), }); if (testEventCode) body.set("test_event_code", testEventCode); const response = await fetch( `https://graph.facebook.com/${META_GRAPH_VERSION}/${META_PIXEL_ID}/events`, { method: "POST", body } ); 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 }; } ``` Retry transient failures with the original event ID and timestamp; alert on persistent failures. Log delivery status and trace IDs, not tokens, customer fields, or full payloads. API acceptance confirms receipt, not deduplication, user 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 1. **Walk the funnel.** Open the intended dataset in **Meta Events Manager → Test Events**. With an eligible browser session, view the lamp, add it to cart, start checkout, and complete a controlled order. Use **Meta Pixel Helper** to inspect browser events. For custom server tests, send the Test Events code in the request and remove it for production. Use a separate test dataset when practical: Meta notes that the code does not quarantine events from measurement. ([developers.facebook.com](https://developers.facebook.com/docs/facebook-business-extension/fbe/guides/ig-migration?utm_source=openai)) 2. **Check one order, not just two green signals.** Confirm browser and server `Purchase` reach the same dataset with matching IDs and agree on value, currency, and catalog items. Check **Event Deduplication** in the Purchase details once data is available. The Overview can show both raw receipts before deduplication. Reload the confirmation page; for a custom setup, also replay the webhook and confirm it does not create another logical purchase. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) 3. **Test failure and privacy cases separately.** With permission granted, block the browser request to Meta and confirm an eligible order still arrives server-side. Then test consent denial and applicable opt-outs separately and confirm both paths follow the configured policy. Repeat on mobile and any accelerated checkout Cedar & Coil offers. Include a discounted order to verify the real total rather than the list price. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) 4. **Reconcile before raising spend.** Export Shopify’s eligible online orders for a closed window. Use a spreadsheet or script to compare order counts and totals by currency against your delivery records where available, and review Meta’s diagnostics, event freshness, deduplication, and Event Match Quality. Investigate missing or duplicate orders and unexplained value differences. Don’t expect Ads Manager’s attributed purchases to equal Shopify orders: event delivery and ad attribution are different checks. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ## 7. Consent and compliance Configure **Shopify admin → Settings → Customer privacy** for the markets you serve. If you use a third-party consent manager, verify that it syncs choices through Shopify’s **Customer Privacy API**. Apply the same marketing and applicable data-sharing permissions to the browser and server paths, including changes in preference. A Shopify order webhook is not permission to send advertising data; if a custom worker cannot establish that sharing is allowed, suppress the event. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai)) Disclose Meta sharing in the privacy notice, minimize the fields you send, restrict access and retention, and review applicable opt-out and deletion obligations. Hashing is a data-handling safeguard, not anonymization or a substitute for consent. The point of CAPI is to make **permitted** event delivery more reliable, not to bypass a shopper’s choices. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai))
Score · attempt 2 the judge's verdict, criterion by criterion10/11 criteria passed · failed: sources_defined
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends Pixel plus CAPI to the same dataset with deduplication and explains that the browser misses events when requests are blocked while the server path makes Purchase delivery more reliable.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The Section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase explicitly lists value, currency and content_ids.
code_sketch
A concrete server-side Purchase event code sketch or request example is included showing event_name, event_time, event_id, action_source, and a user_data block.
✓The Node.js sendPurchase sketch includes event_name, event_id, event_time, action_source: "website" and a user_data block.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Events Manager Test Events and Pixel Helper, checks Event Deduplication in the Purchase details, and replays the webhook and reloads the 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 clearly browser checkout_completed plus a server order record, but for ViewContent, AddToCart and InitiateCheckout the guide says only to verify in Events Manager which path sends them, so per-event sources of truth are not fully defined.
limits_stated
Limitations are stated honestly: no promised attribution-recovery percentages, and consent/regional rules are noted as constraints on what may be sent.
✓It promises no recovery percentages, says CAPI "does not restore missing identifiers, override consent, or guarantee" attribution, and 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.
✓It states Meta matches the same pixel ID, event name and event ID, with eventID in the Pixel options and event_id in CAPI, and gives matching "purchase:123456789" examples.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓The event_id is derived from the canonical order ID as `purchase:${p.orderId}`, shared by both paths, and the guide says "Keep the ID stable 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 `Math.floor(p.occurredAtMs / 1000), // Not the retry time`, and the text says to retry with the original event 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, lowercased and SHA-256 hashed to hex in both the table and the code, and the guide says 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).
✓It recommends the native Facebook & Instagram by Meta channel for a small DTC store, with numbered steps for installation, Data sharing settings and removing redundant senders.
✗ Attempt 3
Answer · attempt 3 the model's full response$0.14 · 54.6s · 3.9k tok
# Cedar & Coil — Shopify-to-Meta conversion tracking guide **Draft-only.** Start with Shopify’s native **Facebook & Instagram by Meta** sales channel. Use `Purchase` as the primary conversion in the draft campaign and the other three events to diagnose where shoppers drop out. Keep the campaign unpublished while you validate tracking. ## 1. Recommended architecture: Meta Pixel + Conversions API Send browser events through the **Meta Pixel** and eligible server events through the **Conversions API (CAPI)** to the **same Meta dataset**. The Pixel observes actions in the storefront and checkout and supplies browser context. CAPI gives Shopify a separate path to report a completed purchase even if an ad blocker stops the Pixel request or the confirmation page never loads. When both paths report the same action, Meta should count it once. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) Prioritize server coverage for `Purchase`. Shopify documents server-side Purchase for its native integration; don’t assume every upper-funnel event is also sent server-side. Verify the connection method per event. A server event that merely forwards a browser callback still depends on that callback, and a server event received by Meta is not necessarily matched to a person or attributed to an ad. ([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 exact event names. The Shopify events below are the mapping for a **custom** browser implementation; with the native channel, inspect what the integration sends rather than adding a second tag. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?utm_source=openai)) | Meta event | Trigger | Key parameters | |---|---|---| | `ViewContent` | Arc Clip Lamp product detail view (`product_viewed`) | `content_ids`, `content_type`, displayed product `value` and `currency` | | `AddToCart` | Successful cart addition (`product_added_to_cart`), not a button click | `content_ids`, `content_type`, `contents` with item ID and quantity added, `value` for the items added, `currency` | | `InitiateCheckout` | Shopper starts checkout (`checkout_started`), not a cart view | `content_ids`, `content_type`, `contents`, `num_items`, current checkout `value` and `currency` | | `Purchase` | Successful purchase (`checkout_completed` for the browser; confirmed paid online order for the custom server flow below) | **`value`, `currency`, `content_ids`**, plus `content_type` and `contents` with purchased quantities | Use numeric amounts in major currency units and a three-letter ISO currency code such as `USD`. For `Purchase`, use the Shopify order total and its corresponding currency, not the lamp’s fixed $68 list price. Document the total you use and keep it consistent across both paths. `content_ids` must be strings that match the actual Meta catalog item IDs; don’t assume the Shopify variant ID or SKU is the catalog ID. Use `content_type: "product"` for item-level IDs or `"product_group"` for group IDs. Send these commerce fields as Pixel event parameters and inside CAPI’s `custom_data`. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) ## 3. How deduplication works For each action sent through both paths, Meta compares the **dataset, event name, and event ID**. The Pixel’s `eventID` goes in the fourth argument of `fbq('track', ...)`; CAPI’s `event_id` goes at the top level of the event object. For a purchase, both copies must use the exact name `Purchase` and the same ID. Matching copies received within **48 hours** of the first are counted as one event. Meta generally prefers the first arrival; its server-event reference notes a browser preference when the copies arrive within about five minutes. Don’t rely on one copy to fill in missing fields on the other. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) For custom tracking, derive one ID from the canonical Shopify order ID, such as `purchase:123456789`, on both sides. Normalize the ID the same way if one source returns a Shopify global ID and the other returns a numeric ID. For any dual-sent upper-funnel action, generate an ID once per occurrence and pass it to both senders. Preserve the ID and original timestamp on retries. Use your own order-level idempotency to handle duplicate webhook deliveries; Meta’s cross-channel deduplication is not a substitute for it. ([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 hash.** Trim and lowercase email. Normalize phone to digits with its country calling code and no local trunk prefix. Apply Meta’s field-specific rules to any names or address fields you choose to send. Hash fields that require it using unsalted SHA-256, once, and place them in `user_data` as fields such as `em` and `ph`. Meta recommends hashing `external_id` if you use it. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) - **Don’t hash browser and network signals.** Send `_fbp` as `fbp`, `_fbc` as `fbc`, and the actual shopper IP and user agent as `client_ip_address` and `client_user_agent`, only when available and permitted. Don’t invent click IDs or substitute the webhook sender’s IP or user agent. Meta requires the shopper user agent, `event_source_url`, and `action_source` for website events. Strip personal information and checkout secrets from the source URL. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) ## 5. Shopify setup: native versus custom **Recommended for Cedar & Coil: native.** The sales channel manages the Pixel, server-side Purchase delivery, and catalog sync. That covers the purchase signal the draft campaign needs without asking a small team to maintain a webhook service. The trade-off is less control over payloads and event routing. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta?utm_source=openai)) 1. Install **Facebook & Instagram by Meta** from the Shopify App Store and connect the correct Meta business portfolio, ad account, Pixel/dataset, and catalog. 2. In Shopify admin, go to **Sales channels → Facebook & Instagram → Settings → Data sharing settings**. Enable sharing, connect the intended Pixel, and select **Maximum** if your privacy review approves that level. Shopify also documents server-side Purchase under **Enhanced**; **Standard** is browser-only. 3. Make the native channel the sole sender for these events. Audit theme code, GTM, **Settings → Customer events**, and third-party apps for overlapping Pixel or CAPI installations. Verify the dataset ID in Events Manager and in the draft ad set. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) **Custom alternative.** Use a Shopify Web Pixels extension or custom pixel for browser events and a backend triggered when an online order becomes paid. Shopify documents `orders/paid` and recommends **Order Events** for new implementations. Verify delivery signatures, queue the work, filter to eligible online orders, and enforce one Purchase per order. Join permitted browser context and privacy choices to the order or checkout before sending; the order notification alone does not establish permission. If checkout completes before payment is confirmed, don’t fire a browser `Purchase` prematurely; use the confirmed server event for that flow. Choose custom only if you need explicit control over event eligibility or payloads and can maintain it. Don’t run this sender alongside native Purchase tracking. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api?utm_source=openai)) **Custom server-side Purchase request (Node.js sketch).** `order` is a validated, paid online order; `ctx` is its permitted shopper context. `order.id` is already canonicalized to match the browser. Keep the token server-side and redact it from request logs. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ```js import { createHash } from "node:crypto"; async function sendPurchase(order, ctx, testEventCode) { if (ctx.mayShareWithMeta !== true) return; if (!ctx.userAgent || !ctx.safeEventUrl) { throw new Error("Missing required website event context"); } const email = order.email?.trim().toLowerCase(); const sha256 = s => createHash("sha256").update(s, "utf8").digest("hex"); const event = { event_name: "Purchase", event_id: `purchase:${order.id}`, event_time: order.paidAtUnixSeconds, action_source: "website", event_source_url: ctx.safeEventUrl, user_data: { client_user_agent: ctx.userAgent, ...(email && { em: [sha256(email)] }), ...(ctx.ip && { client_ip_address: ctx.ip }), ...(ctx.fbp && { fbp: ctx.fbp }), ...(ctx.fbc && { fbc: ctx.fbc }) }, custom_data: { value: order.total, // Numeric Shopify order total currency: order.currency, // Currency corresponding to that total content_type: "product", content_ids: [...new Set(order.items.map(item => item.catalogId))], contents: order.items.map(item => ({ id: item.catalogId, quantity: item.quantity })) } }; const { META_GRAPH_VERSION, META_PIXEL_ID, META_CAPI_TOKEN } = process.env; const url = new URL( `https://graph.facebook.com/${META_GRAPH_VERSION}/${META_PIXEL_ID}/events` ); url.searchParams.set("access_token", META_CAPI_TOKEN); const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ data: [event], ...(testEventCode && { test_event_code: testEventCode }) }) }); const result = await response.json(); if (!response.ok || result.events_received !== 1) { throw new Error(`Meta did not confirm receipt (HTTP ${response.status})`); } } ``` In production, retry transient failures from the queue with the same event ID and timestamp. Alert on persistent rejects or missing context. A successful response confirms receipt, not deduplication or ad attribution. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) ## 6. Validate end to end before scaling spend 1. **Run the full funnel.** In **Meta Events Manager → Data Sources → your dataset → Test Events**, open the storefront, view the lamp, add it to the cart, start checkout, and place a controlled Shopify test order. Check all four names and compare the Purchase amount, currency, and catalog IDs with the actual order and catalog. For custom CAPI tests, use the top-level `test_event_code` and remove it from production requests. Use a test dataset where practical: the code makes events visible in Test Events but does not isolate them from measurement. ([help.shopify.com](https://help.shopify.com/en/manual/checkout-settings/test-orders?utm_source=openai)) 2. **Prove both paths and the failure cases.** With sharing allowed, confirm Browser and Server copies of `Purchase` have matching IDs and deduplicate to one purchase. Reload the confirmation page and, for custom tracking, replay the webhook; neither should produce a second purchase. Repeat with only the browser Pixel request blocked: an eligible purchase should still reach Meta from the server. Then test denied consent and applicable opt-outs separately; neither path should send events that the shopper’s choice prohibits. Include mobile and any accelerated checkout you offer. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) 3. **Reconcile before increasing spend.** Review Diagnostics for missing parameters, catalog mismatches, deduplication issues, and server delays. For a closed window, use a Shopify order export to compute eligible online order counts and value by currency; cross-check against delivery records where available and investigate discrepancies by order. Separate **Shopify orders**, **Meta events received**, and **Ads Manager attributed purchases**. They answer different questions and should not be expected to match one-for-one. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api)) ## 7. Consent and compliance Configure **Shopify admin → Settings → Customer privacy** for the markets you serve. Disclose Meta advertising measurement in the privacy notice, obtain consent where required, and honor applicable opt-outs and Global Privacy Control. If you use a third-party consent platform, integrate it with Shopify’s Customer Privacy API and verify that the same choices govern both the Pixel and server dispatch, including queued sends. Minimize what you send and retain, keep identifiers out of logs, and review Meta’s Business Tools Terms before enabling sharing. **Hashing is not anonymization, and CAPI is not a workaround for a shopper’s privacy choice.** ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai))
Score · attempt 3 the judge's verdict, criterion by criterion10/11 criteria passed · failed: sources_defined
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends Pixel plus CAPI to the same dataset and explains that CAPI still reports a purchase when an ad blocker stops the Pixel request or the confirmation page never loads.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with key parameters, and Purchase is marked with `value`, `currency`, `content_ids`.
code_sketch
A concrete server-side Purchase event code sketch or request example is included showing event_name, event_time, event_id, action_source, and a user_data block.
✓The Node.js sketch builds an event with event_name "Purchase", event_id, event_time, action_source "website" and a user_data block.
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 requires confirming that Browser and Server Purchase copies have matching IDs and deduplicate to 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).
✗Purchase is clearly sourced (browser checkout_completed, server from paid order), but the table lists only Shopify browser triggers for ViewContent, AddToCart and InitiateCheckout and says to "verify the connection method per event", so browser vs server 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.
✓The guide promises no attribution-recovery percentages, says a received event is not necessarily matched or attributed, and states "CAPI is not a workaround for a shopper's privacy choice" with consent constraints on sending.
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓It states Meta compares dataset, event name and event ID, that both copies must use the exact name `Purchase` and the same ID, and it shows where `eventID` and `event_id` go.
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:123456789`) on both sides, and the text says "Preserve the ID and original timestamp on retries" and "retry ... with the same event ID and timestamp".
event_time_stable
The server Purchase event uses the purchase/order occurrence timestamp in Unix seconds and preserves it across retries; using the current send or retry time fails.
✓The code sets `event_time: order.paidAtUnixSeconds`, a stored order-paid timestamp in Unix seconds, and the retry text keeps the same timestamp.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓Email is trimmed, lowercased and SHA-256 hashed in code, and section 4 gives normalization rules for phone and other fields.
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 Meta sales channel for a small store and gives numbered steps (install, Data sharing settings, audit for overlapping senders), with custom as an alternative.