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

Answers & verdicts

GPT-6 Luna high effort

Task failed
Task the exact prompt the model was given — assignment, source material, and skill guidance
Cedar & Coil sells the Arc Clip Lamp on Shopify and is preparing Meta ads. Write an implementation guide a technical marketer can follow to get reliable conversion tracking from the Shopify store into Meta, resilient to browser privacy limits. Cover, with labeled sections: (1) recommended architecture - browser Meta Pixel plus server-side Conversions API with deduplication - and why both are needed; (2) which standard events to send (ViewContent, AddToCart, InitiateCheckout, Purchase) with the key parameters for each, including value, currency, and content_ids on Purchase; (3) exactly how deduplication works between Pixel and CAPI; (4) how customer information must be prepared before sending server-side; (5) the concrete Shopify setup path - compare the native Meta sales channel app against a custom implementation, recommend one for a small DTC store, and include a code sketch of a server-side Purchase event request; (6) how to validate the setup end to end before scaling spend; (7) a consent and compliance note. Do not promise specific attribution recovery percentages. --- ## Supplied source: product-marketing.md # Cedar & Coil Cedar & Coil is a fictional direct-to-consumer brand for people who work or make things in compact spaces. Its first product is the Arc Clip Lamp, a rechargeable task light designed to move between a desk, shelf, and bedside. The approved positioning is adaptable light without surrendering permanent surface space. The voice is practical, warm, and visually specific—not luxury, medical, or productivity-maximizing. All campaign work must remain draft-only. Do not invent reviews, awards, scarcity, environmental claims, performance guarantees, or customer results. --- ## Supplied source: facts.md # Authoritative synthetic facts - Product: Arc Clip Lamp. - Price: $68. - Included: lamp, padded clamp, USB-C charging cable, and storage sleeve. - Lighting: three brightness settings and two color-temperature settings. - Battery statement allowed: up to eight hours on the lowest brightness. - Clamp opening: surfaces up to 2.25 inches thick. - Audience: renters, students, and makers with limited desk or counter space. - Approved CTA: Explore the Arc Clip Lamp. - No campaign has launched and no performance data exists. --- ## Skill guidance you should follow --- name: analytics description: "Set up or audit tracking — GA4, GTM, Mixpanel, Segment; tracking plans, event naming, UTM conventions, conversion and attribution debugging. Rate metrics divide matching closed windows — never full-period spend by partial-period results." metadata: version: 2.2.0 --- # Analytics Tracking You are an expert in analytics implementation and measurement. Your goal is to help set up tracking that provides actionable insights for marketing and product decisions. ## Initial Assessment **Check for product marketing context first:** If `.agents/product-marketing.md` exists (or `.claude/product-marketing.md`, or the legacy `product-marketing-context.md` filename, in older setups), read it before asking questions. Use that context and only ask for information not already covered or specific to this task. **Apply the project's brand:** If `BRAND.md` exists, read it before asking questions and apply it to everything you produce — its voice, messaging, and audience for anything written, and its colors, typography, and logo for anything visual. Never ask for a brand fact it already answers. If it lacks something you need, name the missing fact instead of inventing one or quietly falling back to a generic default. Before implementing tracking, understand: 1. **Business Context** - What decisions will this data inform? What are key conversions? 2. **Current State** - What tracking exists? What tools are in use? 3. **Technical Context** - What's the tech stack? Any privacy/compliance requirements? --- ## Core Principles ### 1. Track for Decisions, Not Data - Every event should inform a decision - Avoid vanity metrics - Quality > quantity of events ### 2. Start with the Questions - What do you need to know? - What actions will you take based on this data? - Work backwards to what you need to track ### 3. Name Things Consistently - Naming conventions matter - Establish patterns before implementing - Document everything ### 4. Maintain Data Quality - Validate implementation - Monitor for issues - Clean data > more data ### 5. Compute, Don't Eyeball - Derive every total, rate, and delta from row-level data with a script or spreadsheet — never by scanning rows and summing mentally. One silently dropped row corrupts every figure downstream of it. - Cross-check each headline figure a second, independent way (a reconciliation total, a recomputation from a different grouping) before reporting it, and chase any mismatch to the exact row. - When a claim is about one segment — a single campaign, ad set, channel, or week — report that segment's own numbers. Never fold it into a neighboring group and let the group's total speak for it. ### 6. Match Observation Windows - A rate or efficiency metric divides a numerator and denominator that cover the same closed observation window. Never divide a full period's spend by a partial period's conversions or revenue — restate both over the weeks that actually have data, and say which weeks those are. - Cohort rates use only cohorts whose observation window has ended. A trial or signup still inside its window is pending, not failed — exclude it from the denominator and label it as pending rather than counting it against the rate. ### 7. Recommend Against the Stated Goal - Analysis ends in a recommendation, and the recommendation must be argued from the goal the brief states — the launch target, audience, revenue, or positioning objective — not only from what is operationally easiest. Name which stated goal each option serves and what it trades away. --- ## Tracking Plan Framework ### Structure ``` Event Name | Category | Properties | Trigger | Notes ---------- | -------- | ---------- | ------- | ----- ``` ### Event Types | Type | Examples | |------|----------| | Pageviews | Automatic, enhanced with metadata | | User Actions | Button clicks, form submissions, feature usage | | System Events | Signup completed, purchase, subscription changed | | Custom Conversions | Goal completions, funnel stages | **For comprehensive event lists**: See [references/event-library.md](references/event-library.md) --- ## Event Naming Conventions ### Recommended Format: Object-Action ``` signup_completed button_clicked form_submitted article_read checkout_payment_completed ``` ### Best Practices - Lowercase with underscores - Be specific: `cta_hero_clicked` vs. `button_clicked` - Include context in properties, not event name - Avoid spaces and special characters - Document decisions --- ## Essential Events ### Marketing Site | Event | Properties | |-------|------------| | cta_clicked | button_text, location | | form_submitted | form_type | | signup_completed | method, source | | demo_requested | - | ### Product/App | Event | Properties | |-------|------------| | onboarding_step_completed | step_number, step_name | | feature_used | feature_name | | purchase_completed | plan, value | | subscription_cancelled | reason | **For full event library by business type**: See [references/event-library.md](references/event-library.md) --- ## Event Properties ### Standard Properties | Category | Properties | |----------|------------| | Page | page_title, page_location, page_referrer | | User | user_id, user_type, account_id, plan_type | | Campaign | source, medium, campaign, content, term | | Product | product_id, product_name, category, price | ### Best Practices - Use consistent property names - Include relevant context - Don't duplicate automatic properties - Avoid PII in properties --- ## GA4 Implementation ### Quick Setup 1. Create GA4 property and data stream 2. Install gtag.js or GTM 3. Enable enhanced measurement 4. Configure custom events 5. Mark conversions in Admin ### Custom Event Example ```javascript gtag('event', 'signup_completed', { 'method': 'email', 'plan': 'free' }); ``` **For detailed GA4 implementation**: See [references/ga4-implementation.md](references/ga4-implementation.md) --- ## Google Tag Manager ### Container Structure | Component | Purpose | |-----------|---------| | Tags | Code that executes (GA4, pixels) | | Triggers | When tags fire (page view, click) | | Variables | Dynamic values (click text, data layer) | ### Data Layer Pattern ```javascript dataLayer.push({ 'event': 'form_submitted', 'form_name': 'contact', 'form_location': 'footer' }); ``` **For detailed GTM implementation**: See [references/gtm-implementation.md](references/gtm-implementation.md) --- ## UTM Parameter Strategy ### Standard Parameters | Parameter | Purpose | Example | |-----------|---------|---------| | utm_source | Traffic source | google, newsletter | | utm_medium | Marketing medium | cpc, email, social | | utm_campaign | Campaign name | spring_sale | | utm_content | Differentiate versions | hero_cta | | utm_term | Paid search keywords | running+shoes | ### Naming Conventions - Lowercase everything - Use underscores or hyphens consistently - Be specific but concise: `blog_footer_cta`, not `cta1` - Document all UTMs in a spreadsheet --- ## Debugging and Validation ### Testing Tools | Tool | Use For | |------|---------| | GA4 DebugView | Real-time event monitoring | | GTM Preview Mode | Test triggers before publish | | Browser Extensions | Tag Assistant, dataLayer Inspector | ### Validation Checklist - [ ] Events firing on correct triggers - [ ] Property values populating correctly - [ ] No duplicate events - [ ] Works across browsers and mobile - [ ] Conversions recorded correctly - [ ] No PII leaking ### Common Issues | Issue | Check | |-------|-------| | Events not firing | Trigger config, GTM loaded | | Wrong values | Variable path, data layer structure | | Duplicate events | Multiple containers, trigger firing twice | --- ## Privacy and Compliance ### Considerations - Cookie consent required in EU/UK/CA - No PII in analytics properties - Data retention settings - User deletion capabilities ### Implementation - Use consent mode (wait for consent) - IP anonymization - Only collect what you need - Integrate with consent management platform --- ## Output Format ### Tracking Plan Document ```markdown # [Site/Product] Tracking Plan ## Overview - Tools: GA4, GTM - Last updated: [Date] ## Events | Event Name | Description | Properties | Trigger | |------------|-------------|------------|---------| | signup_completed | User completes signup | method, plan | Success page | ## Custom Dimensions | Name | Scope | Parameter | |------|-------|-----------| | user_type | User | user_type | ## Conversions | Conversion | Event | Counting | |------------|-------|----------| | Signup | signup_completed | Once per session | ``` --- ## Task-Specific Questions 1. What tools are you using (GA4, Mixpanel, etc.)? 2. What key actions do you want to track? 3. What decisions will this data inform? 4. Who implements - dev team or marketing? 5. Are there privacy/consent requirements? 6. What's already tracked? --- ## Tool Integrations For implementation, see the [tools registry](../../tools/REGISTRY.md). Key analytics tools: | Tool | Best For | MCP | Guide | |------|----------|:---:|-------| | **GA4** | Web analytics, Google ecosystem | ✓ | [ga4.md](../../tools/integrations/ga4.md) | | **Mixpanel** | Product analytics, event tracking | - | [mixpanel.md](../../tools/integrations/mixpanel.md) | | **Amplitude** | Product analytics, cohort analysis | - | [amplitude.md](../../tools/integrations/amplitude.md) | | **PostHog** | Open-source analytics, session replay | - | [posthog.md](../../tools/integrations/posthog.md) | | **Segment** | Customer data platform, routing | - | [segment.md](../../tools/integrations/segment.md) | --- ## Related Skills - **ab-testing**: For experiment tracking - **seo-audit**: For organic traffic analysis - **cro**: For conversion optimization (uses this data) - **revops**: For pipeline metrics, CRM tracking, and revenue attribution
✗ Attempt 1
Answer · attempt 1 the model's full response$0.009 · 92.0s · 6.9k tok
# Cedar & Coil: Shopify-to-Meta Conversion Tracking Guide **Recommendation:** For this small DTC store, start with Shopify’s **Facebook & Instagram by Meta** sales channel at the **Maximum** data-sharing level, provided that level matches Cedar & Coil’s consent choices and privacy disclosures. It supplies the browser Pixel and server-side Conversions API (CAPI) through one integration. Avoid adding a second Meta Pixel or CAPI app on top of it. CAPI can make event delivery less dependent on the customer’s browser, but it does **not** bypass consent, recover identifiers that were never available, or guarantee that Meta will attribute every order. ## 1. Recommended architecture: Pixel + CAPI Use two complementary paths: - **Meta Pixel in the browser:** Sends product browsing and funnel activity, such as product views, cart additions, and checkout starts. It can carry browser identifiers and click information when available. - **Meta CAPI from Shopify/server:** Sends conversion data directly from Shopify or a server. This helps when browser tracking is limited by ad blockers or browser privacy features; Shopify notes that those can block or limit browser Pixel data. Server events remain subject to Shopify’s customer privacy and consent settings. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels)) For reliable reporting, **share an event through both paths only when you can deduplicate it**. With Shopify’s native channel, let the channel manage the Pixel/CAPI integration. In a custom build, a common starting point is browser events for storefront activity and a server Purchase event; add other server events only if you can reliably pair each one with its browser counterpart. ## 2. Events and parameters Use Meta’s standard event names exactly as shown below. Send monetary values as numbers, with a three-letter ISO currency code such as `USD`. Keep product IDs consistent with the IDs used in the Meta catalog. | Meta event | Trigger | Recommended `custom_data` | |---|---|---| | `ViewContent` | Customer views the Arc Clip Lamp product page | `content_ids` (catalog-matched product or variant ID), `content_type: "product"`, `value` (displayed product price), `currency` | | `AddToCart` | Customer adds a product to cart | `content_ids`, `content_type`, `value` (added quantity × unit price), `currency`, `contents: [{id, quantity, item_price}]` | | `InitiateCheckout` | Customer starts checkout | `content_ids` for cart items, `content_type`, `value` (cart/checkout total), `currency`, `contents`, `num_items` | | `Purchase` | A completed order | **Required for this plan:** `content_ids` for purchased items, `content_type: "product"`, `value` (final order total), `currency`, `contents`, `num_items`, and `order_id` | The product’s listed price is **$68**, but send the actual event/order amount from Shopify—not a hard-coded price. Define the Purchase value consistently. Shopify says its Meta order-value events use the order total, including duties, taxes, and discounts; decide whether to follow that convention and keep the definition consistent across any custom implementation. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) For `content_ids`, use identifiers that match the relevant catalog items exactly. If the catalog is organized by variant, send the matching variant IDs; if it is organized by product, send those product IDs. ## 3. Exactly how Pixel/CAPI deduplication works For the same customer action sent through both routes: 1. Send the **same event name** on each route—for example, `Purchase`. 2. Generate one unique `event_id` for that action. 3. Send it as Pixel’s `eventID` and CAPI’s `event_id`. 4. Send both to the same Meta data source. Meta’s recommended method matches the event ID **and** event name; it considers matching events received within 48 hours for deduplication. Meta generally prefers the event received first when the two are not meaningfully different. Its alternative matching method uses `fbp` and/or `external_id`, but Meta documents limitations, so use a shared event ID when possible. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) Example Pixel call: ```js fbq( "track", "Purchase", { value: 68.00, currency: "USD", content_ids: ["CATALOG_ITEM_ID"] }, { eventID: "purchase-ORDER_ID" } ); ``` The matching CAPI event must use `event_name: "Purchase"` and `event_id: "purchase-ORDER_ID"`. For a Shopify order, a canonicalized order ID can provide a stable Purchase ID—provided both paths derive the **exact same string**. Do not generate a fresh random ID independently on the browser and server. Events that are not sent through both routes do not need cross-route deduplication. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 4. Prepare customer information before server-side transmission Include only identifiers available for the event and permitted by the customer’s consent choices. - **Hash identifiers Meta requires hashed**—including email, phone, first and last name, and location fields—using SHA-256 after applying Meta’s field-specific normalization rules. For example, trim and lowercase an email before hashing it. Normalize a phone with its country calling code and remove formatting characters before hashing. - **Do not hash** `client_ip_address`, `client_user_agent`, `fbp`, or `fbc`. Send these only when available and allowed. - Hash `external_id` when you use one; Meta recommends hashing it. - Omit unavailable values. Don’t send empty strings, invent values, hash the same value twice, or put customer PII in `custom_data`. Meta’s current parameter reference marks the required hash treatment for customer fields and identifies IP address, user agent, `fbp`, and `fbc` as unhashed fields. Hashing is not the same as anonymization; it remains customer data and must be handled accordingly. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/)) ## 5. Shopify setup: native channel vs. custom implementation ### Recommended for Cedar & Coil: native Meta sales channel 1. In Shopify, install/connect **Facebook & Instagram by Meta** and connect the appropriate Meta business assets, ad account, and Pixel/data source. 2. Go to **Sales channels → Facebook & Instagram → Settings → Data sharing settings**. Enable customer data sharing, choose **Maximum**, and select the correct Pixel/data source. Shopify’s instructions describe this setup path; its Maximum level uses both the Pixel and CAPI. Choose it only if it is appropriate for the store’s privacy and consent configuration. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) 3. Remove legacy Meta Pixel snippets from the theme or old integrations before going live. Shopify warns that retaining old theme code alongside the channel can produce duplicate or incorrect data. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/)) 4. Don’t add another Pixel/CAPI integration unless there is a specific, tested reason. **Why this is the small-store choice:** It is the lowest-maintenance way to get Shopify’s supported integration, including server-side Purchase delivery. A custom implementation gives more control, but Cedar & Coil would also own event mapping, webhook security, consent enforcement, retries, idempotency, and ongoing API maintenance. ### When custom CAPI makes sense Use a custom implementation only if the native integration has a verified gap that matters to the business and someone can maintain it. A robust design typically uses Shopify customer events for browser events and a server-side order event/webhook for Purchase. Shopify recommends its Web Pixels API for app integrations; custom pixels run in a sandbox and Shopify describes them as an advanced, unsupported feature. ([shopify.dev](https://shopify.dev/docs/apps/build/marketing/pixels)) **Server-side Purchase request sketch (Node.js):** This illustrates the CAPI payload shape; map the example order fields to Shopify’s current webhook/API payload, keep credentials server-side, and add webhook signature verification, retry handling, and idempotency before production use. ```js import { createHash } from "node:crypto"; const sha256 = (value) => createHash("sha256").update(value, "utf8").digest("hex"); const normalizedEmail = (email) => email?.trim().toLowerCase(); async function sendPurchaseToMeta(order, consented, browserContext) { if (!consented) return; // Apply the store's documented consent rules. const eventId = `purchase-${canonicalOrderId(order.id)}`; const items = order.line_items.map((line) => ({ id: catalogIdFor(line), // Must match the Meta catalog ID quantity: line.quantity, item_price: Number(line.price), })); const payload = { data: [{ event_name: "Purchase", event_time: Math.floor(Date.parse(order.processed_at) / 1000), event_id: eventId, action_source: "website", event_source_url: order.checkout_url, // Use the actual relevant URL user_data: { ...(normalizedEmail(order.email) ? { em: [sha256(normalizedEmail(order.email))] } : {}), ...(browserContext.ip ? { client_ip_address: browserContext.ip } : {}), ...(browserContext.userAgent ? { client_user_agent: browserContext.userAgent } : {}), ...(browserContext.fbp ? { fbp: browserContext.fbp } : {}), ...(browserContext.fbc ? { fbc: browserContext.fbc } : {}), }, custom_data: { value: Number(order.total_price), currency: order.currency, content_ids: items.map((item) => item.id), content_type: "product", contents: items, num_items: items.reduce((sum, item) => sum + item.quantity, 0), order_id: String(order.id), }, }], // Add test_event_code: "..." only while testing. }; const response = await fetch( `https://graph.facebook.com/v25.0/${process.env.META_PIXEL_ID}/events` + `?access_token=${process.env.META_CAPI_TOKEN}`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(payload), } ); if (!response.ok) { throw new Error(`Meta CAPI request failed: ${response.status}`); } } ``` This sketch hashes email as an example; production code must normalize each other field according to Meta’s field-specific rules. For a dual-sent Purchase, the browser Pixel must use the same `eventId`. Shopify’s Web Pixels API exposes a `checkout_completed` event and an order ID for that event, which can be useful when building a custom bridge. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) ## 6. Validate end to end before scaling spend 1. **Check for duplicate senders:** Confirm the native channel is the only Meta integration, unless a custom setup intentionally replaces it. Remove old theme code, duplicate pixels, and overlapping app/GTM Purchase tags. 2. **Check Shopify’s event stream:** In **Settings → Customer events**, use Shopify Pixel Helper to test the app pixel. Browse a product, add it to cart, start checkout, and place a test order to trigger the completion event. Shopify’s helper shows received events and can indicate when a pixel is awaiting consent. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels)) 3. **Check Meta Events Manager:** Open the correct data source’s Test Events view and verify the browser and server connections. Confirm the event names, values, currencies, catalog IDs, and—on overlapping events—matching event IDs. 4. **Test the Purchase path:** Place a test order, then verify that the event is tied to a completed order and that value/currency agree with Shopify’s chosen total convention. Reloading or revisiting the order confirmation page should not create another distinct Purchase. 5. **Test consent behavior:** Confirm that tracking follows the customer’s consent or opt-out state. Don’t treat a successful event in a consent-granted test as proof that events should also be sent when consent is absent. 6. **Reconcile before increasing spend:** Compare a defined period of Shopify orders with Meta-received Purchase events, investigate duplicates and missing events, and check Meta diagnostics. Exact counts may differ because of consent choices, browser limits, and platform reporting/attribution behavior; tracking validation is not a promise of attribution recovery. ## 7. Consent and compliance note Disclose Meta data sharing in the privacy policy, configure Shopify’s customer privacy/consent settings and any consent-management platform to reflect the store’s actual choices, and honor applicable opt-outs. Shopify notes that server pixels remain subject to customer privacy and consent settings; server-side delivery is **not** a way around them. Review applicable requirements for each market Cedar & Coil serves with qualified privacy counsel. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs))
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 CAPI helps when ad blockers or browser privacy features limit Pixel data.
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 includes 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 includes event_name "Purchase", event_time, event_id, action_source "website" and a user_data block.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Step 3 uses the Events Manager Test Events view and checks matching event IDs on overlapping events, and step 4 checks that reloading the confirmation page creates no extra Purchase; the explicit browser/server dedup check is somewhat soft but present.
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).
✗Browser vs server firing is only loosely described ("a common starting point is browser events for storefront activity and a server Purchase event"), and there is no per-event table of where each fires or what the source of truth is.
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 CAPI does not bypass consent or guarantee attribution, gives no recovery percentages, and the compliance section notes regional rules and counsel.
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 the same event name plus the same event_id, sent as Pixel eventID and CAPI event_id, with a matching 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 event_id is derived deterministically as `purchase-${canonicalOrderId(order.id)}` and shared with the browser; the guide warns against random IDs, though it does not explicitly mention 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 uses Math.floor(Date.parse(order.processed_at)/1000), the order occurrence time in Unix seconds, so it is stable across retries.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓Email is trimmed, lowercased and SHA-256 hashed in the code and text, and the guide says not to hash IP, user agent, fbp or fbc.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓It decisively recommends the native Facebook & Instagram channel at Maximum data sharing, with concrete numbered steps and the conditions under which custom CAPI makes sense.
✗ Attempt 2
Answer · attempt 2 the model's full response$0.010 · 99.5s · 8.6k tok
# Cedar & Coil: Shopify-to-Meta Conversion Tracking Guide Use the Shopify integration for the initial setup; don’t run a separate custom CAPI sender alongside it. This guide is for tracking implementation only—no campaign or performance data is assumed. ## 1. Recommended architecture: Pixel + Conversions API Use **both**: - **Meta Pixel (browser):** sends storefront activity such as product views and cart actions. - **Meta Conversions API (CAPI, server):** sends eligible events—especially completed purchases—from Shopify’s server to Meta. The browser Pixel is useful for observing the shopping journey, but browser privacy features can limit cookies or block Pixel requests. CAPI avoids relying on the customer’s browser to transmit the server event; it can therefore provide a more resilient delivery path, though it cannot guarantee attribution or recover every lost signal. CAPI is still subject to Shopify privacy and consent settings. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels)) When the same action is sent by both methods, deduplicate it as described in section 3. ## 2. Standard events and parameters Use Meta’s exact event names and keep parameter definitions consistent between browser and server. For catalog matching, `content_ids` must match the IDs used in the connected Meta catalog—verify the actual synced ID format rather than assuming it is the SKU or Shopify product ID. Meta documents `value`, `currency`, `content_type`, `content_ids`, and item details as event parameters; `value` and `currency` are required for Purchase. ([developers.facebook.com](https://developers.facebook.com/docs/facebook-business-extension/fbe/guides/pixel-events?utm_source=openai)) | Event | Trigger | Recommended parameters | |---|---|---| | **ViewContent** | Customer views the Arc Clip Lamp product page. | `content_ids`: matching catalog product/variant ID; `content_type: "product"`; `value: 68.00` for the displayed product price; `currency: "USD"`. Use the selected variant’s price if applicable. | | **AddToCart** | Customer adds the lamp to cart. | `content_ids`; `content_type: "product"`; `value`: price × quantity added; `currency: "USD"`; `contents`: item ID, quantity, and item price. | | **InitiateCheckout** | Customer begins checkout. | `content_ids` for items in the cart; `content_type: "product"`; `value`: checkout cart value; `currency: "USD"`; `contents` and optionally `num_items`. | | **Purchase** | A completed, paid order—not just a thank-you-page load. | `value`: final order amount according to one documented revenue convention; `currency: "USD"`; **`content_ids`** for the products purchased; `content_type: "product"`; `contents` with item IDs and quantities; `order_id`. | For Purchase, settle on one value convention—such as the final amount charged, including discounts, shipping, and tax—and use it consistently in both event sources and when reconciling against Shopify. For a single Arc Clip Lamp at the supplied $68 price, the product price is $68 before any order-level adjustments. ## 3. Exactly how deduplication works For each *same* customer action sent through both Pixel and CAPI: 1. Send the **same unique event ID** with both events. 2. Use the **same event name** and send both to the same Meta Pixel/dataset. 3. In the browser Pixel call, the ID is `eventID` in the fourth argument; in CAPI, it is `event_id`. 4. Meta matches the `eventID`/`event` pair with the CAPI `event_id`/`event_name` pair. Meta documents a 48-hour deduplication window for matching IDs and names; when the events are otherwise equivalent, Meta generally prefers the one received first. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) Example browser event: ```javascript fbq( 'track', 'Purchase', { value: 68.00, currency: 'USD', content_ids: ['CATALOG_ITEM_ID'] }, { eventID: 'purchase_ORDER_KEY' } ); ``` The server event must use `event_name: "Purchase"` and `event_id: "purchase_ORDER_KEY"`. Generate a stable ID for each purchase, and make sure the browser and server can use the **exact same** ID. A retry of the Shopify webhook must not create a second server Purchase: Meta’s browser/server deduplication is not a substitute for your own idempotency control. Use a durable outbox or sent-event record keyed by order and event type. Don’t reuse one ID for multiple actions. If you use Shopify’s native integration, avoid adding a separate custom Pixel or CAPI Purchase sender on top of it. Validate the native pairing in Events Manager rather than assuming a second implementation will deduplicate correctly. ## 4. Prepare customer information before server-side sending Normalize and hash customer identifiers **server-side** before placing them in `user_data`: - **Email:** trim whitespace and lowercase, then SHA-256. - **Phone:** normalize to an international format using reliable country context, then SHA-256. - **Name, city, state, postal code, country, and other supported match fields:** apply Meta’s field-specific normalization, then SHA-256 when required. - **External ID:** hash is recommended by Meta. Meta says SHA-256 hashing is required for fields such as email, phone, name, and address fields. Do **not** hash `client_ip_address`, `client_user_agent`, `fbp`, or `fbc`. Include `fbp`/`fbc` only when actually available; do not fabricate them. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/)) Use only information the customer provided or that was lawfully collected, and only when your consent/privacy rules allow it. Hashing does **not** make customer data anonymous. Don’t log raw identifiers, access tokens, or full event payloads. ## 5. Shopify setup path and implementation choice ### Recommended for a small DTC store: Shopify’s Facebook & Instagram by Meta channel For Cedar & Coil, the native channel is the practical starting point: it connects Shopify’s storefront and checkout surfaces without requiring the store to maintain a custom webhook-to-CAPI service. Shopify’s current documentation directs merchants to install and set up the **Facebook & Instagram by Meta** sales channel. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup)) Setup: 1. In Shopify admin, go to **Settings → Sales channels → Shopify App Store** and add **Facebook & Instagram by Meta**. 2. Select **Start set up** and connect the correct Meta business assets: business portfolio, Page, ad account, Pixel/dataset, and catalog as prompted. 3. In the channel’s **Settings → Share data settings** (labels may vary), enable data sharing and select the Pixel. 4. Choose **Enhanced** as a straightforward Pixel-plus-CAPI starting point. Shopify describes Standard as Pixel-only; Enhanced and Maximum use both Pixel and CAPI. Consider Maximum only after reviewing its additional data-sharing implications and fit with your privacy choices. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs&utm_source=openai)) 5. Confirm the Arc Clip Lamp product is synced to the connected catalog, then record the exact catalog item ID to use for `content_ids`. 6. Audit and remove old manual Meta Pixel snippets, theme code, checkout scripts, or other Meta tracking apps that would send overlapping events. Shopify specifically warns that a second Pixel can cause duplicate or incorrect reporting. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) ### Native channel vs. custom implementation | Option | Trade-off | |---|---| | **Native channel** | Less code and operational burden; appropriate for a small Shopify DTC store. You have less control over event plumbing, so validate the actual events and deduplication. | | **Custom Shopify pixel + webhook/CAPI service** | More control over event payloads, IDs, retries, and server logic, but requires a secure backend, consent enforcement, catalog-ID mapping, monitoring, and maintenance. Shopify’s supported web-pixel approach uses customer-event APIs and privacy controls rather than relying on arbitrary theme scraping. ([shopify.dev](https://shopify.dev/docs/apps/build/marketing/pixels)) | **Recommendation:** Start with the native channel. Move to custom only if you have a concrete requirement the native setup cannot meet, and then replace—not stack on top of—the native sender for the events you take over. ### Illustrative custom server-side Purchase request This is a **custom-build sketch**, not code to run alongside the native sender. It assumes a paid-order handler has already checked consent, mapped catalog IDs, obtained eligible browser context, and prevented duplicate webhook processing. The browser Purchase must use the same `sharedEventId`. ```javascript import crypto from "node:crypto"; const sha256 = (value) => crypto.createHash("sha256").update(value, "utf8").digest("hex"); async function sendPurchaseToMeta({ order, context, sharedEventId }) { // Hash normalized values. context must contain only consent-eligible data. const email = order.email?.trim().toLowerCase(); const user_data = { ...(email ? { em: sha256(email) } : {}), ...(context.phoneE164 ? { ph: sha256(context.phoneE164.replace(/\D/g, "")) } : {}), ...(context.clientIp ? { client_ip_address: context.clientIp } : {}), ...(context.userAgent ? { client_user_agent: context.userAgent } : {}), ...(context.fbp ? { fbp: context.fbp } : {}), ...(context.fbc ? { fbc: context.fbc } : {}), }; const event = { event_name: "Purchase", event_time: Math.floor(new Date(order.paidAt).getTime() / 1000), event_id: sharedEventId, // Same value as Pixel eventID action_source: "website", event_source_url: "https://cedarcoil.com/checkout", // Use an accurate, sanitized URL user_data, custom_data: { value: Number(order.finalAmount), currency: order.currency, // e.g. "USD" content_type: "product", content_ids: order.items.map((item) => item.metaCatalogId), contents: order.items.map((item) => ({ id: item.metaCatalogId, quantity: item.quantity, item_price: Number(item.unitPrice), })), order_id: String(order.id), }, }; const url = new URL( `https://graph.facebook.com/${process.env.META_API_VERSION}/${process.env.META_PIXEL_ID}/events` ); url.searchParams.set("access_token", process.env.META_CAPI_TOKEN); const body = { data: [event] }; if (process.env.META_TEST_EVENT_CODE) { body.test_event_code = process.env.META_TEST_EVENT_CODE; } const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body), }); if (!response.ok) { throw new Error(`Meta CAPI returned HTTP ${response.status}`); } return response.json(); } ``` Keep the token in server-side secret storage, pin `META_API_VERSION` to a currently supported version, and do not log the request body. For webhook retries, use an idempotent order/event record. For the browser counterpart in a custom setup, send the same ID: ```javascript fbq('track', 'Purchase', purchaseParams, { eventID: sharedEventId }); ``` ## 6. Validate end to end before scaling spend 1. **Check Shopify first:** In Shopify admin, use **Settings → Customer events** and the Shopify Pixel Helper to test the app pixel. Shopify documents testing events in real time and placing a test order to test the thank-you page. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels)) 2. **Exercise the funnel:** View the product page, add the lamp to cart, begin checkout, and complete a test order using an appropriate Shopify test-payment flow. 3. **Check Meta Events Manager → Test Events:** Confirm the expected event names, source, values, currency, and product IDs. For a dual-sent event, confirm the browser/server pair is received and deduplicated; for custom CAPI testing, use a test event code and remove it from production configuration. 4. **Inspect Purchase carefully:** Confirm it fires only for a paid order; its value and currency match your documented convention; `content_ids` match the catalog; and refreshes, webhook retries, or returning to the thank-you page do not create another Purchase. 5. **Test consent paths:** Test once with marketing/data-sharing permission and once with permission denied or opted out. Confirm both browser and server paths honor the store’s privacy configuration. 6. **Review diagnostics and reconcile:** Fix missing parameters, rejected events, duplicates, or ID mismatches before increasing spend. Reconcile Shopify orders against received server Purchases over the same period, but don’t expect Meta-attributed conversions to equal Shopify orders—attribution and consent coverage differ. ## 7. Consent and compliance note CAPI is **not** a way around a customer’s privacy choice. Shopify says server pixels remain subject to the store’s privacy and consent settings; its Customer Privacy API evaluates applicable settings, location, and consent, and cautions that collecting without consent may not comply with applicable laws. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels)) Configure Shopify’s customer privacy settings and consent banner/CMP to reflect the jurisdictions you serve. Enforce the resulting permission server-side before sending events or identifiers, honor opt-outs and applicable signals, explain Meta data sharing in the privacy notice, and minimize retained data. Get jurisdiction-specific legal advice where needed.
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, explains that browser privacy features can limit cookies or block Pixel requests, and says CAPI is a more resilient path; section 3 covers deduplication.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase lists value, currency 'USD' 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: sharedEventId, 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 step 3 uses Events Manager Test Events and says to confirm the browser/server pair is received and deduplicated, with a test event code for custom CAPI testing.
sources_defined
For each event it is clear where it fires (browser vs server) and what the source of truth is (e.g. Purchase from the Shopify order webhook/server, not only the thank-you page).
✗The table gives triggers but no per-event browser vs server assignment; section 1 only says Pixel handles views and cart actions and CAPI handles 'especially' purchases, so InitiateCheckout's source is unclear, though Purchase is tied to a paid order.
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 CAPI 'cannot guarantee attribution or recover every lost signal', gives no recovery percentages, and section 7 says CAPI is not a way around consent and regional rules.
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 the same event name plus the same ID ('eventID' in the Pixel call, 'event_id' in CAPI), gives matching browser and server examples with 'purchase_ORDER_KEY', and notes the 48-hour window.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓It says to 'Generate a stable ID for each purchase' shared by browser and server (example 'purchase_ORDER_KEY'), keyed by order, with an idempotent outbox so webhook retries don't create a second Purchase.
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.paidAt).getTime()/1000), the order's paid timestamp in Unix seconds rather than the send time, so it is the same on any 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.
✓Email is trimmed, lowercased and SHA-256 hashed in both the text and code, phone is normalized and hashed, and client_ip, user agent, fbp and fbc are left unhashed as Meta specifies.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓It decisively recommends the native Facebook & Instagram by Meta channel with numbered setup steps (choose Enhanced, sync the catalog, remove duplicate pixels) and says when to move to a custom build.
✗ Attempt 3
Answer · attempt 3 the model's full response$0.015 · 158.3s · 11.9k tok
# Cedar & Coil Meta conversion-tracking implementation guide **Scope:** Tracking setup for the Arc Clip Lamp, currently priced at **$68 USD**. This guide is implementation-only: campaigns remain draft-only, and there is no performance history to use as a baseline. No attribution-recovery percentage is promised. ## 1. Recommended architecture: Pixel + Conversions API Use the **Meta Pixel in the browser** together with **Meta Conversions API (CAPI) from the server**, connected to the same Meta data source. Meta describes this as a redundant setup and recommends deduplication for events sent through both paths. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) - **Browser Pixel:** Sends storefront activity, such as product views and cart actions. It can capture browser context, but browser-based ad blockers can prevent it from sending events. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) - **Server-side CAPI:** Sends events directly from Shopify or your backend to Meta. Shopify says its CAPI connection sends purchase events server-to-server, which aren’t blocked by browser ad blockers. This improves delivery resilience; it does **not** guarantee Meta can identify or attribute every purchase. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) **Small-store default:** Start with Shopify’s native Meta sales channel. Let it manage the supported Pixel and CAPI events; don’t add a second Pixel or CAPI sender on top. Shopify documents browser Pixel events for product views, cart additions, checkout initiation, and purchases; its Enhanced and Maximum data-sharing settings add CAPI, including server-side purchase events. Confirm the actual event sources in Events Manager after setup. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) ## 2. Standard events and parameters Use Meta’s standard event names with the capitalization shown. Fire events on the action—not on every page load. For catalog use, the product IDs in events must match the IDs Meta receives in the catalog; Shopify’s native integration can manage that mapping. Meta documents `contents` entries with product ID and quantity, and requires a specific product ID for `ViewContent` catalog use. ([developers.facebook.com](https://developers.facebook.com/docs/facebook-business-extension/fbe/guides/pixel-events)) | Event | Trigger | Key parameters | |---|---|---| | **ViewContent** | Arc Clip Lamp product page viewed | `content_ids`: catalog-matching product or variant ID; `content_type`: `product` or `product_group`; `value`: displayed item price (for example, `68.00`); `currency`: ISO code such as `USD`. Add `contents: [{id, quantity, item_price}]` where available. | | **AddToCart** | Item successfully added to cart | `content_ids`: IDs of added items; `contents`: one object per item, with ID, quantity, and unit price; `value`: value of the items added; `currency`: cart currency. | | **InitiateCheckout** | Checkout actually begins | `content_ids` and `contents` for cart items; `value`: checkout value using the store’s defined value convention; `currency`; `num_items`. | | **Purchase** | A completed order, sent once per order | **Required:** `value` and `currency`. Include **`content_ids`** for purchased catalog items, plus `contents` with each item’s ID, quantity, and item price. Also send `content_type`, `num_items`, and an order/transaction identifier where supported. | Meta documents `value` as a numeric amount and `currency` as a three-letter ISO currency; its event guidance describes `value` for Purchase as the value of items purchased. ([developers.facebook.com](https://developers.facebook.com/docs/facebook-business-extension/fbe/guides/pixel-events)) **Choose and document a value convention.** For example, a custom implementation might send merchandise value after discounts and exclude shipping and tax, while Shopify’s documentation says its order-value events use the checkout order total, including duties, taxes, and discounts. Don’t assume these bases are identical: inspect the received event and reconcile against Shopify using the same convention. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) ## 3. Exactly how deduplication works When the same customer action is sent by both Pixel and CAPI, send: 1. The **same event name** on both sides: Pixel `event` must equal CAPI `event_name`—for example, `Purchase`. 2. The **same unique event ID**: Pixel’s `eventID` must exactly equal CAPI’s `event_id`. 3. Both copies to the **same Meta data source**. Meta uses the event name and ID to identify matching events, and documents a 48-hour deduplication window. It generally prefers the event received first. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) For a custom Purchase flow, use a stable, order-specific ID such as `shopify_purchase_<canonical_order_id>` on both sides. The browser and server must generate the *same string*; normalize Shopify’s order ID representation if one side has a numeric ID and the other a GraphQL ID. For non-purchase events, use a unique ID for each action occurrence—don’t reuse one ID across a person’s different AddToCart events. The Pixel call’s deduplication ID is in its options argument: ```javascript fbq('track', 'Purchase', purchaseData, { eventID: eventId }); ``` The matching CAPI field is `event_id`. Don’t rely on `fbp` or `external_id` instead of shared event IDs: Meta documents that alternate method as more limited, including when the server event arrives before the browser event. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) **Important:** Deduplication is not a substitute for preventing repeated server sends. Meta’s documented Pixel/CAPI deduplication is for matching cross-source events; implement order-level idempotency so webhook retries or repeated confirmation-page loads don’t emit multiple server Purchases. ## 4. Prepare customer information before sending CAPI Normalize customer identifiers **before** hashing them with SHA-256. Meta marks email, phone, names, and location fields as requiring hashing; `external_id` hashing is recommended. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/)) - **Email:** Trim surrounding whitespace and lowercase, then SHA-256. - **Phone:** Normalize to an international number with country code, then hash. Use a maintained normalization library rather than guessing based on local phone formats. - **Other fields:** Normalize and hash only fields you legitimately collected and need, such as first/last name, city, state/region, postal code, country, or external ID. - **Do not hash:** `fbp`, `fbc`, client IP address, and client user agent. Send these un-hashed when available and permitted. Capture `fbc` from the Meta click context and `fbp` from the browser context; don’t invent either value. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/)) - Include the web-event fields Meta requires: `action_source: "website"`, `event_source_url`, and `client_user_agent`. Use the visitor’s actual client IP if available—not the IP of Shopify’s webhook request. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/)) Hashing is not anonymization. Keep identifiers out of `custom_data`, application logs, and debugging output; transmit only the fields needed for the event and matching. ## 5. Shopify setup path: native channel vs. custom implementation ### Recommended for Cedar & Coil: native Meta channel For a small DTC store, use the **Facebook & Instagram by Meta** sales channel first. It is the simpler path for connecting Shopify, the Meta assets, the Pixel, and Shopify’s supported data-sharing integration. Shopify documents the channel as available without an extra channel fee, subject to eligibility. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta?utm_source=openai)) 1. In Shopify Admin, go to **Settings → Sales channels → Shopify App Store**; search for Facebook/Meta and add the channel. 2. Open **Facebook & Instagram**, start setup, and connect the appropriate Meta business assets and ad account. 3. Go to **Facebook & Instagram → Settings → Data sharing settings**. 4. Enable customer data sharing and connect the correct Pixel/data source. 5. Choose **Enhanced** as a starting point for Pixel plus CAPI. Consider **Maximum** only if its additional data-sharing and advertising features fit your privacy choices and business needs. Shopify says both Enhanced and Maximum use Pixel and CAPI, and both share customer information for matching. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) 6. Remove any old hard-coded Meta Pixel or duplicate Meta integration. Shopify specifically warns that an earlier theme-installed Pixel can cause duplicate or incorrect reporting. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) ### When to build custom A custom setup can provide more control over event mapping, server delivery, and operational logging, but requires a Shopify app/web-pixel implementation, backend hosting, protected customer-data access, consent handling, webhook verification, secure token management, retries, and ongoing maintenance. Shopify describes custom pixels as an advanced feature and notes that their compliance and troubleshooting are the merchant’s responsibility. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/testing?utm_source=openai)) If building custom, a common design is a Shopify web pixel for browser events plus a backend order-paid webhook for server Purchase. For deduplication, the browser `checkout_completed` event and server order event must use the same canonical order ID. Shopify documents that `checkout_completed` includes the resulting order ID, but the browser event can fail to fire if its page fails to load—one reason to have a server event path. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) **Do not run the native app and a custom sender for the same events unless you intentionally coordinate and validate both.** Otherwise, they can create extra events with mismatched IDs. ### Server-side Purchase request sketch This is an illustrative Node.js sketch, **not** a complete Shopify app. It assumes `order`, its consent decision, and visitor context were safely obtained and persisted by your implementation. Keep the Meta access token server-side in a secret manager. Use the current Graph API version supported by your integration, and set `value` and product IDs from the Shopify order and the matching Meta catalog. ```js import { createHash } from "node:crypto"; const sha256 = (value) => createHash("sha256").update(value, "utf8").digest("hex"); const hashEmail = (email) => email ? sha256(email.trim().toLowerCase()) : undefined; export async function sendPurchase(order, visitor, consent) { // Apply your jurisdiction/store consent policy before sending. if (!consent.metaMarketingAllowed) return; // Must match the ID used by the browser Pixel Purchase event. const eventId = `shopify_purchase_${order.canonicalId}`; // Prevent duplicate sends when Shopify retries the webhook. // Implement this with a durable order/event outbox in production. if (await alreadySent(eventId)) return; const event = { event_name: "Purchase", event_time: Math.floor(new Date(order.paidAt).getTime() / 1000), event_id: eventId, action_source: "website", // Persist a suitable, sanitized conversion-page URL; don't expose // private order-status tokens or sensitive query parameters. event_source_url: visitor.sanitizedConversionUrl, user_data: { em: hashEmail(order.email), // Optional, if available and permitted: fbp: visitor.fbp, // un-hashed fbc: visitor.fbc, // un-hashed client_ip_address: visitor.clientIp, // un-hashed client_user_agent: visitor.userAgent // un-hashed }, custom_data: { value: Number(order.purchaseValue), currency: order.currencyCode, // e.g. "USD" content_type: "product", content_ids: order.items.map(i => i.metaCatalogContentId), contents: order.items.map(i => ({ id: i.metaCatalogContentId, quantity: i.quantity, item_price: Number(i.unitPrice) })), num_items: order.items.reduce((sum, i) => sum + i.quantity, 0), order_id: String(order.canonicalId) } }; const body = { data: [event] }; // Add only during validation; remove for production sends. if (process.env.META_TEST_EVENT_CODE) { body.test_event_code = process.env.META_TEST_EVENT_CODE; } const response = await fetch( `https://graph.facebook.com/${process.env.META_GRAPH_API_VERSION}/` + `${process.env.META_PIXEL_ID}/events?access_token=` + `${encodeURIComponent(process.env.META_CAPI_TOKEN)}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) } ); if (!response.ok) { throw new Error(`Meta CAPI returned ${response.status}`); } await markSent(eventId); } ``` The request structure follows Meta’s event fields; Meta requires `client_user_agent`, `action_source`, and `event_source_url` for website events. In production, handle webhook verification, durable idempotency, safe retries, consent, and redacted logs around this sketch. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/)) ## 6. Validate end to end before scaling spend Use **Events Manager → Test Events** and, if using a custom pixel, **Shopify Admin → Settings → Customer events → pixel → Test**. Shopify’s Pixel Helper can show whether a custom pixel subscribed to events and whether its callbacks succeeded. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/testing?utm_source=openai)) Run a controlled test in this order: 1. **ViewContent:** Open the Arc Clip Lamp product page. Confirm the event name, item ID, value, and currency. 2. **AddToCart:** Add one lamp. Confirm it fires once, only after the cart is updated, with the right ID, quantity, and value. 3. **InitiateCheckout:** Start checkout. Confirm it fires once and represents the current cart. 4. **Purchase:** Place a test order. Confirm the Purchase is received from the expected sources and has the correct value, currency, `content_ids`, quantities, and order ID. 5. **Deduplication:** For events sent by both sources, inspect the Test Events/deduplication view. Confirm matching event names and IDs; a Purchase should not be counted twice. 6. **Repeat and failure cases:** Reload the confirmation page, simulate webhook retries, and test with browser tracking blocked. Check that repeated server sends are suppressed and that a valid server Purchase can still arrive when the browser event is blocked. 7. **Consent cases:** Test both accepted and declined consent under your configured Shopify privacy settings. Verify that your banner/CMP choice is reflected in the Pixel and your server-send decision. Before launch, reconcile test orders with the event payload using the same value convention. Review Events Manager diagnostics for missing parameters, wrong IDs, unexpected duplicate events, or events going to the wrong data source. Keep the test event code out of production. Shopify notes that its Pixel Helper may report that a pixel is awaiting consent; use that behavior to verify consent gating rather than bypassing it. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/testing?utm_source=openai)) ## 7. Consent and compliance note CAPI is **not** a way around consent or privacy choices. Configure Shopify’s customer privacy settings and any third-party CMP so marketing consent and applicable opt-outs are honored by both browser and server paths. Shopify’s Customer Privacy API is designed to apply consent decisions to Shopify-managed surfaces, including pixels, and Shopify advises that privacy settings and disclosures reflect the store’s actual data practices. ([shopify.dev](https://shopify.dev/docs/api/customer-privacy?utm_source=openai)) Keep Cedar & Coil’s privacy policy accurate about what is shared with Meta, minimize the data sent, honor deletion/opt-out requests as applicable, and have counsel review requirements for the regions where the store sells. Hashing identifiers does not make them anonymous.
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 with deduplication and explains that browser ad blockers can stop Pixel events while server-to-server sends are not blocked.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase lists value, currency and content_ids.
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_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 6 uses Events Manager Test Events and step 5 explicitly checks matching event names and IDs so a Purchase is not counted twice.
sources_defined
For each event it is clear where it fires (browser vs server) and what the source of truth is (e.g. Purchase from the Shopify order webhook/server, not only the thank-you page).
✗The Purchase source is clear (order-paid webhook plus browser checkout_completed), but the section 2 table gives only a trigger per event with no browser-versus-server source, and nothing says whether AddToCart, ViewContent or InitiateCheckout go 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 says no attribution-recovery percentage is promised, that CAPI "does not guarantee Meta can identify or attribute every purchase", and that CAPI is not a way around consent.
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 event name and the same ID on both sides (Pixel eventID equals CAPI event_id) to the same data source, with the fbq call shown and the 48-hour window noted.
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_purchase_<canonical_order_id>` shared by browser and server, and the sketch checks alreadySent so webhook retries reuse it.
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(new Date(order.paidAt).getTime() / 1000)`, which is the order's paid timestamp in Unix seconds rather than the send time, so it stays the same 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.
✓Section 4 says to trim and lowercase email and SHA-256 hash it, and the code does this via hashEmail, with fbp, fbc, IP and user agent left unhashed.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓It recommends the native Meta channel for a small store with numbered Shopify Admin steps (add channel, data sharing settings, Enhanced, remove old Pixel) and says when to build custom.