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

Answers & verdicts

Claude Opus 5.5 high effort

Task passed
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$1.20 · 199.2s · 18.8k tok
# Arc Clip Lamp: Meta Conversion Tracking Implementation Guide (Shopify → Meta Pixel + Conversions API) **Status:** Draft for internal use. No campaign has launched and there's no performance data yet, so this guide covers setup and validation only. It makes no claims about how much attribution you'll recover. **Assumptions to confirm:** the store currency is USD (inferred from the $68 price). Cedar & Coil sells one product, the Arc Clip Lamp. The store uses current Shopify checkout (Checkout Extensibility). --- ## (1) Recommended architecture: browser Pixel + server-side CAPI, deduplicated ``` Shopper's browser Your side / Shopify Meta ───────────────── ─────────────────── ──── Meta Pixel (fbq) ── ViewContent, AddToCart, InitiateCheckout, Purchase ──────▶ Dataset eventID = X (Pixel ID) │ Checkout completes ─▶ Shopify order ─▶ server (native app or your webhook) ──────▶ │ Conversions API, event_id = X ▼ Dedup on event_name + event_id → one conversion counted ``` **Why you need both:** - **The browser Pixel alone is fragile.** Ad blockers, browser tracking protection that shortens script-set cookie lifetimes, and pages closing before the script fires all cause events to be lost. Thank-you pages are especially exposed because shoppers often close the tab right away. - **CAPI alone loses browser context.** The Pixel captures the `_fbp` browser ID, the `_fbc` click ID, the page URL and real-time funnel behavior. A server-only setup either loses these or has to rebuild them. - **Running both with a shared event ID gives you redundancy without double counting.** Meta's own platform guidance is to send the same web events from browser and server with matching `event_id` values so it can deduplicate them. Meta also publishes an "event coverage" metric: the share of Pixel events that are also covered by CAPI with shared dedup keys. **Rule of ownership:** each event should have exactly one browser source and one server source. Before you start, remove any Meta pixel hardcoded in `theme.liquid`, any old checkout "Additional scripts," and any other app that fires Meta events. If two pixels fire, every event gets counted twice. --- ## (2) Standard events and their key parameters Tracking plan (follows the analytics skill's tracking-plan format): | Event | Trigger | Key `custom_data` parameters | Notes | |---|---|---|---| | **ViewContent** | Arc Clip Lamp product page view | `content_ids` (e.g., `["<variant_id>"]`), `content_type: "product"`, `content_name: "Arc Clip Lamp"`, `value: 68.00`, `currency: "USD"` | Builds retargeting audiences and catalog signals | | **AddToCart** | Item added to cart | `content_ids`, `content_type`, `contents: [{id, quantity}]`, `value` (price × qty), `currency` | Fire on a confirmed add, not a button click | | **InitiateCheckout** | Checkout started | `content_ids`, `contents`, `num_items`, `value` (cart subtotal), `currency` | | | **Purchase** | Order completed | **Required: `value`, `currency`.** Also send `content_ids`, `contents: [{id, quantity, item_price}]`, `content_type: "product"`, `num_items`, `order_id` | Primary optimization event | **Parameter rules:** - **`content_ids` must match the IDs in your Meta catalog.** If the catalog is synced by the Meta sales channel app, the app handles this. In a custom build, check the ID format in Commerce Manager and use exactly that format. - **Define `value` once and document it.** A good default is order subtotal after discounts, excluding tax and shipping. Browser and server must use the same definition, or your reports will disagree with each other. - **`currency` is an ISO code** (`"USD"`). `value` is a number (`68.00`), not a string like `"$68"`. --- ## (3) Exactly how deduplication works 1. **The keys must match on both sides:** - Browser: `fbq('track', 'Purchase', {...}, { eventID: 'order_5551234' })` - Server: `"event_name": "Purchase", "event_id": "order_5551234"` - Meta's docs say the Pixel's `eventID` must equal the CAPI `event_id`, and the Pixel's event name must equal the CAPI `event_name`. 2. **The window is 48 hours.** If both events reach the same Pixel ID within 48 hours of each other, Meta keeps only the first one. If they arrive within about 5 minutes of each other, Meta keeps the browser event. 3. **Use a stable, deterministic ID** that both sides can derive independently: - Purchase: `order_<Shopify order ID>`. Normalize to the numeric ID on both sides, because some Shopify surfaces return `gid://shopify/Order/123` style IDs. - Upper-funnel events: generate a UUID in the browser and pass it to the server along with the event. 4. **The fallback method is weaker.** Meta can also match events using `event_name` plus `fbp` and/or `external_id`. That method generally only works when the browser event arrives first, so treat it as a backup, not your main strategy. 5. **Dedup only covers browser-vs-server duplicates.** It won't fix your server sending the same order twice (Shopify can redeliver webhooks). Keep your own record of order IDs already sent. 6. **`event_time` can be at most 7 days old.** If any event in a request is older than that, Meta rejects the entire batch. Your retry queue must respect this limit. --- ## (4) Preparing customer information for server-side sending Normalize first, then hash with SHA-256 (lowercase hex). Hash exactly once, either in the browser or on the server, never both. | Key | Normalize | Hash? | |---|---|---| | `em` email | trim, lowercase | SHA-256 | | `ph` phone | digits only, include country code, no `+` or leading zeros (e.g., `16505551212`) | SHA-256 | | `fn` / `ln` first/last name | lowercase, no punctuation, UTF-8 | SHA-256 | | `ct` city | lowercase, no spaces or punctuation | SHA-256 | | `st` state | 2-letter code, lowercase (`ca`) | SHA-256 | | `zp` zip | lowercase, no spaces; US: first 5 digits | SHA-256 | | `country` | ISO 3166-1 alpha-2, lowercase (`us`). Always send it, even if every customer is in one country | SHA-256 | | `external_id` | Shopify customer ID, formatted identically on browser and server | SHA-256 recommended | | `client_ip_address`, `client_user_agent`, `fbp`, `fbc` | send as captured | **Do NOT hash.** If you hash these, Meta can't use them for matching | **Additional rules:** - `client_user_agent` is **required** for website events (`action_source: "website"`). - **Never send a hash of an empty string.** Leave the field out instead. This is the most common bug, and it quietly hurts matching. - Only send fields you actually collected, under the consent rules in section 7. --- ## (5) Shopify setup path: native app vs. custom build ### Option A: Meta's "Facebook & Instagram" sales channel app (native) **Path:** 1. Shopify admin → Sales channels → **Facebook & Instagram** → connect the Business Manager, ad account and dataset (Pixel). 2. Under **Settings → Data sharing**, turn on customer data sharing and pick a level. **Standard** is Pixel only. **Enhanced** and **Maximum** also send events through the Conversions API. 3. Choose **Maximum** if your privacy policy covers it. Sources disagree on exactly what Enhanced vs. Maximum includes, so read the description in the app. 4. Make sure the catalog sync is working so `content_ids` line up. 5. Remove every other Meta pixel (see section 1). **What you get:** the app sends both Pixel and CAPI events, handles hashing and deduplication itself, and runs on Shopify's supported pixel framework. ### Option B: Custom build | Layer | How | |---|---| | Browser | A **Custom pixel** under Settings → Customer events, subscribing to `product_viewed`, `product_added_to_cart`, `checkout_started` and `checkout_completed`, each calling `fbq` with an `eventID`. Don't use checkout "Additional scripts": they were shut off for the Thank you and Order status pages on August 28, 2025. | | Server | A Shopify app with an `orders/paid` (or `orders/create`) webhook that sends CAPI Purchase events. Server-side ViewContent, AddToCart and InitiateCheckout need your own endpoint. This is the hardest part of a custom build. | | Glue | A theme script that writes `_fbp`, `_fbc` (built from `fbclid` when there's no cookie) and the consent state into cart attributes, so they show up on the order's `note_attributes` for the server to use. | | Access | The custom app needs Shopify's protected customer data access to receive email, phone and address in webhooks. | ### Recommendation for Cedar & Coil: Option A (native app at Maximum, or Enhanced if your policy requires) The goal is reliable conversion tracking for one $68 product, launched by a small team before any data exists. The native app serves that goal best: - Dedup, hashing, catalog ID consistency and checkout-platform changes are maintained for you. - It's the only option that covers all four events server-side without building your own endpoints. **The trade-off:** you give up control. You can't define `value` yourself, choose the event IDs, or inspect raw payloads beyond what Events Manager shows. **When to switch to Option B:** only if validation (section 6) shows a gap the app can't close, or you later need custom value definitions, other destinations, or a CDP. **Never run both for the same events:** their event IDs won't match, so every conversion would be counted twice. ### Code sketch: server-side Purchase event (custom path, Node 18+) ```js import crypto from "node:crypto"; import express from "express"; const { META_PIXEL_ID, META_CAPI_TOKEN, META_GRAPH_VERSION /* pin, e.g. "v25.0" */, META_TEST_EVENT_CODE, SHOPIFY_WEBHOOK_SECRET, STORE_ORIGIN } = process.env; const sha256 = (v) => crypto.createHash("sha256").update(v, "utf8").digest("hex"); const h = (v) => (v ? [sha256(v)] : undefined); // never hash empty strings const numId = (id) => String(id).split("/").pop(); // gid://shopify/Order/123 -> 123 const norm = { email: (v) => v?.trim().toLowerCase() || null, phone: (v) => { const d = (v || "").replace(/\D/g, "").replace(/^0+/, ""); return d || null; }, // must already include country code name: (v) => v?.trim().toLowerCase().replace(/[^\p{L}]/gu, "") || null, city: (v) => v?.toLowerCase().replace(/[^\p{L}]/gu, "") || null, state: (v) => v?.trim().toLowerCase() || null, zip: (v, c) => { if (!v) return null; const z = v.toLowerCase().replace(/[\s-]/g, ""); return c === "us" ? z.slice(0, 5) : z; }, country: (v) => v?.trim().toLowerCase() || null, }; const app = express(); app.post("/webhooks/orders-paid", express.raw({ type: "application/json" }), async (req, res) => { // 1) Verify the Shopify webhook signature const digest = crypto.createHmac("sha256", SHOPIFY_WEBHOOK_SECRET).update(req.body).digest("base64"); const given = req.get("X-Shopify-Hmac-Sha256") || ""; if (given.length !== digest.length || !crypto.timingSafeEqual(Buffer.from(digest), Buffer.from(given))) return res.sendStatus(401); res.sendStatus(200); // ack fast; use a queue in production const order = JSON.parse(req.body.toString("utf8")); const orderId = numId(order.id); if (await alreadySent(orderId)) return; // your idempotency store (webhooks can repeat) const attrs = Object.fromEntries((order.note_attributes || []).map((a) => [a.name, a.value])); if (!consentAllowsMeta(order, attrs)) return; // see section 7 const addr = order.billing_address || order.shipping_address || {}; const country = norm.country(addr.country_code); const items = order.line_items || []; const event = { event_name: "Purchase", event_time: Math.floor(new Date(order.processed_at || order.created_at).getTime() / 1000), event_id: `order_${orderId}`, // MUST equal browser eventID action_source: "website", event_source_url: `${STORE_ORIGIN}/checkout`, // don't send order_status_url (contains a token) user_data: { em: h(norm.email(order.email)), ph: h(norm.phone(order.phone || addr.phone)), fn: h(norm.name(addr.first_name)), ln: h(norm.name(addr.last_name)), ct: h(norm.city(addr.city)), st: h(norm.state(addr.province_code)), zp: h(norm.zip(addr.zip, country)), country: h(country), external_id: order.customer?.id ? [sha256(String(order.customer.id))] : undefined, client_ip_address: order.client_details?.browser_ip, // not hashed client_user_agent: order.client_details?.user_agent, // not hashed; required for website events fbp: attrs._fbp || undefined, // not hashed fbc: attrs._fbc || undefined, // not hashed }, custom_data: { currency: order.currency, // "USD" value: Number(order.subtotal_price), // documented definition: after discounts, pre-tax/shipping content_type: "product", content_ids: items.map((li) => String(li.variant_id)), // must match catalog IDs contents: items.map((li) => ({ id: String(li.variant_id), quantity: li.quantity, item_price: Number(li.price) })), num_items: items.reduce((n, li) => n + li.quantity, 0), order_id: orderId, }, }; const body = { data: [event], access_token: META_CAPI_TOKEN, ...(META_TEST_EVENT_CODE && { test_event_code: META_TEST_EVENT_CODE }) }; const r = await fetch(`https://graph.facebook.com/${META_GRAPH_VERSION}/${META_PIXEL_ID}/events`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body), }); const json = await r.json(); if (!r.ok) return scheduleRetry(orderId, json); // retry only while event_time < 7 days old await markSent(orderId); // log json.events_received + json.fbtrace_id }); ``` The matching browser call goes in the custom pixel. It must use the same ID helper and the same `value` definition: ```js analytics.subscribe("checkout_completed", (e) => { const c = e.data.checkout; fbq("track", "Purchase", { value: Number(c.subtotalPrice?.amount), currency: c.currencyCode, content_type: "product", content_ids: c.lineItems.map((li) => String(li.variant?.id).split("/").pop()), }, { eventID: `order_${String(c.order?.id).split("/").pop()}` }); }); ``` --- ## (6) End-to-end validation before scaling spend Work through these in order. Don't increase budget until every gate passes. 1. **Inventory check.** Confirm exactly one source per event per channel: Meta Pixel Helper shows a single Pixel ID, and there are no duplicate events on page load. 2. **Test Events.** Go to Events Manager → your dataset → **Test Events**. - Browser: open the store from the tool. - Server (custom build): send the generated code as `test_event_code`. It's for testing only, so remove it before launch. 3. **Walk the full funnel as a shopper:** product page → add to cart → checkout → completed test order (test gateway, or a real order you then refund). For each event, check: - It appears from **both** Browser and Server, and the pair is shown as **deduplicated**. - `value`, `currency` and `content_ids` are correct (e.g., `68.00`, `USD`, IDs that exist in the catalog). - Server events carry hashed `em`/`ph`, plus unhashed IP, user agent, `fbp` and `fbc` where available. 4. **Test consent paths.** Run the funnel once with marketing consent declined (for example from an EU-region test profile) and confirm Meta events are suppressed or limited as your policy requires. 5. **Diagnostics.** Fix every error in Events Manager's Diagnostics tab. Check Event Match Quality: it's scored 0–10 per event, and Meta suggests aiming for 6.0+ where possible. Also check the event coverage / CAPI coverage indicators. 6. **Reconcile against Shopify.** Over a **closed** window of complete days, compare Shopify web orders with Meta Purchase events (count and total value). - Use the same day boundaries in the same time zone on both sides. The Shopify store time zone and the Meta ad account time zone may differ. - Compute the comparison in a spreadsheet; don't eyeball it. - Explain every gap: consent declines, test orders, non-web orders. Don't just accept a ratio. 7. **Release gate.** Scale only after several consecutive days of clean reconciliation and no new diagnostics. Then keep monitoring weekly, and after any theme, app or checkout change. --- ## (7) Consent and compliance note *This isn't legal advice. Have counsel review it for your markets.* - **CAPI doesn't bypass consent.** Server events need the same lawful basis as Pixel events. Apply the same consent decision on both paths. - **Use Shopify's Customer Privacy settings and cookie banner**, or a consent management platform that syncs with Shopify's Customer Privacy API. In checkout, custom pixels can only see consent through that API (`init.customerPrivacy` and the `visitorConsentCollected` event). - In a custom pixel, set the permission to require marketing consent. - For server events, pass the consent state through (e.g., a cart attribute) and check it before sending. - **Don't treat "accepts email marketing" as tracking consent.** `buyer_accepts_marketing` is about email marketing, not advertising tracking. - **Update the privacy policy** to say you share customer data with Meta for advertising measurement. This matters especially at the Enhanced/Maximum data sharing levels. - **US state privacy laws:** consider Meta's Limited Data Use (`data_processing_options`) for users who opt out of sale or sharing. - **Minimize data.** Send only the fields listed in section 4, hashed as specified. Keep access tokens server-side. Never log raw PII alongside payloads. --- ### Sources consulted - Meta for Developers: [Handling Duplicate Pixel and Conversions API Events](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events); [Server Event Parameters](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event); [Customer Information Parameters](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters); [Parameters overview](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters); [Parameter Builder Library](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameter-builder-library); [Using the API / Test Events](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api); [Set up CAPI as a Platform](https://developers.facebook.com/docs/marketing-api/conversions-api/set-up-conversions-api-as-a-platform/); [Dataset Quality API](https://developers.facebook.com/docs/marketing-api/conversions-api/dataset-quality-api/) - Meta Business Help: [Connect Shopify to Facebook and Instagram](https://www.facebook.com/business/help/646757258759189) - Shopify: [checkout.liquid sunset](https://shopify.dev/docs/storefronts/themes/architecture/layouts/checkout-liquid); [Create custom pixel code](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/code) - Secondary (used only to cross-check data-sharing tiers and the Event Match Quality guidance): relevantaudience.com, ultro.co.jp, shopify.ecom-store.pro **Verify before you start:** - The Graph API version, which changes regularly. `v25.0` was in Meta's docs at the time of writing. - The exact Enhanced vs. Maximum wording in the Facebook & Instagram app. - That the order and pixel field names in the custom code sketch match your Shopify API version.
Score · attempt 1 the judge's verdict, criterion by criterion11/11 criteria passed
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends Pixel plus CAPI with a shared event ID and explains why each alone is fragile (ad blockers, cookie limits, tab closes, and loss of `_fbp`/`_fbc` browser context).
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase lists value, currency, content_ids, contents, num_items and order_id.
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 an event with event_name "Purchase", event_time, event_id `order_${orderId}`, action_source "website" and a full user_data block, then POSTs it to the Graph API /events endpoint.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Events Manager Test Events with test_event_code and requires each event to appear from both Browser and Server and be shown as deduplicated.
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 guide sets one browser source and one server source per event, uses the Shopify orders/paid webhook for server Purchase and custom pixel events for the browser, and notes server-side upper-funnel events need their own endpoint.
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 status line says it makes no claims about how much attribution you'll recover, and section 7 states that CAPI doesn't bypass consent and covers privacy policy, regional rules and data minimization.
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓Section 3 says the Pixel eventID must equal the CAPI event_id and the event names must match, gives the 48-hour window, and treats event_name plus fbp/external_id as a weaker fallback.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓The Purchase ID is deterministic, `order_<Shopify order ID>`, derived identically in browser and server, normalized from gid format, with no random suffix, so webhook retries reuse it and an idempotency check on the order ID prevents resends.
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 computes event_time as Math.floor of the order's processed_at (or created_at) in Unix seconds rather than the send time, and section 3 notes the 7-day limit retries must respect.
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.
✓Section 4 and the code trim and lowercase email, then SHA-256 hash it, skip hashing empty values, and leave IP, user agent, fbp and fbc 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 compares the native app with a custom build, decisively recommends the native Facebook & Instagram app with numbered setup steps, and states the trade-off and when to switch.
✓ Attempt 2
Answer · attempt 2 the model's full response$0.65 · 166.8s · 16.0k tok
# Cedar & Coil: Meta Pixel and Conversions API tracking guide for the Arc Clip Lamp on Shopify **Status:** Draft only. No campaign has launched and there is no performance data yet. This guide sets up tracking; it doesn't predict results. **Assumptions to confirm:** The store sells in USD (the $68 price suggests it, but currency isn't stated anywhere). The store is a standard (non-Plus) Shopify plan. Which regions you sell into, and therefore which consent rules apply, isn't specified. **Recommendation:** Use Shopify's own **Facebook & Instagram app with Customer data sharing set to Maximum**. Use **only one** setup method. Running two creates duplicate events. --- ## 1. Recommended architecture: browser Pixel plus server-side Conversions API (CAPI), deduplicated ``` Shopper's browser Shopify / your server ───────────────── ───────────────────── Meta Pixel (fbq) Conversions API (server to Meta) ViewContent / AddToCart / Same events, especially Purchase, InitiateCheckout / Purchase built from order data + eventID = "purchase_<order_id>" + event_id = "purchase_<order_id>" \ / └──────────► Meta Events Manager ◄──────┘ Same event name + same ID = counted once ``` **Why you need both:** - **The Pixel alone is fragile.** Ad blockers, browser tracking protection, cookie limits, consent banners and closed tabs (for example, a shopper who leaves before the thank-you page loads) can all stop a browser event from arriving. - **CAPI alone loses browser context.** The browser has information the server doesn't automatically have: the `_fbp` browser cookie, the `_fbc` ad-click cookie, the page URL, the user agent and live browsing behaviour. Upper-funnel events like ViewContent happen only in the browser. - **Together, each covers the other's gaps.** Deduplication (section 3) then makes sure an event that arrives both ways is counted once. Meta's own Shopify setup guidance tells you to turn on both the Pixel and the Conversions API after connecting the store. This makes tracking *more reliable*. It doesn't recover a fixed share of lost conversions, so don't plan budgets around a "recovery" number. --- ## 2. Standard events and their key settings Meta's event names are fixed and case-sensitive. Use `ViewContent`, not `view_content`. If you keep an internal tracking plan in lowercase "object_action" style, map those names to Meta's names. Don't rename Meta's events. | Meta event | Fires when (Shopify customer event) | Key parameters | Notes | |---|---|---|---| | **ViewContent** | Arc Clip Lamp product page viewed (`product_viewed`) | `content_ids`, `content_type: "product"`, `value` (68), `currency` | Used for retargeting and catalog matching | | **AddToCart** | Item added (`product_added_to_cart`) | `content_ids`, `contents` [{id, quantity}], `value` (price × quantity), `currency` | Value = what was added, not the cart total | | **InitiateCheckout** | Checkout begins (`checkout_started`) | `content_ids`, `contents`, `num_items`, `value`, `currency` | Value = checkout subtotal | | **Purchase** | Order completed (`checkout_completed` in the browser; the order webhook on the server) | **`value`** (required), **`currency`** (required), **`content_ids`**, `contents`, `content_type`, `num_items`, `order_id` | The event you optimise for. Accuracy matters most here | **Rules for Purchase specifically:** - **`value`**: Pick one definition and use it everywhere. A good choice is the subtotal after discounts, excluding shipping and tax. Never hard-code 68; read the real order amount. - **`currency`**: An ISO code such as `"USD"`, taken from the order. Don't assume it. - **`content_ids`**: Must use **the same ID format as your Meta product catalog**. Catalogs synced from Shopify often use a combined ID such as `shopify_US_<productId>_<variantId>`. Check the actual format in Commerce Manager. A raw Shopify variant ID will only match if your catalog uses raw variant IDs. - **ID consistency:** The browser and server must send identical `content_ids`, `value` and `currency` for the same order. --- ## 3. How deduplication works between Pixel and CAPI **The matching rule:** Meta treats two events as the same event when **both** of these match: 1. **The ID:** the Pixel's `eventID` equals the server's `event_id`. 2. **The name:** the Pixel's event name equals the server's `event_name` (for example, both `Purchase`). 3. Both are sent to **the same Pixel ID**. **The time window:** If Meta sees the same ID-and-name pair within **48 hours** of the first event it received, it discards the later copy. **Where the ID goes:** - **In the browser,** `eventID` is passed in the fourth argument of the `fbq` call, not with the event data: ```js fbq('track', 'Purchase', { value: 68.00, currency: 'USD' }, { eventID: 'purchase_5550001234' }); ``` - **On the server,** `event_id` sits at the top level of each event in the `data` array. **How to build the IDs:** - **Purchase:** Base the ID on the order, e.g. `purchase_<order_id>`. Both sides know the order ID, so no hand-off is needed. A thank-you page reload or a repeated Shopify webhook produces the same ID, so it's also deduplicated. - **Upper-funnel events:** Create a unique ID once in the browser (Shopify's `event.id` works). Send it with the Pixel event *and* pass it to your server for the CAPI event. - **Format the order ID the same way on both sides.** The browser may give the order ID as `gid://shopify/Order/5550001234` while the webhook gives `5550001234`. Strip the prefix so both sides produce the same string. **Common ways deduplication fails:** - The ID is generated separately on each side, e.g. a random ID in the browser and another on the server. - The event names differ (`Purchase` vs `purchase`). - The server sends the event more than 48 hours later. - Two separate setups run at once, such as the Shopify app plus a custom pixel or a leftover hard-coded `fbq` in the theme. Their IDs never match, so every purchase counts twice. **Fallback method:** Meta can also match on event name plus `fbp` or `external_id`. Treat this as a backup, not your main approach. --- ## 4. Preparing customer information before sending it server-side Matching quality depends on the `user_data` you send. **Clean up ("normalise") each field first, then hash it with SHA-256.** Leave the four browser and network identifiers unhashed. Meta's documentation says customer fields that should be hashed but arrive unhashed are rejected automatically. | Field | Meta key | Clean-up before hashing | Hash? | |---|---|---|---| | Email | `em` | Trim spaces, lowercase | **SHA-256** | | Phone | `ph` | Digits only, **including country code** (`+1 (555) 010-0199` → `15550100199`) | **SHA-256** | | First / last name | `fn`, `ln` | Lowercase, trim, remove punctuation | **SHA-256** | | City | `ct` | Lowercase, remove spaces and punctuation | **SHA-256** | | State | `st` | Lowercase two-letter code for the US (`ca`) | **SHA-256** | | Zip | `zp` | Lowercase, no spaces; US = first 5 digits | **SHA-256** | | Country | `country` | Lowercase two-letter ISO code (`us`) | **SHA-256** | | Customer ID | `external_id` | Your Shopify customer ID, kept consistent | Hashing recommended | | IP address | `client_ip_address` | As captured | **Do not hash** | | User agent | `client_user_agent` | As captured; **required for website events** | **Do not hash** | | Browser cookie | `fbp` | Value of the `_fbp` cookie | **Do not hash** | | Ad-click cookie | `fbc` | Value of `_fbc`, or built as `fb.1.<ms_timestamp>.<fbclid>` | **Do not hash** | **Required on every website event:** `event_name`, `event_time` (Unix seconds), `action_source: "website"`, `event_source_url` and `client_user_agent`, plus at least one customer information field. `event_time` can be at most **7 days** old. One event that's too old makes the whole request fail. **Rules for handling customer data:** - Hash on your server, never in public browser code. - Never send raw email or phone numbers anywhere. - Keep the access token in a server environment variable. - Send only the fields you actually have. Empty strings or hashes of empty strings hurt matching. - Don't add anything beyond the fields listed above. --- ## 5. Shopify setup: native app vs. custom build ### Comparison | | **A. Facebook & Instagram app (native)** | **B. Custom: Shopify custom pixel + your own CAPI endpoint** | |---|---|---| | Setup effort | Under an hour, no code | Developer time plus a hosted service to maintain | | Pixel + CAPI | Yes, with data sharing at **Enhanced** or **Maximum** | You build both | | Deduplication | Handled by the app | You design and test the ID scheme (section 3) | | Catalog `content_ids` | Match the catalog the app syncs | You must match the catalog format yourself | | Checkout changes | Shopify and Meta maintain it | Your responsibility (see below) | | Control and visibility | Limited; you can't easily see or change the payloads | Full control over value definition, fields and consent logic | | Upkeep | Low | Ongoing: API versions, webhook failures, token rotation | **Checkout changes affect custom builds:** Shopify has retired the old "additional scripts" box and `checkout.liquid` on the Thank you and Order status pages. On non-Plus stores, script tags on those pages are being removed **August 26, 2026**. Any custom checkout tracking must use **Customer events (custom pixels)** and webhooks, not pasted thank-you-page scripts. ### Recommendation: Option A, the native app with Maximum data sharing Cedar & Coil's situation is one product, a first Meta launch and no existing data. The goal is reliable Purchase data that the ad system can optimise against, as quickly as possible. The native app delivers that with the fewest places for mistakes, especially in deduplication and catalog ID matching. Those are the two problems that most often corrupt early data. What you give up is control and visibility. You can't set your own value definition or inspect every payload. Move to Option B later only if you hit a specific limit, such as needing custom consent logic, a headless storefront, multiple pixels or a non-standard value definition. If you switch, **turn off the app's data sharing first**. **Option A steps:** 1. **Check prerequisites:** The online store isn't password-protected, the plan is Basic or higher, you have a Facebook Page owned by a Meta business portfolio, and you have admin access. 2. **Install the app:** Shopify Admin → Sales channels → add **Facebook & Instagram** → Start setup → log in → connect the business portfolio, Page, ad account, **Pixel** and catalog. 3. **Set data sharing:** Customer data sharing → **Maximum** (Enhanced also uses CAPI). Data access → **Always on** is Meta's recommendation; weigh this against your consent approach in section 7. 4. **Remove other copies of the Pixel:** Search `theme.liquid` and snippets for `fbq(` and `fbevents.js`. Check Settings → Customer events for other Meta pixels, and turn off any other apps that fire this Pixel. 5. **Verify your domain** in Meta Business Settings. 6. **Validate** using section 6. ### Option B code sketch (for later reference) **Browser side.** This goes in Shopify Admin → Settings → Customer events → Add custom pixel. ```js // Custom pixel: use ONLY if the Facebook & Instagram app's data sharing is OFF. !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, document,'script','https://connect.facebook.net/en_US/fbevents.js'); fbq('init', 'YOUR_PIXEL_ID'); const toCatalogId = (variant) => String(variant.id); // ← change to your catalog's ID format const numericId = (gid) => String(gid ?? '').split('/').pop(); analytics.subscribe('checkout_completed', (event) => { const c = event.data.checkout; const orderId = numericId(c.order?.id); // confirm this is populated in testing fbq('track', 'Purchase', { value: Number(c.subtotalPrice?.amount), // SAME definition as the server currency: c.currencyCode, content_type: 'product', content_ids: c.lineItems.map(li => toCatalogId(li.variant)), contents: c.lineItems.map(li => ({ id: toCatalogId(li.variant), quantity: li.quantity })), num_items: c.lineItems.reduce((n, li) => n + li.quantity, 0), }, { eventID: `purchase_${orderId}` }); // ← deduplication key }); // ViewContent / AddToCart / InitiateCheckout follow the same pattern with // product_viewed / product_added_to_cart / checkout_started, using { eventID: event.id }. ``` **Getting `_fbp` and `_fbc` to the server.** Order webhooks don't include browser cookies. A small theme script can save them as hidden cart attributes, which then appear on the order: ```js const ck = Object.fromEntries(document.cookie.split('; ').map(s => s.split('='))); fetch('/cart/update.js', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ attributes: { _fbp: ck._fbp || '', _fbc: ck._fbc || '' } }) }); ``` **Server side.** A Node.js handler that receives Shopify's `orders/paid` webhook and sends the Purchase event to CAPI: ```js import crypto from 'node:crypto'; import express from 'express'; const { PIXEL_ID, META_TOKEN, META_API_VERSION, SHOPIFY_WEBHOOK_SECRET, META_TEST_EVENT_CODE, SHOP_DOMAIN } = process.env; // pin API version, e.g. "vXX.0" const sha256 = (s) => crypto.createHash('sha256').update(s, 'utf8').digest('hex'); const hashed = (v) => (v ? [sha256(v)] : undefined); const N = { email: (v) => v?.trim().toLowerCase(), phone: (v) => v?.replace(/\D/g, '') || undefined, // must include country code name: (v) => v?.trim().toLowerCase().replace(/[^\p{L}]/gu, ''), city: (v) => v?.toLowerCase().replace(/[^\p{L}]/gu, ''), state: (v) => v?.trim().toLowerCase(), // e.g. "ca" zip: (v, cc) => { const z = v?.toLowerCase().replace(/\s/g, ''); return cc === 'US' ? z?.slice(0, 5) : z; }, country: (v) => v?.trim().toLowerCase(), // ISO alpha-2 }; const app = express(); app.post('/webhooks/orders-paid', express.raw({ type: 'application/json' }), async (req, res) => { // 1) Verify the request really came from Shopify const sent = req.get('X-Shopify-Hmac-Sha256') || ''; const calc = crypto.createHmac('sha256', SHOPIFY_WEBHOOK_SECRET).update(req.body).digest('base64'); if (sent.length !== calc.length || !crypto.timingSafeEqual(Buffer.from(sent), Buffer.from(calc))) return res.sendStatus(401); res.sendStatus(200); // acknowledge quickly; process after const o = JSON.parse(req.body.toString('utf8')); const attrs = Object.fromEntries((o.note_attributes || []).map(a => [a.name, a.value])); // 2) Consent gate: skip or limit based on your consent record (see section 7) if (attrs._marketing_consent === 'denied') return; const a = o.billing_address || o.shipping_address || {}; const items = o.line_items || []; const toCatalogId = (li) => String(li.variant_id); // ← must equal the browser-side mapping const event = { event_name: 'Purchase', event_time: Math.floor(new Date(o.processed_at || o.created_at).getTime() / 1000), event_id: `purchase_${o.id}`, // ← identical to browser eventID action_source: 'website', event_source_url: o.order_status_url || `https://${SHOP_DOMAIN}/`, user_data: { em: hashed(N.email(o.email)), ph: hashed(N.phone(o.phone || a.phone)), fn: hashed(N.name(a.first_name)), ln: hashed(N.name(a.last_name)), ct: hashed(N.city(a.city)), st: hashed(N.state(a.province_code)), zp: hashed(N.zip(a.zip, a.country_code)), country: hashed(N.country(a.country_code)), external_id: o.customer?.id ? [sha256(String(o.customer.id))] : undefined, client_ip_address: o.client_details?.browser_ip, // NOT hashed client_user_agent: o.client_details?.user_agent, // NOT hashed; required for web fbp: attrs._fbp || undefined, // NOT hashed fbc: attrs._fbc || undefined, // NOT hashed }, custom_data: { value: Number(o.current_subtotal_price), // after discounts, pre-shipping/tax currency: o.currency, content_type: 'product', content_ids: items.map(toCatalogId), contents: items.map(li => ({ id: toCatalogId(li), quantity: li.quantity, item_price: Number(li.price) })), num_items: items.reduce((n, li) => n + li.quantity, 0), order_id: String(o.id), }, }; const body = { data: [event], ...(META_TEST_EVENT_CODE && { test_event_code: META_TEST_EVENT_CODE }) }; const r = await fetch( `https://graph.facebook.com/${META_API_VERSION}/${PIXEL_ID}/events?access_token=${META_TOKEN}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }); if (!r.ok) console.error('CAPI error', r.status, await r.text()); // alert and queue a retry }); app.listen(3000); ``` **Check these against your store's Shopify API version before relying on the sketch:** - Field availability, especially `client_details.user_agent` and whether the browser event includes the order ID. - If the order ID isn't available in the browser, use the checkout token on both sides instead. - Shopify retries webhooks. Retries are safe because the `event_id` stays the same. - Retries must still arrive within Meta's 7-day `event_time` limit and 48-hour deduplication window. --- ## 6. End-to-end validation before scaling spend **A. Check there's only one copy of the Pixel** - [ ] Meta Pixel Helper (a Chrome extension) shows **one** Pixel ID on the product page. Each event fires once per action. - [ ] No other app or theme code fires this Pixel. **B. Watch events live in Events Manager → Test Events** - [ ] For browser events, open the store from the Test Events tab. - [ ] For server events, send `test_event_code` (Option B). With the native app, server events appear when you place test orders. - [ ] Walk through the funnel: Arc Clip Lamp page → add to cart → checkout → complete a test order. Use Shopify's test payment gateway (Bogus Gateway), or a real order you then refund. - [ ] Each event shows up with the correct name and parameters. - [ ] **Purchase arrives from both Browser and Server** and is marked **deduplicated** (counted once). **C. Check the Purchase data itself** - [ ] `value` equals the order's subtotal (or whatever definition you chose), not a fixed 68. - [ ] `currency` is correct. - [ ] Browser and server values match each other. - [ ] `content_ids` match catalog IDs. Commerce Manager or the Diagnostics tab will flag mismatches. **D. Test edge cases** - [ ] Quantity 2: value doubles and `num_items` = 2. - [ ] A discount code: value reflects the discount. - [ ] Reloading the thank-you page doesn't add another counted Purchase. - [ ] Mobile Safari, plus one browser with an ad blocker: the server Purchase still arrives. - [ ] Declining consent produces the behaviour you've designed (section 7). **E. After 24–72 hours of real traffic** - [ ] Events Manager → **Diagnostics** shows no open errors: missing parameters, deduplication warnings, hashing issues or catalog mismatches. - [ ] Review **Event Match Quality** for Purchase. If it's low, check which customer fields are missing (section 4). **F. Reconcile counts over the same closed time window** - [ ] Compare Shopify paid orders to Meta *received* Purchase events (not attributed conversions) over the same completed days and the same time zone. - [ ] Investigate any gap down to the specific order. - [ ] Don't compare a full week of one source to a partial week of the other. - [ ] Some gap is normal (consent opt-outs, test orders), but it should be explainable. **Go/no-go for scaling spend:** All boxes in A–D pass, E shows no unresolved errors, and F reconciles. Until then, run at a low test budget. Treat early in-platform conversion numbers as directional only. There are no Cedar & Coil benchmarks yet, so don't judge them against any target. --- ## 7. Consent and compliance This is not legal advice. Have counsel review it for the regions you sell into. - **Consent applies to the server too.** CAPI doesn't get around consent requirements. If a shopper declines marketing tracking where consent is required (e.g. EU, UK and some other places), don't send their events from the browser *or* the server. - Use Shopify's cookie banner or a consent tool connected to Shopify's Customer Privacy API. - Set custom pixels to require marketing permission. - For Option B, record consent (for example, as a cart attribute) and check it in the webhook handler. - Check how the native app's "Always on" data access setting fits your consent approach before you turn it on. - **US state privacy laws:** Consider Meta's Limited Data Use setting (`data_processing_options`) for applicable states, and honour opt-out requests. - **Hashing isn't anonymisation.** Hashed emails and phone numbers are still personal data. Disclose Meta sharing in your privacy policy, send only the fields in section 4, and never send product details in URLs or parameters that could reveal sensitive information. - **Security:** Keep the CAPI access token on the server, rotate it if it's exposed, and verify Shopify webhook signatures. - **Messaging rules:** None of these tracking parameters should contain marketing claims. Ad creative is a separate step. It must stay draft-only, use the approved call to action "Explore the Arc Clip Lamp", and must not invent reviews, scarcity or results. --- **Sources:** - Meta, deduplicating Pixel and server events: https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events - Meta, CAPI parameters: https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/ - Meta, Payload Helper: https://developers.facebook.com/documentation/ads-commerce/conversions-api/payload-helper - Meta, connecting Shopify: https://www.facebook.com/business/help/646757258759189 - Shopify, `checkout.liquid` deprecation: https://shopify.dev/docs/storefronts/themes/architecture/layouts/checkout-liquid - Shopify, custom pixels and customer events: https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/gtm-tutorial - Secondary summaries of the 48-hour and 7-day limits and hashing rules: relevantaudience.com and enalitica.com My search budget ran out before I could confirm a few details against primary sources: Shopify's exact webhook and customer-event field names, how the Limited Data Use setting is formatted, and the catalog ID format. Check each one during testing in section 6.
Score · attempt 2 the judge's verdict, criterion by criterion11/11 criteria passed
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends Pixel plus CAPI with deduplication and explains why both are needed: ad blockers, cookie limits and closed tabs hurt the Pixel, while CAPI alone lacks _fbp, _fbc and browser-only events.
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 the Purchase rules require 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 handler builds an event with event_name 'Purchase', event_time, event_id, action_source 'website' and a user_data block, then POSTs it to the Graph API.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6B uses Events Manager Test Events with test_event_code and requires that 'Purchase arrives from both Browser and Server and is marked deduplicated', plus a thank-you page reload check.
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 specifies browser `checkout_completed` versus the order webhook on the server for Purchase, and says ViewContent is browser-only; upper-funnel server sending is described only loosely, but the Purchase source of truth is clear.
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 says it 'doesn't recover a fixed share of lost conversions' and gives no percentages; section 7 states that consent applies to server events and that regional rules constrain 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.
✓Section 3 states that the same event name and the same ID (Pixel eventID equals server event_id), sent to the same Pixel ID, are deduplicated within 48 hours, and shows the fbq fourth-argument placement and the server top-level event_id.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓The ID is derived from the order as `purchase_<order_id>` on both sides, and the guide notes 'Shopify retries webhooks. Retries are safe because the event_id stays the same.'
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 as Math.floor(new Date(o.processed_at || o.created_at).getTime()/1000), the order timestamp in Unix seconds rather than send time, so retries reuse the same value.
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.
✓Section 4 and the code trim and lowercase email, normalise phone, name, city, state, zip and country, then SHA-256 hash them, while IP, user agent, fbp and fbc are left unhashed.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓It compares native app versus custom build, then decisively recommends the native Facebook & Instagram app with Maximum data sharing and lists six concrete setup steps.
✓ Attempt 3
Answer · attempt 3 the model's full response$0.73 · 193.7s · 17.8k tok
# Cedar & Coil: Meta Conversion Tracking Implementation Guide **Store:** Shopify · **Product:** Arc Clip Lamp ($68) · **Destination:** Meta Ads (Pixel + Conversions API) **Status:** Draft. No campaign has launched and there is no performance data yet. This guide sets up measurement before any spend goes out. --- ## (1) Recommended architecture: browser Pixel plus server-side Conversions API, with deduplication ``` Shopper's browser Shopify Meta ───────────────── ─────── ──── Meta Pixel (fbq) ── ViewContent ─────────────────────────────────────────▶ Dataset ── AddToCart (Pixel ID) ── InitiateCheckout ▲ ── Purchase (eventID = order ID) ─────────────────────────▶ │ dedup on │ event_name + Checkout completes ──▶ Order created ──▶ server / Shopify integration ──────▶ │ event_id CAPI Purchase (event_id = order ID) ``` **Why you need both:** | | Browser Meta Pixel | Conversions API (server) | |---|---|---| | Strength | Sees on-site behavior as it happens. Sets and reads the `_fbp`/`_fbc` cookies that link a visit to an ad click. Captures browser context. | Doesn't depend on the browser, so events still arrive when ad blockers, tracking prevention, cookie limits, flaky networks or closed tabs stop the Pixel. | | Weakness | Can be blocked, cut short or stripped by browser privacy controls. | Has no browser context of its own. It needs the cookies, IP and user agent passed to it, plus hashed customer details, to match events well. | When you run both, each important event has two delivery paths. The browser path supplies click and cookie identifiers, and the server path supplies reliability and first-party customer data. Deduplication (section 3) makes sure Meta counts each conversion once. **Expectations:** This setup makes tracking more resilient and can improve match quality. How many conversions it recovers depends on your traffic mix, consent rates and data quality. This guide doesn't promise or estimate a recovery figure, and Cedar & Coil has no baseline to compare against yet. --- ## (2) Standard events and key parameters **Tracking plan** (Meta requires these standard event names exactly as written, so the usual lowercase `object_action` naming doesn't apply here): | Event | Trigger (Shopify) | Key `custom_data` parameters | Decision it informs | |---|---|---|---| | **ViewContent** | Product page view (`product_viewed`) | `content_ids` [catalog ID], `content_type: "product"`, `content_name: "Arc Clip Lamp"`, `value: 68`, `currency: "USD"` | Whether ad clicks become product interest. Also used for retargeting audiences. | | **AddToCart** | Add to cart (`product_added_to_cart`) | `content_ids`, `content_type`, `contents: [{id, quantity}]`, `value` (price × qty), `currency` | Drop-off between product page and cart | | **InitiateCheckout** | Checkout started (`checkout_started`) | `content_ids`, `contents`, `num_items`, `value`, `currency` | Drop-off between cart and checkout | | **Purchase** | Checkout completed or order created | **`value`** and **`currency`** (both required for Purchase), **`content_ids`**, `contents: [{id, quantity, item_price}]`, `content_type: "product"`, `num_items`, `order_id` | Primary optimization and reporting event | **Rules for parameters:** - **`content_ids` must match your Meta catalog IDs exactly**, not just the Shopify product ID. Catalogs synced by Shopify's Meta channel often use a format like `shopify_US_<productId>_<variantId>`. Check the actual IDs in Commerce Manager and use that same format in every event. - **Define `value` once and use it everywhere.** For example, choose product subtotal after discounts, excluding shipping and tax. The browser and server must send the same value for the same order. The $68 list price is only correct for a single lamp with no discount, so always compute value from the order. - **`currency`:** use an ISO 4217 code (for example `USD`). Confirm the store's currency setting rather than assuming it. - **Never put personal data in `custom_data`, URLs or `content_name`.** Personal data goes only in hashed `user_data` (section 4). --- ## (3) How deduplication works between Pixel and CAPI Meta treats a browser event and a server event as the same conversion when **both** of these are true: 1. **The event names match exactly** (Pixel `'Purchase'` equals CAPI `event_name: "Purchase"`), and 2. **The Pixel `eventID` equals the CAPI `event_id`.** On the Pixel, `eventID` goes in the 4th argument of `fbq('track', …)`, not in the custom-data object. The two events also have to arrive **within 48 hours** of the first one Meta received with that ID. Meta generally keeps the copy it received first and drops the other. ```js // Browser — note eventID is in the 4th argument fbq('track', 'Purchase', { value: 68.00, currency: 'USD', content_ids: ['shopify_US_123_456'], content_type: 'product' }, { eventID: '5512345678901' }); // Server — same name, same ID { "event_name": "Purchase", "event_id": "5512345678901", ... } ``` **Rules for event IDs:** - **Purchase:** use the Shopify order ID, normalized the same way on both sides. Web Pixel APIs can return GID strings like `gid://shopify/Order/5512345678901`, so take the part after the last `/` on both sides and confirm in Test Events that the two strings are identical. - **Other events:** generate one unique ID in the browser and pass that same ID to the server. Shopify's Web Pixel events each carry an `event.id` you can use. - **Watch for case and type mismatches.** `"Purchase"` and `"purchase"` won't deduplicate. Also send the ID as the same string format on both sides. - **Deduplication only pairs browser and server events.** It won't protect you from your own server sending the same order twice (for example, after a webhook retry). Prevent that yourself by storing which order IDs you've already sent. - **One source per channel.** If a hardcoded theme Pixel, a GTM Meta tag, another app, or the native channel all fire Purchase with *different* IDs, Meta counts each one. That is the most common cause of inflated Purchase counts. --- ## (4) Preparing customer information for server-side events Meta's systems are designed to reject unhashed contact information. **Normalize first, then SHA-256 hash, and send the lowercase hex result.** If you use the Meta Business SDK, it normalizes and hashes for you. | Field | Key | Normalize, then hash | |---|---|---| | Email | `em` | Trim spaces, lowercase | | Phone | `ph` | Digits only, **including country code**, no `+`, symbols or leading zeros (`15551234567`) | | First / last name | `fn` / `ln` | Lowercase, no punctuation, UTF-8 | | City | `ct` | Lowercase, no spaces or punctuation | | State | `st` | Lowercase two-letter code for US states (`ca`) | | Zip | `zp` | Lowercase, no spaces or dashes. US: first 5 digits. | | Country | `country` | Lowercase ISO 3166-1 alpha-2 (`us`) | | Shopify customer ID | `external_id` | Hashing recommended. Keep it consistent across events. | **Do not hash these:** `client_ip_address`, `client_user_agent`, `fbp` (`_fbp` cookie) and `fbc` (`_fbc` cookie, or `fb.1.<ms timestamp>.<fbclid>` built from the landing URL). **Required for website events:** `action_source: "website"`, `event_source_url` and `client_user_agent`, plus at least one customer information field. **Other rules:** - **Leave out empty fields.** Never hash an empty string. The hash of `""` is a valid-looking value that matches nobody. - **Only send what you're allowed to send** (see section 7). Better matching never justifies ignoring consent. --- ## (5) Shopify setup: native app vs. custom build ### Background Shopify has retired `checkout.liquid`, Additional Scripts and script tags on the Thank you and Order status pages. Plus stores lost them on Aug 28, 2025 and non-Plus stores on Aug 26, 2026. Any browser Purchase tracking now has to run through **Customer Events (Web Pixels)** or an app. Don't build on the old Additional Scripts approach. ### Comparison | | **Native: Facebook & Instagram app (Meta sales channel)** | **Custom: Customer Events pixel + your own CAPI server** | |---|---|---| | Setup effort | Low: connect accounts, pick the dataset, set data sharing | High: Web Pixel code, webhook endpoint, hashing, retries, hosting | | Deduplication | Handled by Shopify (Pixel and CAPI with shared IDs) | Your responsibility for every event | | Catalog ID match | Consistent with the catalog the channel syncs | You map IDs yourself | | Consent handling | Follows Shopify's customer privacy settings | You build the consent gating, including on the server | | Maintenance | Shopify and Meta keep it working through platform changes | You track API versions, Shopify changes and token rotation | | Control | Limited: Shopify decides the payload and value definition | Full: custom value logic, extra fields, events from other systems | ### Recommendation for Cedar & Coil: **use the native app with data sharing set to Maximum** The goal is trustworthy conversion data before the first Meta campaign, for a one-product store without a dedicated engineering team. The native path is the most reliable way to get there with the least that can break. The trade-off is less control over the payload. That trade-off is small for a single $68 product with a simple funnel. Move to a custom build only if you later need something the native app can't do, such as a custom value definition, a non-Shopify backend, or server events from subscriptions. Even then, **turn off the native integration's events for that dataset first** so you don't double count. **Native setup steps:** 1. **Clean up first.** Remove any Meta Pixel code from `theme.liquid`, Meta tags in GTM, Meta snippets in Customer Events, and any other app sending to the same Pixel ID. Afterwards, Meta Pixel Helper should show exactly one Pixel ID firing once per event. 2. **Check prerequisites.** You need the Basic Shopify plan or higher, a store without password protection, a Facebook Page, a Meta business portfolio that owns that Page, and admin rights on the portfolio. 3. Install the **Facebook & Instagram** app. Connect the business portfolio, Page and ad account, and select (or create) the dataset/Pixel. 4. Set **Customer data sharing → Maximum**, which turns on server events through the Conversions API alongside the Pixel. The app describes what each level sends; read it and confirm before saving. 5. Connect the catalog sync so `content_ids` line up with catalog items. 6. Verify the store domain in Meta Business Settings. 7. Configure consent in Shopify (Settings → Customer privacy) before launch (see section 7). 8. Run section 6 validation. ### Code sketch: custom server-side Purchase (if you ever build custom) This shows the server half, triggered by Shopify's `orders/create` webhook. It's a sketch to adapt, not production code. **Prerequisite:** a small storefront theme script must copy the `_fbp` and `_fbc` cookies into cart attributes (`/cart/update.js` with `attributes: {_fbp, _fbc}`). That's how they reach the order, because the webhook has no browser cookies. ```js // server.js — Node 18+, Express. Sketch only. import crypto from "node:crypto"; import express from "express"; const { META_PIXEL_ID, META_CAPI_TOKEN, // token from Events Manager; keep in a secret store META_API_VERSION, // pin explicitly, e.g. "v25.0"; review on upgrades SHOPIFY_WEBHOOK_SECRET, META_TEST_EVENT_CODE, // set ONLY during validation; unset in production } = process.env; const app = express(); app.use("/webhooks/orders-create", express.raw({ type: "application/json" })); // ---------- helpers ---------- const sha256 = (s) => crypto.createHash("sha256").update(s, "utf8").digest("hex"); const h = (v) => (v ? [sha256(v)] : undefined); // omit empties; never hash "" const plainId = (id) => String(id).split("/").pop(); // GID → numeric; same on browser side const norm = { email: (v) => v?.trim().toLowerCase() || null, phone: (v) => v?.replace(/\D/g, "").replace(/^0+/, "") || null, // must already include country code name: (v) => v?.trim().toLowerCase().replace(/[^\p{L}]/gu, "") || null, city: (v) => v?.toLowerCase().replace(/[^\p{L}]/gu, "") || null, state: (v) => v?.trim().toLowerCase() || null, // Shopify province_code, e.g. "ca" zip: (v, cc) => { const z = v?.toLowerCase().replace(/[\s-]/g, ""); return cc === "us" ? z?.slice(0, 5) : z || null; }, country: (v) => v?.trim().toLowerCase() || null, // ISO alpha-2 }; // MUST match the IDs in your Meta catalog exactly — confirm format in Commerce Manager. const catalogId = (li) => `shopify_US_${li.product_id}_${li.variant_id}`; const verifyShopify = (req) => { const digest = crypto.createHmac("sha256", SHOPIFY_WEBHOOK_SECRET).update(req.body).digest("base64"); const header = req.get("X-Shopify-Hmac-Sha256") || ""; return header.length === digest.length && crypto.timingSafeEqual(Buffer.from(digest), Buffer.from(header)); }; const alreadySent = new Set(); // replace with a durable store (DB/Redis) — webhooks retry // ---------- webhook ---------- app.post("/webhooks/orders-create", async (req, res) => { if (!verifyShopify(req)) return res.sendStatus(401); res.sendStatus(200); // ack fast; process async const order = JSON.parse(req.body.toString("utf8")); const eventId = plainId(order.id); if (alreadySent.has(eventId)) return; const attrs = Object.fromEntries((order.note_attributes || []).map((a) => [a.name, a.value])); // Consent gate: only send if marketing consent was granted where required (see section 7). if (attrs._mkt_consent === "denied") return; const addr = order.billing_address || order.shipping_address || {}; const cc = norm.country(addr.country_code); const event = { event_name: "Purchase", event_time: Math.floor(new Date(order.created_at).getTime() / 1000), // must be within 7 days event_id: eventId, // == browser eventID action_source: "website", event_source_url: order.order_status_url, // page where the conversion happened user_data: { em: h(norm.email(order.email)), ph: h(norm.phone(order.phone || addr.phone)), fn: h(norm.name(addr.first_name)), ln: h(norm.name(addr.last_name)), ct: h(norm.city(addr.city)), st: h(norm.state(addr.province_code)), zp: h(norm.zip(addr.zip, cc)), country: h(cc), external_id: order.customer?.id ? h(String(order.customer.id)) : undefined, client_ip_address: order.client_details?.browser_ip || order.browser_ip || undefined, // NOT hashed client_user_agent: order.client_details?.user_agent || undefined, // NOT hashed fbp: attrs._fbp || undefined, // NOT hashed fbc: attrs._fbc || undefined, // NOT hashed }, custom_data: { currency: order.currency, // e.g. "USD" value: Number(order.current_subtotal_price), // the ONE value definition you chose content_type: "product", content_ids: order.line_items.map(catalogId), contents: order.line_items.map((li) => ({ id: catalogId(li), quantity: li.quantity, item_price: Number(li.price), })), num_items: order.line_items.reduce((n, li) => n + li.quantity, 0), order_id: eventId, }, }; const body = { data: [event], ...(META_TEST_EVENT_CODE && { test_event_code: META_TEST_EVENT_CODE }) }; const url = `https://graph.facebook.com/${META_API_VERSION}/${META_PIXEL_ID}/events?access_token=${META_CAPI_TOKEN}`; for (let attempt = 1; attempt <= 3; attempt++) { const r = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) }); const json = await r.json(); if (r.ok) { alreadySent.add(eventId); console.log("CAPI ok", eventId, json.events_received, json.fbtrace_id); return; } console.error("CAPI error", eventId, r.status, json?.error?.message, json?.error?.fbtrace_id); if (r.status < 500) return; // 4xx = payload problem; fix, don't retry await new Promise((s) => setTimeout(s, 2 ** attempt * 1000)); } }); app.listen(3000); ``` **Matching browser half** (Shopify Admin → Settings → Customer events → custom pixel). Load Meta's base `fbq` code and `fbq('init', PIXEL_ID)` first, then: ```js const plainId = (id) => String(id).split("/").pop(); const catalogId = (pid, vid) => `shopify_US_${plainId(pid)}_${plainId(vid)}`; analytics.subscribe("checkout_completed", (event) => { const c = event.data.checkout; fbq("track", "Purchase", { value: Number(c.subtotalPrice.amount), // same definition as server currency: c.currencyCode, content_type: "product", content_ids: c.lineItems.map((li) => catalogId(li.variant.product.id, li.variant.id)), num_items: c.lineItems.reduce((n, li) => n + li.quantity, 0), }, { eventID: plainId(c.order.id) }); // == server event_id }); ``` In a custom build, ViewContent, AddToCart and InitiateCheckout also need server copies. The usual pattern is for the custom pixel to send each event (with `event.id`) to your endpoint, which forwards it to CAPI using the same `event_id`. That extra work is a big part of why the native app is the better fit here. --- ## (6) End-to-end validation before scaling spend Note: events sent with a `test_event_code` are **not** discarded. They count as real data for targeting and measurement, so keep test orders few, low value, and clearly labeled. **Step A: Check for duplicate sources** - Pixel Helper on the home page, product page, cart and checkout should show one Pixel ID firing once per event. - Search the theme code, GTM and Customer Events for any leftover Meta snippets. **Step B: Test Events (Events Manager → your dataset → Test Events)** Walk the funnel: product page → add to cart → checkout → purchase. For the purchase, use a real low-value order that you refund, or Shopify's test payment mode. For each event, check: - [ ] Both a **Browser** and a **Server** row appear, and one of them is marked deduplicated - [ ] `event_id` is identical on both rows - [ ] `value` and `currency` are correct, e.g. `68` / `USD` for one lamp with no discount - [ ] `content_ids` match catalog IDs exactly - [ ] Server `user_data` contains the expected keys (em, ph, fbp, fbc, IP, UA). Hashed fields show as hashes and nothing appears in plain text. Server events should be visible within about 20 minutes. Overview charts can take 30 minutes or more to update. **Step C: Edge cases** - [ ] Ad blocker on, and Safari private window: the server Purchase should still arrive - [ ] Landing URL with a test `fbclid`: `fbc` should be populated - [ ] Quantity of 2 and a discount code: value should follow your value definition - [ ] Marketing consent declined (in a region where consent is required): events should behave the way your consent policy says - [ ] Custom build only: replay a webhook and confirm no second server event is sent **Step D: After 24–48 hours of live traffic** - Check the Overview **deduplication** view, **Event Match Quality** for Purchase, and **Diagnostics**. Fix every open warning. - Remove `test_event_code` (custom builds). **Step E: Reconcile over a closed window** - Pick a set of fully completed days in the same time zone. Shopify uses the store's time zone and Meta uses the ad account's time zone, so align them. - Compare Shopify online-store orders (excluding test and cancelled orders) with Meta **Purchase events received** in Events Manager. Use received events, not attributed conversions in Ads Manager, which are a different measure. - Do the comparison in a spreadsheet or script from row-level data, matched by order ID if you log event IDs. Don't eyeball it. - **Meta higher than Shopify** points to duplicates. **Meta far lower** points to a broken server path or consent gating. Expect Meta to be somewhat lower where shoppers decline consent. **When to scale:** only after Steps A–E pass with no open diagnostics over a full reconciled window. Until then, keep spend at test levels and keep all campaigns in draft or low-budget testing. --- ## (7) Consent and compliance - **Gate both paths.** The Pixel and CAPI must follow the same consent decision. A server-side event is still a marketing data transfer. - **Native app:** follows Shopify's customer privacy settings. - **Custom build:** record the consent state (for example, in a cart attribute from Shopify's Customer Privacy API) and check it before sending to CAPI, as the sketch does. - **Regions:** turn on Shopify's cookie banner and consent settings for regions that require opt-in, such as the EU/UK. For US state privacy laws, look at Meta's **Limited Data Use** option (`data_processing_options`) and your opt-out handling. - **Disclosure:** update the privacy policy to name Meta Pixel/CAPI, what's shared (hashed contact details, purchase data, device data) and why. Meta's terms require proper notice to users. - **Data minimization:** - Send only the fields listed in section 4, hashed where required. - Keep personal data out of `custom_data`, URLs and event names. - Store the CAPI access token as a secret and rotate it if exposed. - Don't log raw personal data on your server. - **Brand rules:** test and tracking setup must not create fake reviews, customer results or performance claims. - **Not legal advice.** Have whoever owns privacy compliance approve the consent setup before launch. --- **Before you implement, confirm these details:** the store's currency, the exact catalog `content_id` format in Commerce Manager, the Shopify plan, and which regions you'll target with ads. The consent setup depends on that last one. **Sources checked** (Meta and Shopify features change, so re-check before you build): - Meta's [Conversions API parameters](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/), [Payload Helper](https://developers.facebook.com/documentation/ads-commerce/conversions-api/payload-helper) and [Using the API / Test Events](https://developers.facebook.com/documentation/ads-commerce/conversions-api/using-the-api) docs - Meta's [Shopify connection guide](https://www.facebook.com/business/help/646757258759189) - Shopify's [checkout.liquid deprecation notice](https://shopify.dev/docs/storefronts/themes/architecture/layouts/checkout-liquid) - Practitioner summaries of the 48-hour deduplication rule ([Relevant Audience](https://www.relevantaudience.com/facebook-ads/meta-pixel-and-conversions-api-guide/), [Endframe](https://www.endframe.io/blog/meta-capi-event-deduplication-event-id)) - Practitioner summaries of the hashing rules ([Enalitica](https://enalitica.com/blog/meta-conversions-api-capi-ecommerce)) The API version shown is the one current in Meta's docs when this was written. Pin a version explicitly and review it when you upgrade.
Score · attempt 3 the judge's verdict, criterion by criterion11/11 criteria passed
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends Pixel plus CAPI with deduplication, and its comparison table explains why both are needed (ad blockers, tracking prevention and cookie limits versus the lack of browser context).
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 an event with event_name: "Purchase", event_time, event_id, action_source: "website" and a full 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.
✓Step B uses Events Manager Test Events and checks that both Browser and Server rows appear, that one is marked deduplicated and that event_id is identical on both rows.
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 diagram and sketch show the browser Purchase from the checkout_completed Web Pixel and the server Purchase from the orders/create webhook keyed on the order ID. The other events are tied to Shopify triggers, and the guide says custom builds need server copies via the custom pixel; this is less explicit for the other three events.
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 says it "doesn't promise or estimate a recovery figure" and treats consent and regional rules as a gate on both Pixel and CAPI (section 7, Limited Data Use).
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓Section 3 requires an exact event_name match and Pixel eventID equal to CAPI event_id, shows eventID in the 4th fbq argument, states the 48-hour window, and gives a code example.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓The Purchase event_id is the deterministic Shopify order ID (plainId(order.id)) on both browser and server, reused across retries, with an alreadySent check against webhook 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 computed as Math.floor(new Date(order.created_at).getTime()/1000), the order creation time in Unix seconds, and is not recomputed per retry.
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.
✓Section 4 and the code normalize (trim, lowercase, digits-only phone) and SHA-256 hash em, ph, fn, ln, ct, st, zp, country and external_id, while leaving IP, user agent, fbp and fbc unhashed and omitting empty values.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓The guide compares native and custom, then decisively recommends the native Facebook & Instagram app with Maximum data sharing and gives an eight-step setup list.