← Run 20260831-212036-e234131f
Shopify to Meta ads conversion tracking implementation
task shopify-meta-capiAug 31, 2026skill analytics

Answers & verdicts

GPT-5.6 Sol 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." metadata: version: 2.0.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 --- ## 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
Answer the model's full response$0.87 · 170.2s · 12.7k tok
# Cedar & Coil: Shopify-to-Meta Conversion Tracking Guide **Status:** Draft implementation guide **Reviewed:** August 31, 2026 **Store:** Shopify **Primary product:** Arc Clip Lamp, listed at **$68** ## 1. Recommended architecture Use two delivery paths tied to the same Meta dataset/pixel: 1. **Browser-side Meta Pixel** - Runs through Shopify’s customer-events system. - Captures immediate storefront interactions and browser context. - Sends `ViewContent`, `AddToCart`, `InitiateCheckout`, and a browser copy of `Purchase`. 2. **Server-side Meta Conversions API, or CAPI** - Sends events from Shopify or an application server directly to Meta. - At minimum, send `Purchase` from a confirmed paid-order signal. - For a more advanced custom implementation, also send server copies of upper-funnel events. 3. **Deduplication** - When the same action is sent through both paths, the browser and server events must share the same `event_name` and `event_id`. - This lets Meta treat the two transmissions as one conversion rather than two. ### Why both paths are needed The browser Pixel supplies useful browser context, including the page URL, `_fbp`, `_fbc`, user agent, and immediate interaction timing. However, browsers, content blockers, navigation failures, and privacy controls can prevent browser events from being delivered. CAPI provides a second, server-originated path. Shopify’s documentation specifically notes that its server-to-server Purchase transmission is not blocked by browser-based ad blockers. CAPI is not, however, permission to disregard consent choices. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) **Recommended source-of-truth rule:** - Browser events describe user interactions. - A **paid Shopify order** is the source of truth for a server-side `Purchase`. - Browser and server copies are deduplicated in Meta. - Shopify remains the financial system of record for revenue. --- ## 2. Standard events and parameters Shopify exposes corresponding standard customer events for product views, additions to cart, checkout starts, and checkout completions. Shopify’s native Meta integration automatically maps the same core funnel actions. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) | Meta event | Shopify trigger | Key parameters | |---|---|---| | **ViewContent** | `product_viewed` | `content_ids`, `content_type`, `content_name`, `value`, `currency`, optionally `contents` | | **AddToCart** | `product_added_to_cart` | `content_ids`, `content_type`, `value`, `currency`, `contents` | | **InitiateCheckout** | `checkout_started` | `content_ids`, `content_type`, `value`, `currency`, `contents`, `num_items` | | **Purchase** | Browser: `checkout_completed`; Server: paid-order event such as `orders/paid` | **`value`, `currency`, `content_ids`**, `content_type`, `contents`, `order_id`, optionally `num_items` | Meta’s standard commerce parameters include `value`, an ISO 4217 currency code, arrays of `content_ids`, item-level `contents`, `content_type`, and `order_id`. ([github.com](https://github.com/facebookincubator/Facebook-Server-Side-API-Swagger/blob/main/server-side-api.yaml)) ### ViewContent Send when the Arc Clip Lamp product detail page is viewed. ```json { "content_ids": ["SHOPIFY_VARIANT_ID"], "content_type": "product", "content_name": "Arc Clip Lamp", "value": 68.00, "currency": "USD" } ``` Use the actual displayed price and presentment currency. If a discount or regional price changes the displayed amount, send that amount rather than hard-coding `$68`. ### AddToCart Send only after Shopify confirms that the item was added—not merely when the button was clicked. ```json { "content_ids": ["SHOPIFY_VARIANT_ID"], "content_type": "product", "value": 136.00, "currency": "USD", "contents": [ { "id": "SHOPIFY_VARIANT_ID", "quantity": 2, "item_price": 68.00 } ] } ``` `value` should represent the value added in that action: item price multiplied by quantity. ### InitiateCheckout Send when Shopify’s `checkout_started` event fires. ```json { "content_ids": ["SHOPIFY_VARIANT_ID"], "content_type": "product", "value": 136.00, "currency": "USD", "num_items": 2, "contents": [ { "id": "SHOPIFY_VARIANT_ID", "quantity": 2, "item_price": 68.00 } ] } ``` Use the current checkout value and all products entering checkout. ### Purchase Send only for a successfully completed purchase. In a custom implementation, use Shopify’s paid-order webhook rather than `orders/create`, because an order can exist without successful payment. ```json { "content_ids": ["SHOPIFY_VARIANT_ID"], "content_type": "product", "value": 74.12, "currency": "USD", "order_id": "SHOPIFY_ORDER_ID", "contents": [ { "id": "SHOPIFY_VARIANT_ID", "quantity": 1, "item_price": 68.00 } ] } ``` For `value`, use one documented definition consistently. For alignment with Shopify’s native Meta integration, use the final order total. Shopify states that its value-based Meta events use the order total, incorporating items, duties, taxes, and discounts. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) ### Content-ID rule Every `content_ids[].id` must use the same identifier format as Meta’s product catalog: - If the catalog uses Shopify variant IDs, send variant IDs. - If it uses SKUs, send SKUs. - Do not send a product ID in one event and a variant ID or SKU in another. For Cedar & Coil, **Shopify variant ID as a string** is the safest custom default, provided the catalog feed uses that same value. The native Meta sales channel should manage this mapping automatically. --- ## 3. Exactly how deduplication works For one customer action, Meta compares: - Browser `eventID` - Server `event_id` - Browser and server `event_name` - The destination dataset/pixel Meta’s official API schema documents matching browser and server events by the same `event_name` and `event_id`. It also documents a 48-hour matching window; when matching copies arrive close together, Meta favors the browser version. ([github.com](https://github.com/facebookincubator/Facebook-Server-Side-API-Swagger/blob/main/server-side-api.yaml)) ### Example: Purchase Generate a stable ID from the Shopify order: ```text purchase:820982911946154508 ``` Send the browser event as: ```javascript fbq( "track", "Purchase", { value: 74.12, currency: "USD", content_ids: ["SHOPIFY_VARIANT_ID"], content_type: "product" }, { eventID: "purchase:820982911946154508" } ); ``` Send the server event with: ```json { "event_name": "Purchase", "event_id": "purchase:820982911946154508" } ``` ### Requirements 1. `Purchase` must have exactly the same spelling and capitalization on both paths. 2. `eventID` in the browser must equal `event_id` on the server, character for character. 3. Both copies must go to the same Meta dataset/pixel. 4. The event ID must identify the action, not merely the user or session. 5. CAPI retries must reuse the original event ID. 6. Different legitimate purchases must have different event IDs. `order_id` inside `custom_data` is useful business information, but it is **not a replacement for `event_id`**. ### Recommended event-ID scheme | Event | Event-ID source | |---|---| | ViewContent | `viewcontent:<Shopify customer-event ID>` | | AddToCart | `addtocart:<Shopify customer-event ID>` | | InitiateCheckout | `checkout:<Shopify customer-event ID>` | | Purchase | `purchase:<Shopify order ID>` | Shopify supplies an ID on customer events, and `checkout_completed` includes the completed checkout data. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) --- ## 4. Preparing customer information for CAPI Place matching identifiers in `user_data`, not `custom_data`. ### Fields that must be normalized and SHA-256 hashed | CAPI field | Preparation before hashing | |---|---| | `em` | Trim whitespace and lowercase the email | | `ph` | Convert to digits-only international format with country code | | `fn` | Trim and lowercase first name | | `ln` | Trim and lowercase last name | | `ct` | Lowercase city; remove spaces and punctuation | | `st` | Lowercase standardized state or province code | | `zp` | Standardize postal code; use five digits for a US ZIP when available | | `country` | Lowercase two-letter country code, such as `us` | | `external_id` | Use a stable Shopify customer ID and hash it consistently | Meta’s parameter specification describes these normalization and hashing requirements. ([github.com](https://github.com/facebookincubator/Facebook-Server-Side-API-Swagger/blob/main/server-side-api.yaml)) ### Fields that must not be hashed Send these in their original formats: - `client_ip_address` - `client_user_agent` - `fbp`, from the `_fbp` cookie - `fbc`, from the `_fbc` cookie or a valid Meta click identifier ### Implementation rules - Normalize first, then hash with SHA-256. - Hash exactly once. - Omit missing values instead of hashing an empty string, `null`, or `undefined`. - Never place raw customer information in event logs, query strings, `custom_data`, or client-visible responses. - Keep the CAPI access token exclusively on the server. - Use a mature phone-number parser to create international phone digits rather than assuming every number is from the United States. Meta’s current Node Business SDK can normalize and hash customer identifiers automatically; it can also derive browser-context parameters from an incoming request when configured to do so. ([github.com](https://github.com/facebook/facebook-nodejs-business-sdk/blob/main/README.md?utm_source=openai)) --- ## 5. Concrete Shopify setup path ### Option A: Native Facebook & Instagram by Meta sales channel #### Setup steps 1. In Shopify, open **Sales channels**. 2. Install or open **Facebook & Instagram**. 3. Connect the correct: - Meta Business Portfolio - Facebook Page - Ad account - Product catalog - Meta dataset/pixel 4. Go to: - **Sales channels** - **Facebook & Instagram** - **Settings** - **Data sharing settings** 5. Activate customer data sharing. 6. Select **Maximum**, provided Cedar & Coil’s consent implementation and privacy disclosures support that data use. 7. Connect the intended Meta pixel if one is not already connected. 8. Open **Shopify Settings → Customer events** and confirm that the Meta app pixel is connected. 9. Remove any old theme-installed Meta Pixel, checkout script, GTM Meta tag, or second Meta app using the same dataset unless it is intentionally coordinated. Shopify documents that Maximum uses both the Meta Pixel and Conversions API, while its automatic browser event list includes the standard commerce funnel. Its CAPI documentation explicitly identifies server-to-server Purchase transmission. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) #### Advantages - Lowest implementation and maintenance burden. - No custom CAPI token or webhook infrastructure. - Automatic catalog and content-ID alignment. - Automatic updates as Shopify and Meta change their integrations. - Better integration with Shopify customer privacy settings. #### Limitations - Less control over event IDs, payloads, retry behavior, and logging. - Limited ability to implement custom revenue definitions. - Shopify’s public documentation explicitly describes CAPI Purchase coverage but does not promise server copies of every upper-funnel event. - Troubleshooting details are less transparent than in an owned implementation. ### Recommendation for Cedar & Coil **Use the native Facebook & Instagram by Meta sales channel with Maximum data sharing** for the initial launch, assuming consent and privacy requirements have been addressed. For a small DTC store with one primary product and no prior campaign data, the native integration offers the best balance of reliability, catalog consistency, maintenance cost, and operational risk. Do not add a parallel custom Pixel or CAPI feed merely to have “more tracking.” Move to custom only if Cedar & Coil later needs: - Server-side versions of all funnel events. - An owned event warehouse. - Custom consent logic. - Custom revenue/refund treatment. - Multiple storefronts or datasets. - Detailed retry, observability, or enrichment controls. ### Option B: Custom implementation A robust custom implementation should include: 1. A Shopify web pixel app extension using the Web Pixels API. 2. Subscriptions to: - `product_viewed` - `product_added_to_cart` - `checkout_started` - `checkout_completed` 3. Browser Pixel calls carrying explicit `eventID` values. 4. A first-party event collector for server copies of browser actions. 5. An `orders/paid` webhook for authoritative server-side Purchases. 6. HMAC verification, a persistent queue, retries, and idempotency. 7. Storage that connects checkout/browser attribution to the final order. Shopify web pixels can read top-frame cookies through `browser.cookie`, send data to an application endpoint, and access standard checkout events. Shopify also documents that a browser-side `checkout_completed` event can be missed if its page never loads, which is why a paid-order webhook is the stronger server Purchase trigger. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api?utm_source=openai)) For correlation, store `_fbp`, `_fbc`, user agent, IP, consent state, and event source URL against the Shopify checkout token. Shopify documents that the web-pixel checkout token corresponds to the order’s `checkout_token`. ([shopify.dev](https://shopify.dev/docs/api/checkout-ui-extensions/2026-01/target-apis/checkout-apis/checkout-token-api?utm_source=openai)) Subscribe to `orders/paid`, verify the Shopify HMAC before parsing the request, and process deliveries idempotently using the webhook delivery ID and stable Meta event ID. Shopify notes that webhook deliveries can be repeated. ([shopify.dev](https://shopify.dev/docs/api/webhooks/latest?utm_source=openai)) ### Server-side Purchase request sketch The following is illustrative Node.js code. It assumes the Shopify webhook HMAC has already been verified and the delivery has passed an idempotency check. ```javascript import crypto from "node:crypto"; const META_PIXEL_ID = process.env.META_PIXEL_ID; const META_ACCESS_TOKEN = process.env.META_ACCESS_TOKEN; const META_GRAPH_API_VERSION = process.env.META_GRAPH_API_VERSION; const sha256 = (value) => crypto.createHash("sha256").update(value, "utf8").digest("hex"); const hashed = (value, normalize) => { if (value === null || value === undefined || value === "") { return undefined; } return [sha256(normalize(String(value)))]; }; const compact = (object) => Object.fromEntries( Object.entries(object).filter(([, value]) => value !== undefined) ); const normalizeEmail = (value) => value.trim().toLowerCase(); const normalizeName = (value) => value.trim().toLowerCase(); const normalizeCity = (value) => value.trim().toLowerCase().replace(/[^a-z0-9]/g, ""); const normalizeRegion = (value) => value.trim().toLowerCase(); const normalizeCountry = (value) => value.trim().toLowerCase(); const normalizePostalCode = (value) => value.trim().toLowerCase().replace(/\s+/g, ""); // Implement with a phone-number library. Output digits only, // including international country code; for example 16505551212. function normalizePhoneToInternationalDigits(phone, countryCode) { throw new Error("Implement with a production phone-number parser"); } // This function must produce the same ID used in the Meta catalog. const catalogIdForLineItem = (lineItem) => String(lineItem.variant_id ?? lineItem.product_id); export async function sendMetaPurchase({ order, attribution = {}, eventTime = Math.floor(Date.now() / 1000), testEventCode }) { const address = order.billing_address ?? order.shipping_address ?? {}; const contents = order.line_items.map((lineItem) => ({ id: catalogIdForLineItem(lineItem), quantity: Number(lineItem.quantity), item_price: Number(lineItem.price) })); const contentIds = [...new Set(contents.map((item) => item.id))]; let normalizedPhone; const rawPhone = order.phone ?? address.phone ?? order.customer?.phone; if (rawPhone) { normalizedPhone = normalizePhoneToInternationalDigits( rawPhone, address.country_code ); } const userData = compact({ em: hashed( order.email ?? order.contact_email ?? order.customer?.email, normalizeEmail ), ph: normalizedPhone ? [sha256(normalizedPhone)] : undefined, fn: hashed(address.first_name, normalizeName), ln: hashed(address.last_name, normalizeName), ct: hashed(address.city, normalizeCity), st: hashed(address.province_code, normalizeRegion), zp: hashed(address.zip, normalizePostalCode), country: hashed(address.country_code, normalizeCountry), external_id: hashed(order.customer?.id, (value) => value.trim()), // Do not hash these fields. client_ip_address: attribution.clientIp ?? order.browser_ip ?? undefined, client_user_agent: attribution.userAgent ?? order.client_details?.user_agent ?? undefined, fbp: attribution.fbp, fbc: attribution.fbc }); const event = compact({ event_name: "Purchase", event_time: eventTime, event_id: `purchase:${String(order.id)}`, action_source: "website", event_source_url: attribution.eventSourceUrl, user_data: userData, custom_data: { value: Number(order.total_price), currency: String(order.currency).toUpperCase(), content_ids: contentIds, content_type: "product", contents, order_id: String(order.id) } }); const payload = compact({ data: [event], test_event_code: testEventCode, access_token: META_ACCESS_TOKEN }); const response = await fetch( `https://graph.facebook.com/${META_GRAPH_API_VERSION}/${META_PIXEL_ID}/events`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) } ); const result = await response.json(); if (!response.ok) { throw new Error(`Meta CAPI rejected Purchase: ${JSON.stringify(result)}`); } return result; } ``` Production requirements around this function: - Verify Shopify’s HMAC against the raw body. - Return `200 OK` quickly and process through a queue. - Store the `X-Shopify-Webhook-Id`. - Enforce a unique database constraint on `Purchase + order.id`. - Retry transient Meta failures using the same `event_id`. - Record response status and Meta trace ID, but not raw customer information. - Run a periodic reconciliation against Shopify paid orders. --- ## 6. End-to-end validation before scaling spend ### A. Configuration audit - [ ] Exactly one intended Meta dataset/pixel is connected. - [ ] The product catalog contains the Arc Clip Lamp. - [ ] Event `content_ids` match the catalog identifier exactly. - [ ] No old Pixel exists in `theme.liquid`, checkout scripts, GTM, or another Shopify app. - [ ] The store’s currency and presentment-currency behavior are understood. - [ ] Consent settings are active and tested. ### B. Browser event test Use Shopify Pixel Helper and Meta’s Pixel Helper or Events Manager testing tools. Complete this sequence: 1. Open the Arc Clip Lamp product page. 2. Confirm one `ViewContent`. 3. Add the lamp to the cart. 4. Confirm one `AddToCart`. 5. Start checkout. 6. Confirm one `InitiateCheckout`. 7. Complete an approved test checkout that reaches **Paid** status. 8. Confirm one browser `Purchase`. Check every event for: - Correct event name. - Numeric `value`. - Correct three-letter `currency`. - Correct `content_ids`. - Correct quantity. - Correct product/variant identifier. - No raw email, phone, or address in custom parameters. Shopify provides Pixel Helper inspection for app pixels, including event payloads and whether a pixel is awaiting consent. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels?utm_source=openai)) ### C. Server and deduplication test In Meta Events Manager: 1. Open the dataset’s **Test Events** view. 2. If custom CAPI is being tested, temporarily attach its `test_event_code`. 3. Place one paid test order. 4. Confirm the server `Purchase` arrives. 5. Compare its `event_id` to the browser `Purchase` event ID. 6. Confirm Meta displays browser and server delivery without counting two Purchases. 7. Remove the test-event code before production. Also confirm the CAPI response reports that one event was received and contains no validation messages. ### D. Failure-mode tests Repeat the journey under several conditions: - Safari or another browser with stronger tracking prevention. - Firefox. - Mobile browser. - Accelerated checkout, if enabled. - Browser with a content blocker. - Consent granted. - Consent denied or sale/sharing opt-out selected. Expected behavior: - Browser events may be restricted or unavailable under some conditions. - A permitted server Purchase should still arrive from the paid-order path. - Consent denial must produce the restrictions defined by Cedar & Coil’s privacy configuration; the server path must not be used to circumvent them. ### E. Reconciliation Before increasing spend, compare several days of data: - Number of eligible paid Shopify orders. - Number of unique Meta server Purchases. - Number of deduplicated Meta Purchases. - Purchase revenue and currency. - Duplicate event IDs. - Webhook and Meta API failures. - Meta Diagnostics warnings and event-match-quality feedback. Investigate any material discrepancy by Shopify order ID and Meta event ID. Do not expect attributed conversions in Ads Manager to equal Shopify’s total orders: attribution settings, consent, channel mix, and Meta’s attribution logic are separate from raw event delivery. --- ## 7. Consent and compliance CAPI improves delivery reliability; it does **not** bypass privacy rules or customer choices. Cedar & Coil should: - Configure Shopify’s customer privacy settings and consent banner for the markets it serves. - Prevent marketing pixels and corresponding server events from running when the required permission has not been granted. - Honor applicable opt-outs from data sale, sharing, targeted advertising, or profiling. - Explain the use of Meta Business Tools, browser identifiers, server event transmission, and hashed customer information in the privacy policy. - Treat hashed customer information as protected customer data, not anonymous information. - Collect only identifiers needed for matching. - Restrict access to raw order data, Meta tokens, and event logs. - Define retention and deletion procedures. - Complete required Shopify protected-customer-data reviews if building an app that accesses customer PII. Shopify warns that code designed to bypass consent requirements can violate its terms and create legal liability. Its pixels and server pixels remain subject to customer privacy settings. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/overview?utm_source=openai)) Requirements vary by jurisdiction, including US state privacy laws and European or UK consent rules. Cedar & Coil should have its final implementation and privacy disclosures reviewed by qualified counsel before launch.
Score the judge's verdict, criterion by criterion10/11 criteria passed · failed: event_time_stable
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 explicitly recommends browser Pixel plus server-side CAPI with deduplication and explains that browsers/ad blockers/privacy controls can prevent Pixel delivery, so CAPI provides a resilient second path.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓Section 2 provides a table and per-event JSON examples for ViewContent, AddToCart, InitiateCheckout, and Purchase, with Purchase explicitly including 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 sendMetaPurchase Node.js function builds an event object with event_name, event_time, event_id, action_source, and a user_data block before POSTing 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 6C instructs using Meta Events Manager's Test Events view and explicitly checking that browser and server Purchase events share an event_id and are shown as deduplicated rather than double-counted.
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 event table specifies browser vs server triggers (e.g. 'Browser: checkout_completed; Server: paid-order event such as orders/paid') and states 'a paid Shopify order is the source of truth for a server-side Purchase' rather than the thank-you page.
limits_stated
Limitations are stated honestly: no promised attribution-recovery percentages, and consent/regional rules are noted as constraints on what may be sent.
✓No attribution-recovery percentage is promised anywhere, and Section 7 states CAPI 'does not bypass privacy rules or customer choices' and must honor consent/opt-outs as constraints.
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓The guide states 'the browser and server events must share the same event_name and event_id' and shows matching eventID/event_id values so Meta treats the two transmissions as one conversion.
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 guide states 'CAPI retries must reuse the original event ID' and uses a stable scheme like `purchase:<Shopify order ID>` derived once per order, unaffected by retries.
event_time_stable
The server Purchase event uses the purchase/order occurrence timestamp in Unix seconds and preserves it across retries; using the current send or retry time fails.
✗The code defaults `eventTime = Math.floor(Date.now() / 1000)` (current send time) with no prose instruction to derive event_time from the order's occurrence timestamp or preserve it across webhook 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 and the code specify trimming/lowercasing email and other fields before SHA-256 hashing (e.g. normalizeEmail then sha256(...)).
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 gives a decisive recommendation—'Use the native Facebook & Instagram by Meta sales channel with Maximum data sharing... for the initial launch'—with a numbered concrete setup sequence for a small DTC store.