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

Answers & verdicts

GPT-6 Luna xhigh effort

Task passed
Task the exact prompt the model was given — assignment, source material, and skill guidance
Cedar & Coil sells the Arc Clip Lamp on Shopify and is preparing Meta ads. Write an implementation guide a technical marketer can follow to get reliable conversion tracking from the Shopify store into Meta, resilient to browser privacy limits. Cover, with labeled sections: (1) recommended architecture - browser Meta Pixel plus server-side Conversions API with deduplication - and why both are needed; (2) which standard events to send (ViewContent, AddToCart, InitiateCheckout, Purchase) with the key parameters for each, including value, currency, and content_ids on Purchase; (3) exactly how deduplication works between Pixel and CAPI; (4) how customer information must be prepared before sending server-side; (5) the concrete Shopify setup path - compare the native Meta sales channel app against a custom implementation, recommend one for a small DTC store, and include a code sketch of a server-side Purchase event request; (6) how to validate the setup end to end before scaling spend; (7) a consent and compliance note. Do not promise specific attribution recovery percentages. --- ## Supplied source: product-marketing.md # Cedar & Coil Cedar & Coil is a fictional direct-to-consumer brand for people who work or make things in compact spaces. Its first product is the Arc Clip Lamp, a rechargeable task light designed to move between a desk, shelf, and bedside. The approved positioning is adaptable light without surrendering permanent surface space. The voice is practical, warm, and visually specific—not luxury, medical, or productivity-maximizing. All campaign work must remain draft-only. Do not invent reviews, awards, scarcity, environmental claims, performance guarantees, or customer results. --- ## Supplied source: facts.md # Authoritative synthetic facts - Product: Arc Clip Lamp. - Price: $68. - Included: lamp, padded clamp, USB-C charging cable, and storage sleeve. - Lighting: three brightness settings and two color-temperature settings. - Battery statement allowed: up to eight hours on the lowest brightness. - Clamp opening: surfaces up to 2.25 inches thick. - Audience: renters, students, and makers with limited desk or counter space. - Approved CTA: Explore the Arc Clip Lamp. - No campaign has launched and no performance data exists. --- ## Skill guidance you should follow --- name: analytics description: "Set up or audit tracking — GA4, GTM, Mixpanel, Segment; tracking plans, event naming, UTM conventions, conversion and attribution debugging. Rate metrics divide matching closed windows — never full-period spend by partial-period results." metadata: version: 2.2.0 --- # Analytics Tracking You are an expert in analytics implementation and measurement. Your goal is to help set up tracking that provides actionable insights for marketing and product decisions. ## Initial Assessment **Check for product marketing context first:** If `.agents/product-marketing.md` exists (or `.claude/product-marketing.md`, or the legacy `product-marketing-context.md` filename, in older setups), read it before asking questions. Use that context and only ask for information not already covered or specific to this task. **Apply the project's brand:** If `BRAND.md` exists, read it before asking questions and apply it to everything you produce — its voice, messaging, and audience for anything written, and its colors, typography, and logo for anything visual. Never ask for a brand fact it already answers. If it lacks something you need, name the missing fact instead of inventing one or quietly falling back to a generic default. Before implementing tracking, understand: 1. **Business Context** - What decisions will this data inform? What are key conversions? 2. **Current State** - What tracking exists? What tools are in use? 3. **Technical Context** - What's the tech stack? Any privacy/compliance requirements? --- ## Core Principles ### 1. Track for Decisions, Not Data - Every event should inform a decision - Avoid vanity metrics - Quality > quantity of events ### 2. Start with the Questions - What do you need to know? - What actions will you take based on this data? - Work backwards to what you need to track ### 3. Name Things Consistently - Naming conventions matter - Establish patterns before implementing - Document everything ### 4. Maintain Data Quality - Validate implementation - Monitor for issues - Clean data > more data ### 5. Compute, Don't Eyeball - Derive every total, rate, and delta from row-level data with a script or spreadsheet — never by scanning rows and summing mentally. One silently dropped row corrupts every figure downstream of it. - Cross-check each headline figure a second, independent way (a reconciliation total, a recomputation from a different grouping) before reporting it, and chase any mismatch to the exact row. - When a claim is about one segment — a single campaign, ad set, channel, or week — report that segment's own numbers. Never fold it into a neighboring group and let the group's total speak for it. ### 6. Match Observation Windows - A rate or efficiency metric divides a numerator and denominator that cover the same closed observation window. Never divide a full period's spend by a partial period's conversions or revenue — restate both over the weeks that actually have data, and say which weeks those are. - Cohort rates use only cohorts whose observation window has ended. A trial or signup still inside its window is pending, not failed — exclude it from the denominator and label it as pending rather than counting it against the rate. ### 7. Recommend Against the Stated Goal - Analysis ends in a recommendation, and the recommendation must be argued from the goal the brief states — the launch target, audience, revenue, or positioning objective — not only from what is operationally easiest. Name which stated goal each option serves and what it trades away. --- ## Tracking Plan Framework ### Structure ``` Event Name | Category | Properties | Trigger | Notes ---------- | -------- | ---------- | ------- | ----- ``` ### Event Types | Type | Examples | |------|----------| | Pageviews | Automatic, enhanced with metadata | | User Actions | Button clicks, form submissions, feature usage | | System Events | Signup completed, purchase, subscription changed | | Custom Conversions | Goal completions, funnel stages | **For comprehensive event lists**: See [references/event-library.md](references/event-library.md) --- ## Event Naming Conventions ### Recommended Format: Object-Action ``` signup_completed button_clicked form_submitted article_read checkout_payment_completed ``` ### Best Practices - Lowercase with underscores - Be specific: `cta_hero_clicked` vs. `button_clicked` - Include context in properties, not event name - Avoid spaces and special characters - Document decisions --- ## Essential Events ### Marketing Site | Event | Properties | |-------|------------| | cta_clicked | button_text, location | | form_submitted | form_type | | signup_completed | method, source | | demo_requested | - | ### Product/App | Event | Properties | |-------|------------| | onboarding_step_completed | step_number, step_name | | feature_used | feature_name | | purchase_completed | plan, value | | subscription_cancelled | reason | **For full event library by business type**: See [references/event-library.md](references/event-library.md) --- ## Event Properties ### Standard Properties | Category | Properties | |----------|------------| | Page | page_title, page_location, page_referrer | | User | user_id, user_type, account_id, plan_type | | Campaign | source, medium, campaign, content, term | | Product | product_id, product_name, category, price | ### Best Practices - Use consistent property names - Include relevant context - Don't duplicate automatic properties - Avoid PII in properties --- ## GA4 Implementation ### Quick Setup 1. Create GA4 property and data stream 2. Install gtag.js or GTM 3. Enable enhanced measurement 4. Configure custom events 5. Mark conversions in Admin ### Custom Event Example ```javascript gtag('event', 'signup_completed', { 'method': 'email', 'plan': 'free' }); ``` **For detailed GA4 implementation**: See [references/ga4-implementation.md](references/ga4-implementation.md) --- ## Google Tag Manager ### Container Structure | Component | Purpose | |-----------|---------| | Tags | Code that executes (GA4, pixels) | | Triggers | When tags fire (page view, click) | | Variables | Dynamic values (click text, data layer) | ### Data Layer Pattern ```javascript dataLayer.push({ 'event': 'form_submitted', 'form_name': 'contact', 'form_location': 'footer' }); ``` **For detailed GTM implementation**: See [references/gtm-implementation.md](references/gtm-implementation.md) --- ## UTM Parameter Strategy ### Standard Parameters | Parameter | Purpose | Example | |-----------|---------|---------| | utm_source | Traffic source | google, newsletter | | utm_medium | Marketing medium | cpc, email, social | | utm_campaign | Campaign name | spring_sale | | utm_content | Differentiate versions | hero_cta | | utm_term | Paid search keywords | running+shoes | ### Naming Conventions - Lowercase everything - Use underscores or hyphens consistently - Be specific but concise: `blog_footer_cta`, not `cta1` - Document all UTMs in a spreadsheet --- ## Debugging and Validation ### Testing Tools | Tool | Use For | |------|---------| | GA4 DebugView | Real-time event monitoring | | GTM Preview Mode | Test triggers before publish | | Browser Extensions | Tag Assistant, dataLayer Inspector | ### Validation Checklist - [ ] Events firing on correct triggers - [ ] Property values populating correctly - [ ] No duplicate events - [ ] Works across browsers and mobile - [ ] Conversions recorded correctly - [ ] No PII leaking ### Common Issues | Issue | Check | |-------|-------| | Events not firing | Trigger config, GTM loaded | | Wrong values | Variable path, data layer structure | | Duplicate events | Multiple containers, trigger firing twice | --- ## Privacy and Compliance ### Considerations - Cookie consent required in EU/UK/CA - No PII in analytics properties - Data retention settings - User deletion capabilities ### Implementation - Use consent mode (wait for consent) - IP anonymization - Only collect what you need - Integrate with consent management platform --- ## Output Format ### Tracking Plan Document ```markdown # [Site/Product] Tracking Plan ## Overview - Tools: GA4, GTM - Last updated: [Date] ## Events | Event Name | Description | Properties | Trigger | |------------|-------------|------------|---------| | signup_completed | User completes signup | method, plan | Success page | ## Custom Dimensions | Name | Scope | Parameter | |------|-------|-----------| | user_type | User | user_type | ## Conversions | Conversion | Event | Counting | |------------|-------|----------| | Signup | signup_completed | Once per session | ``` --- ## Task-Specific Questions 1. What tools are you using (GA4, Mixpanel, etc.)? 2. What key actions do you want to track? 3. What decisions will this data inform? 4. Who implements - dev team or marketing? 5. Are there privacy/consent requirements? 6. What's already tracked? --- ## Tool Integrations For implementation, see the [tools registry](../../tools/REGISTRY.md). Key analytics tools: | Tool | Best For | MCP | Guide | |------|----------|:---:|-------| | **GA4** | Web analytics, Google ecosystem | ✓ | [ga4.md](../../tools/integrations/ga4.md) | | **Mixpanel** | Product analytics, event tracking | - | [mixpanel.md](../../tools/integrations/mixpanel.md) | | **Amplitude** | Product analytics, cohort analysis | - | [amplitude.md](../../tools/integrations/amplitude.md) | | **PostHog** | Open-source analytics, session replay | - | [posthog.md](../../tools/integrations/posthog.md) | | **Segment** | Customer data platform, routing | - | [segment.md](../../tools/integrations/segment.md) | --- ## Related Skills - **ab-testing**: For experiment tracking - **seo-audit**: For organic traffic analysis - **cro**: For conversion optimization (uses this data) - **revops**: For pipeline metrics, CRM tracking, and revenue attribution
✓ Attempt 1
Answer · attempt 1 the model's full response$0.020 · 171.9s · 16.3k tok
# Cedar & Coil: Shopify → Meta Conversion Tracking Guide **Draft implementation guide only.** This covers tracking setup and validation; it does not authorize publishing campaigns. ## (1) Recommended architecture: Pixel + Conversions API ```text Shopify storefront and checkout ├─ Meta Pixel (browser) ── product views, cart, checkout, purchase ──┐ └─ Shopify / server ──── Conversions API (CAPI), especially purchase ─┤ ▼ Same Meta Pixel/dataset deduplicate overlapping events ``` Use the **Meta Pixel and CAPI together**: - **Pixel:** sends browser activity such as product views and cart actions. Browser settings, ad blockers, or a page closing before an event fires can interrupt it. - **CAPI:** sends events from Shopify or your server. It does not depend on the shopper’s browser delivering the event, so it can provide a second path for an order event. Shopify describes its integration as sending Purchase through CAPI alongside the Pixel. - **Together:** give Meta browser and server signals, while deduplication prevents the same customer action from being counted twice. Meta recommends this redundant setup. CAPI reduces dependence on browser delivery; it does **not** guarantee recovery of every missed conversion or override consent and privacy controls. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) For a small store, let Shopify’s native integration own both paths unless there is a concrete need for custom event logic. ## (2) Events and parameters to send Map Shopify actions to Meta’s standard event names. Send the real transaction values and catalog identifiers—don’t hard-code the Arc Clip Lamp’s listed price into every event. | Meta event | Trigger | Recommended parameters | |---|---|---| | **ViewContent** | A shopper views the Arc Clip Lamp product page. | `content_ids`: the viewed variant’s ID matching the Meta catalog; `content_type: "product"`; `value`: selected variant’s current price; `currency`: storefront/market currency, as a three-letter ISO code; optionally `contents` with ID and quantity 1. | | **AddToCart** | A successful add-to-cart action—not merely clicking a button if the add fails. | `content_ids`: IDs of items just added; `contents`: item IDs and quantities; `value`: value of the items added; `currency`: ISO currency. | | **InitiateCheckout** | The shopper starts checkout. | `content_ids` and `contents` for the checkout items; `value`: checkout/cart value on a consistent basis; `currency`: ISO currency; optionally `num_items`. | | **Purchase** | A completed purchase, once per order. | `value`: the actual Shopify order value using one documented convention; `currency`: the order’s ISO currency; **`content_ids`**: IDs for all purchased items; `content_type: "product"`; `contents` with item ID, quantity, and item price; `order_id` for reconciliation; and `event_id` for deduplication. | Use the **same product/catalog IDs** across `content_ids` and each `contents[].id`; confirm they match the IDs in Meta’s catalog, rather than assuming a Shopify product ID and catalog item ID are interchangeable. Meta identifies product IDs and quantities as useful for commerce/catalog events. Shopify documents its order-value tracking as using the order total, including duties, taxes, and discounts. For Cedar & Coil, the $68 product price is a line-item price; the Purchase `value` should be the actual order value under the chosen convention, and `currency` should come from Shopify’s order—not an assumed currency. ([developers.facebook.com](https://developers.facebook.com/docs/facebook-business-extension/fbe/guides/pixel-events)) ## (3) Exactly how deduplication works For the recommended method, Meta matches the browser and server copies using **both** the event name and event ID: 1. The browser Pixel sends, for example, `Purchase` with Pixel’s `eventID`. 2. CAPI sends the corresponding event as `event_name: "Purchase"` with `event_id`. 3. The event names must match exactly, and the IDs must match exactly, for the same Meta Pixel/dataset. 4. Meta checks for matching copies received within **48 hours** of the first copy and discards the subsequent duplicate. When the events do not differ meaningfully, Meta generally prefers the one received first. For Pixel, `eventID` is the fourth argument: ```javascript fbq( "track", "Purchase", { value: purchaseValue, currency: orderCurrency }, { eventID: canonicalOrderId } ); ``` The CAPI copy must use that same string in `event_id`. Use a stable, unique ID for each customer action; for Purchase, a canonical Shopify order ID is a practical choice. In a custom build, normalize the browser and webhook versions to the same string—Shopify’s browser checkout event exposes an order ID, while the server integration may receive a differently formatted ID. Don’t independently generate random IDs on the browser and server. Meta documents `fbp` or `external_id` as an alternative deduplication method, but it is less robust and generally depends on the browser event arriving first. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## (4) Prepare customer information before server-side sending Send only information permitted by the store’s privacy settings and applicable rules. For CAPI: - **Normalize, then SHA-256 hash** customer identifiers Meta requires hashed—such as email (`em`), phone (`ph`), name, and address fields. For example, trim and lowercase an email before hashing; normalize phone numbers consistently with the country calling code. Follow Meta’s current field-specific normalization rules. Don’t hash values twice. - **Do not hash** `fbp`, `fbc`, client IP address, or client user agent. Pass `fbp`/`fbc` only when actually available and permitted; don’t invent them. Meta lists these as unhashed fields. - For website events, include `client_user_agent`, `action_source: "website"`, and `event_source_url`. Provide the actual event URL in a form that does not expose checkout tokens or other sensitive query data. - A stable `external_id` may be useful if available; Meta recommends hashing it. Omit identifiers you don’t have or are not allowed to send. Hashing is a transmission format for matching, not a reason to treat customer data as anonymous or to ignore privacy controls. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/)) ## (5) Shopify setup path and implementation choice ### Recommended for Cedar & Coil: Facebook & Instagram by Meta For a small DTC store, start with Shopify’s **native Facebook & Instagram by Meta sales channel**. It is the lower-maintenance route through Shopify checkout and supports the Pixel/CAPI data-sharing setup. A custom build offers more control, but adds webhook handling, credentials, retries, consent enforcement, event-ID coordination, and ongoing maintenance. **Setup path:** 1. Install **Facebook & Instagram by Meta** from the Shopify App Store and connect the appropriate Meta business assets, ad account, and Pixel/dataset. 2. In Shopify admin, go to **Sales channels → Facebook & Instagram → Settings → Data sharing settings**. Depending on the admin UI, this may be labeled **Share data settings**. 3. Enable customer data sharing and select the Pixel/dataset. 4. Choose **Enhanced** as a baseline for Pixel + CAPI. Consider **Maximum** only after reviewing its data sharing and latest Meta advertising technology with the people responsible for privacy. Shopify says both Enhanced and Maximum use Pixel and CAPI and share customer information for matching; Standard is Pixel-only. Don’t choose Maximum on the assumption that it guarantees a particular measurement lift. 5. Remove any other Meta Pixel or Purchase sender—theme code, old preference-page code, GTM tags, custom pixels, or another tracking app—unless you have deliberately designed and tested a coordinated implementation. Shopify warns that leftover Pixel code can create duplicate or incorrect data. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?r=ecm-bfs)) ### When to use a custom implementation Choose custom only if the native channel does not meet a specific requirement—for example, bespoke event logic or a backend workflow the channel cannot support. A typical custom design uses Shopify web pixels for browser events and a server-side Shopify order webhook for Purchase. Shopify’s `checkout_completed` event exposes the completed order ID, which can be used to construct the shared browser/server event ID. The server should validate webhook authenticity, make order processing idempotent, and keep Meta credentials off the browser. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed?utm_source=openai)) **Server-side Purchase request sketch** — illustrative pseudocode for a custom backend, not a second sender to install alongside the native channel. The `event_id` must exactly match the Pixel’s `eventID`; mapping functions should use the store’s actual Shopify payload and catalog IDs. ```javascript import { createHash } from "node:crypto"; const sha256 = (value) => createHash("sha256").update(value, "utf8").digest("hex"); function canonicalOrderId(id) { // Normalize the browser checkout order ID and server order ID // to the same exact string. Verify both Shopify payload formats. return String(id).split("/").pop(); } async function sendPurchase(order, consentSnapshot) { // Apply Cedar & Coil's consent/privacy policy before queueing or sending. if (!maySendMetaAttribution(consentSnapshot, order.shippingAddress?.countryCode)) { return; } const eventId = canonicalOrderId(order.id); const userData = { ...(order.email ? { em: sha256(order.email.trim().toLowerCase()) } : {}), ...(order.phone ? { ph: sha256(normalizePhoneForMeta(order.phone)) } : {}), ...(order.clientIp ? { client_ip_address: order.clientIp } : {}), ...(order.userAgent ? { client_user_agent: order.userAgent } : {}), ...(order.fbp ? { fbp: order.fbp } : {}), ...(order.fbc ? { fbc: order.fbc } : {}), }; const event = { event_name: "Purchase", event_time: Math.floor(new Date(order.completedAt).getTime() / 1000), event_id: eventId, action_source: "website", event_source_url: sanitizeEventUrl(order.eventSourceUrl), user_data: userData, custom_data: { value: purchaseValueFromShopifyOrder(order), // documented, consistent basis currency: order.currencyCode, content_type: "product", content_ids: order.lineItems.map((item) => String(item.metaCatalogItemId) ), contents: order.lineItems.map((item) => ({ id: String(item.metaCatalogItemId), quantity: item.quantity, item_price: item.finalUnitPrice, })), order_id: String(order.id), }, }; const body = { data: [event], ...(process.env.META_TEST_EVENT_CODE ? { test_event_code: process.env.META_TEST_EVENT_CODE } : {}), }; const response = await fetch( `https://graph.facebook.com/${process.env.META_API_VERSION}/${process.env.META_PIXEL_ID}/events?access_token=${process.env.META_ACCESS_TOKEN}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body), } ); if (!response.ok) throw new Error(`Meta CAPI error: ${await response.text()}`); } ``` `normalizePhoneForMeta`, `purchaseValueFromShopifyOrder`, `sanitizeEventUrl`, and `maySendMetaAttribution` are deliberate placeholders: implement them for the store’s formats, consent rules, and documented value convention. Keep the access token on the server. For a custom build, send the matching browser Purchase event with `eventID: canonicalOrderId(checkout.order.id)`; don’t add this custom request on top of the native channel’s Purchase stream. Meta’s website-event parameter requirements include `client_user_agent`, `action_source`, and `event_source_url`. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/)) ## (6) Validate end to end before scaling spend 1. **Check for duplicate sources.** Confirm there is one intended Pixel/dataset and one owner for each browser/server event. 2. **Use Meta Events Manager → Data Sources → your Pixel/dataset → Test Events.** Exercise the store and check that `ViewContent`, `AddToCart`, and `InitiateCheckout` arrive from the browser as expected. For custom CAPI, use the Test Events code in the server request during testing. 3. **Place a Shopify test order.** Shopify supports the Test payment gateway or Shopify Payments test mode. Test mode prevents live customers from making purchases while it is active, so turn it off immediately afterward. ([help.shopify.com](https://help.shopify.com/en/manual/checkout-settings/test-orders?locale=en-US&utm_source=openai)) 4. **Inspect Purchase details:** correct `value`, `currency`, `content_ids`, quantities, source URL, and server/browser sources where both are expected. Verify catalog IDs and the browser/server `eventID`/`event_id` pair. 5. **Verify deduplication** in Events Manager’s Event Deduplication details, and inspect Diagnostics for rejected or malformed events. Meta says received-event details can be checked in Events Manager and provides an Event Deduplication view. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) 6. **Test an eligible browser-restricted scenario** to confirm that a server Purchase can still arrive when the browser event is blocked. Also test a consent refusal: server-side delivery must honor that choice rather than using CAPI to bypass it. 7. **Reconcile test orders to Shopify** and confirm retries or confirmation-page reloads do not create a second Purchase. Remove the test event code and disable payment test mode before production. A successful test validates event delivery and payload behavior; it does not establish how much Meta-attributed performance or revenue will be reported. ## (7) Consent and compliance note Configure Shopify’s **Settings → Customer privacy** controls, including the relevant cookie banner, opt-out choices, and privacy policy. Make sure any third-party consent tool reports choices through Shopify’s Customer Privacy API. Apply the same eligibility decision to server-side CAPI as to the browser Pixel—**do not use CAPI to circumvent a refusal or opt-out**. Shopify notes that non-essential tracking may require consent in configured regions, and that merchants remain responsible for their privacy setup and legal obligations. Review the policy language to describe Meta data sharing, including customer information used for matching. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings)) SHA-256 hashing does not make identifiers anonymous. Minimize fields, avoid sensitive information in event parameters and URLs, protect logs and credentials, and coordinate deletion requests with any systems that store event data. For questions about which consent or notice rules apply to Cedar & Coil’s customers, get jurisdiction-specific legal advice. ([ftc.gov](https://www.ftc.gov/policy/advocacy-research/tech-at-ftc/2024/07/no-hashing-still-doesnt-make-your-data-anonymous?utm_source=openai))
Score · attempt 1 the judge's verdict, criterion by criterion11/11 criteria passed
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends Pixel plus CAPI with deduplication and says browser settings, ad blockers, or page closes can interrupt the Pixel while CAPI does not depend on the browser.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase 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 sendPurchase 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.
✓Section 6 uses Events Manager Test Events, a Shopify test order, and the Event Deduplication view, and checks that the eventID/event_id pair matches.
sources_defined
For each event it is clear where it fires (browser vs server) and what the source of truth is (e.g. Purchase from the Shopify order webhook/server, not only the thank-you page).
✓The diagram and bullets put views, cart and checkout on the Pixel and Purchase on both paths; the custom path uses the Shopify order webhook with the order ID as the shared ID. This is less explicit than a per-event browser/server column.
limits_stated
Limitations are stated honestly: no promised attribution-recovery percentages, and consent/regional rules are noted as constraints on what may be sent.
✓It says CAPI does not guarantee recovery of missed conversions or override consent, gives no percentages, and says a successful test does not establish reported performance.
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 says event name and event ID must match exactly across Pixel eventID and CAPI event_id on the same dataset, with a 48-hour window, and shows fbq with { eventID }.
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.
✓event_id is derived deterministically from the canonical Shopify order ID, with no random suffix, and the guide calls for idempotent processing and testing that retries create no 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 Math.floor(new Date(order.completedAt).getTime()/1000), the order completion time 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, phone is normalized then hashed, fbp/fbc/IP/UA are left unhashed, and the guide warns against double hashing.
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 for a small store, with numbered setup steps and a defined case for choosing custom instead.
✓ Attempt 2
Answer · attempt 2 the model's full response$0.019 · 171.3s · 16.4k tok
# Cedar & Coil: Shopify → Meta Conversion-Tracking Implementation Guide **Recommendation:** Use Shopify’s **Facebook & Instagram by Meta** sales channel for the first implementation. Enable the Meta Pixel plus Conversions API (CAPI), and verify the events in Events Manager before launching ads. Treat any custom CAPI code below as an alternative—not an additional Purchase sender. ## 1. Recommended architecture: Pixel + CAPI Use a **redundant setup**: - **Meta Pixel (browser):** Sends on-site behavior such as product views, cart additions, and checkout starts. - **Conversions API (server):** Sends order events from Shopify to Meta, reducing reliance on the buyer’s browser loading a confirmation page or allowing the Pixel request. Shopify’s **Standard** data-sharing level uses the Pixel. **Enhanced** and **Maximum** use both the Pixel and CAPI; Shopify describes CAPI as sending the Purchase event server-to-server. This can make Purchase tracking less dependent on browser delivery, but it does **not** guarantee attribution or recover every missed signal. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) For Cedar & Coil, use **Enhanced** as a sensible starting point. It provides Pixel plus CAPI without opting into Maximum’s additional advertising technology. Shopify says Enhanced and Maximum share customer information such as name, location, email, and phone, so make this choice only after reviewing consent and privacy requirements. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai)) ## 2. Standard events and parameters Send the same event names and product identifiers consistently. Meta’s key product parameters include `content_ids`, `content_type`, and `contents`; Purchase requires `value` and `currency`. For catalog matching, `content_ids` must match the IDs used for the corresponding products in Meta’s catalog. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/custom-data)) | Meta event | Trigger | Recommended parameters | |---|---|---| | **ViewContent** | A product detail page is viewed. | `content_ids` (the viewed product or variant’s catalog ID), `content_type: "product"` (or `"product_group"` if IDs represent product groups), `content_name`, `value` (current unit price), `currency`. | | **AddToCart** | A product is successfully added to the cart—not merely when a button is clicked. | `content_ids`, `content_type`, `contents` (ID, quantity, and item price), `value` (the added line’s value), `currency`, and optionally `content_name`. | | **InitiateCheckout** | Checkout begins. | `content_ids`, `content_type`, `contents`, `value` (the cart/checkout value at that point), `currency`, and `num_items`. | | **Purchase** | Checkout completes / the order is confirmed. | **`value`**, **`currency`**, **`content_ids`** for every purchased product, `content_type`, `contents` with IDs and quantities, and `order_id`. | Shopify’s Pixel examples map product views, cart additions, checkout starts, and completed checkouts to these Meta events. Shopify also describes order values as based on the order total, including duties, taxes, and discounts. Choose and document a value convention, then apply it consistently. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/code?utm_source=openai)) **For the Arc Clip Lamp:** read the current Shopify price and currency dynamically; do not hard-code `$68`. If the store currency is USD and the order is one undiscounted lamp, `$68.00` is an example Purchase value. Use the actual order amount for real events. ## 3. Exactly how Pixel–CAPI deduplication works When both channels send the **same customer action**, Meta’s recommended method is to match: 1. The Pixel event’s `eventID` to the CAPI event’s `event_id`. 2. The Pixel event name to CAPI’s `event_name`. 3. The events to the same Pixel/dataset, received within Meta’s **48-hour** deduplication window. For example, the Pixel call uses `Purchase` and `eventID: "shopify-order-123"`; the matching server event uses `event_name: "Purchase"` and `event_id: "shopify-order-123"`. Meta generally prefers the first event received when the copies do not differ meaningfully. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) For a Purchase, use a stable unique order identifier as the shared ID. For other events without a natural ID, generate one once and pass that **same** ID to both channels. Shopify’s `checkout_completed` Pixel event provides the order ID, which can be used to form the browser-side Purchase ID in a custom implementation. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/server-event)) Do **not** count on `fbp` or `external_id` as your primary deduplication method: Meta documents that this fallback generally works only when the browser event arrives before the server event. Also add your own server-side idempotency—such as a database record keyed by shop, order ID, and event name—because Meta’s browser/server deduplication is not a substitute for preventing repeated webhook sends from your own system. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) ## 4. Prepare customer information before sending CAPI events Only send data you are permitted to share for the event. Normalize eligible customer identifiers first, then SHA-256 hash them: - **Email (`em`):** trim leading/trailing spaces and lowercase. - **Phone (`ph`):** normalize to an international number with country code, then remove symbols and leading zeros before hashing. - **Name, city, state, postal code, country:** follow Meta’s normalization rules before hashing; for example, lowercase values and use the specified state/country codes. - **Do not hash:** `client_ip_address`, `client_user_agent`, `fbp`, or `fbc`. Send them only when available and permitted. - **Omit missing values.** Do not hash empty strings or put customer information in `custom_data`. Meta’s current customer-information documentation specifies which fields require hashing and which must remain unhashed. It also says website CAPI events require `client_user_agent`, `action_source`, and `event_source_url`. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters)) Treat hashed identifiers as sensitive data, not as anonymous data. Keep the CAPI token server-side, restrict access, redact it from logs, and avoid putting personal information or sensitive checkout tokens into URLs or event properties. ## 5. Shopify setup path: native channel vs. custom implementation ### Option A — Native Facebook & Instagram by Meta sales channel **Recommended for this small DTC store.** It avoids maintaining a custom event pipeline and connects Shopify’s product/catalog and data-sharing settings to Meta. It also makes the Pixel/CAPI setup easier to manage in Shopify. ([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** and add **Facebook & Instagram by Meta**. 2. Complete setup and connect the relevant Meta business portfolio, ad account, and Pixel/dataset. 3. Open **Sales channels → Facebook & Instagram → Settings → Data sharing settings** (the label may appear as **Share data settings**). 4. Enable customer data sharing and choose **Enhanced** as the starting level. 5. Remove any old hand-installed Meta Pixel code or duplicate Pixel integrations from the theme, Online Store Preferences, tag manager, or other apps. Shopify warns that duplicate Pixel installations can lead to duplicate or incorrect data. ([help.shopify.com](https://help.shopify.com/en/manual/online-sales-channels/social-commerce/facebook-instagram-by-meta/setup?utm_source=openai)) 6. Verify that Cedar & Coil’s product IDs in Meta’s catalog match the IDs sent in events. With the native channel, let that integration own its Pixel/CAPI events. **Do not add a second server Purchase sender.** Verify in Events Manager that the browser and server copies are being deduplicated. ### Option B — Custom Shopify Pixel and server integration Choose this only if Cedar & Coil needs custom event logic, additional server-side funnel events, or a maintained event pipeline—and has someone responsible for its ongoing testing and privacy controls. A custom build should use a Shopify **web pixel** for browser/checkout events and a backend service for CAPI, with verified Shopify webhooks, retries, idempotency, and consent-aware processing. Shopify’s web pixel APIs expose standard events such as `product_viewed`, `product_added_to_cart`, `checkout_started`, and `checkout_completed`; custom implementations need to map them to Meta’s event schema. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?km_TopNav_contact=%2Fblog%2Fguest-blogging-guidelines%2F&kme=Website_TopNav_click&who=support&utm_source=openai)) **Server-side Purchase request sketch — custom route only:** The example assumes an already-verified Shopify order webhook, an idempotent sender, and a stored consent decision. `catalogIdFor()` must return the exact product/variant ID used in Meta’s catalog. The browser must send the matching Pixel Purchase with the same order-derived `eventID`. ```js import { createHash } from "node:crypto"; const sha256 = (s) => createHash("sha256").update(s, "utf8").digest("hex"); async function sendPurchase(order) { // Use Shopify/CMP consent state for ad tracking, not email-marketing opt-in. if (!order.metaAdsTrackingAllowed) return; // Implement persistent idempotency keyed by shop + order ID + "Purchase". if (await alreadySent(order.id, "Purchase")) return; const email = order.email?.trim().toLowerCase(); // Normalize with a phone-number library to E.164 using the correct country // before removing the "+" and hashing. Do not infer a country code blindly. const phoneDigits = order.phone ? normalizePhoneToE164Digits(order.phone, order.billing_address?.country_code) : null; const user_data = { ...(email ? { em: sha256(email) } : {}), ...(phoneDigits ? { ph: sha256(phoneDigits) } : {}), ...(order.client_details?.browser_ip || order.browser_ip ? { client_ip_address: order.client_details?.browser_ip || order.browser_ip } : {}), ...(order.client_details?.user_agent ? { client_user_agent: order.client_details.user_agent } : {}), // Include only if collected and retained with the required consent. ...(order.metaAttribution?.fbp ? { fbp: order.metaAttribution.fbp } : {}), ...(order.metaAttribution?.fbc ? { fbc: order.metaAttribution.fbc } : {}), }; const eventId = `shopify-order-${order.id}`; const payload = { data: [{ event_name: "Purchase", event_time: Math.floor( new Date(order.processed_at || order.created_at).getTime() / 1000 ), event_id: eventId, action_source: "website", // Use a canonical, verified storefront completion URL without // order-status tokens or other sensitive query parameters. event_source_url: order.metaCanonicalCompletionUrl, user_data, custom_data: { currency: order.currency, value: Number(order.total_price), order_id: String(order.id), content_type: "product", content_ids: order.line_items.map(catalogIdFor), contents: order.line_items.map((item) => ({ id: catalogIdFor(item), quantity: item.quantity, item_price: Number(item.price), })), }, }], ...(process.env.META_TEST_EVENT_CODE ? { test_event_code: process.env.META_TEST_EVENT_CODE } : {}), }; const apiVersion = process.env.META_GRAPH_API_VERSION; // Pin supported version const endpoint = `https://graph.facebook.com/${apiVersion}/${process.env.META_DATASET_ID}/events` + `?access_token=${encodeURIComponent(process.env.META_CAPI_TOKEN)}`; const response = await fetch(endpoint, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }); if (!response.ok) throw new Error(`Meta CAPI returned ${response.status}`); await markSent(order.id, "Purchase"); } ``` Keep `META_GRAPH_API_VERSION` configurable and pin it to a version currently supported by Meta; Meta’s versioning documentation lists Graph API **v27.0** as the latest version checked for this guide. The example’s event fields follow Meta’s CAPI requirements for website events. ([developers.facebook.com](https://developers.facebook.com/docs/graph-api/?utm_source=openai)) For the custom browser counterpart, use the same `eventId` and Purchase name: ```js fbq( "track", "Purchase", { value: orderTotal, currency, content_ids: catalogIds }, { eventID: `shopify-order-${shopifyOrderId}` } ); ``` Do not use this custom sender alongside the native channel’s Purchase event. ## 6. Validate end to end before scaling spend 1. **Check Shopify first:** confirm the Meta channel is connected, the correct Pixel/dataset is selected, and consent settings are functioning. 2. **Test the funnel:** view the Arc Clip Lamp product page, add it to cart, start checkout, and complete a test purchase. 3. **Inspect browser events:** use Meta Pixel Helper and Shopify’s pixel tools. Confirm each event fires once at the correct action, with the expected value, currency, and catalog IDs. 4. **Inspect server events:** for custom CAPI, send a test event using Meta’s `test_event_code`; remove the code for production. 5. **Check Events Manager → Test Events/Overview:** confirm the expected event names, connection methods, values, and currency. Confirm the Purchase’s browser `eventID` matches server `event_id`, and inspect **Event Deduplication** for successful matching. Meta says Events Manager can show received events and deduplication details. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) 6. **Reconcile with Shopify:** compare test orders against Meta Purchase events; check for missing, duplicate, or incorrectly valued purchases. Test a consented session and a declined-consent session, plus mobile and privacy-restricted browsers. 7. **Check freshness and diagnostics:** verify events arrive promptly and review any parameter or match-quality warnings before spending. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/verifying-setup)) ## 7. Consent and compliance note CAPI is a different **delivery path**, not permission to ignore a customer’s consent or opt-out. Shopify says pixels and server pixels remain subject to customer privacy settings, and events may be restricted when tracking consent is absent. Use Shopify’s customer privacy settings or a consent platform integrated with the **Customer Privacy API**, and ensure the same decision suppresses both browser and server marketing events. Email-marketing opt-in is not a substitute for ad-tracking consent. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai)) Keep the privacy notice accurate about Meta Pixel/CAPI data sharing, identifiers, purposes, and customer choices; honor applicable opt-outs and deletion requests. Requirements depend on where Cedar & Coil’s customers are located, so have counsel review the implementation and notices. Shopify explicitly notes that its privacy settings are not a substitute for legal advice. ([help.shopify.com](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings?utm_source=openai))
Score · attempt 2 the judge's verdict, criterion by criterion11/11 criteria passed
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends a redundant Pixel plus CAPI setup and says CAPI reduces reliance on the buyer's browser loading the confirmation page or allowing the Pixel request, with no attribution guarantee.
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, and Purchase lists value, currency, content_ids, contents and order_id.
code_sketch
A concrete server-side Purchase event code sketch or request example is included showing event_name, event_time, event_id, action_source, and a user_data block.
✓The JS sketch builds a payload with event_name "Purchase", event_time, event_id, action_source "website" and a user_data block, then POSTs it to the /events endpoint.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Events Manager Test Events with test_event_code and checks that the browser eventID matches the server event_id and that the Event Deduplication view shows matching.
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).
✓Section 1 puts product views, add-to-cart and checkout starts on the Pixel and order/Purchase events on server-side CAPI, and the custom sketch sources Purchase from a verified Shopify order webhook, though the table has no explicit channel column.
limits_stated
Limitations are stated honestly: no promised attribution-recovery percentages, and consent/regional rules are noted as constraints on what may be sent.
✓It says CAPI does "not guarantee attribution or recover every missed signal", gives no recovery percentages, and states that consent and regional rules constrain what may be sent.
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓It matches Pixel eventID to CAPI event_id and the same event name within the 48-hour window, with a concrete example of Purchase and "shopify-order-123" on both sides.
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 the deterministic `shopify-order-${order.id}`, shared with the browser Pixel call, and a persistent idempotency check keyed by shop, order ID and event name guards retries; for other events it says to generate the ID once and pass the same one to both channels.
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.processed_at || order.created_at).getTime()/1000), the order's own timestamp in Unix seconds rather than the send time, so retries reuse it.
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, phone is normalized to E.164 before hashing, and IP, user agent, fbp and fbc are explicitly left unhashed.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓It recommends the native Facebook & Instagram by Meta channel at Enhanced level with numbered Shopify Admin steps, and limits the custom build to specific conditions.
✓ Attempt 3
Answer · attempt 3 the model's full response$0.013 · 110.6s · 10.9k tok
# Cedar & Coil: Shopify-to-Meta Conversion Tracking Guide **Recommendation:** Start with Shopify’s **Facebook & Instagram by Meta** sales channel, with customer data sharing enabled at **Enhanced**. That gives a small DTC store a managed Pixel-plus-Conversions-API setup without taking on a custom integration. Use **Maximum** only if the additional Meta advertising features are wanted and the associated data sharing has been reviewed. For the Arc Clip Lamp, treat **$68 USD as the current product price, not a hardcoded conversion value**: read the selected variant’s live price for product events and the actual checkout/order total for Purchase. ## 1. Recommended architecture: Pixel + Conversions API Use two paths to the **same Meta dataset/Pixel**: - **Browser Meta Pixel:** sends storefront behavior such as `ViewContent`, `AddToCart`, and `InitiateCheckout`. It can also send `Purchase` when the confirmation page loads. - **Server-side Conversions API (CAPI):** sends the completed Purchase from Shopify’s server side, alongside the Pixel event when both are configured to send it. The browser path gives Meta browser activity and browser identifiers; the server path makes the server event less dependent on a browser request successfully reaching Meta. Browser ad blockers can block Pixel requests, whereas Shopify describes its CAPI purchase transmission as server-to-server. This makes the setup more resilient, **not complete**: consent choices, missing data, and other limits can still mean an event is not sent or matched. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) Use one integration owner for each event. In particular, don’t leave a legacy theme Pixel, a tag-manager Pixel, a Meta sales-channel Pixel, and a custom Pixel all firing together. ## 2. Standard events and parameters Use Meta’s standard event names and keep the product identifier consistent across events. For catalog use, `content_ids` must match the ID used for the corresponding item in Meta’s catalog. Shopify’s examples use variant IDs; verify the actual catalog mapping rather than inventing an ID. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/code)) | Meta event | Shopify trigger | Useful parameters | |---|---|---| | **`ViewContent`** | Product detail viewed (`product_viewed`) | `content_ids`: viewed variant’s catalog ID; `content_type: "product"`; `value`: current unit price; `currency`: ISO code such as `USD`; optionally `content_name`. For the Arc Clip Lamp, use the live selected-variant price—not a fixed value if prices or markets can change. | | **`AddToCart`** | Product added to cart (`product_added_to_cart`) | `content_ids`: added variant ID; `content_type: "product"`; `contents: [{id, quantity, item_price}]`; `value`: value of the added line, not the entire cart; `currency`: ISO code. Shopify exposes the cart-line total, variant, and quantity in this event. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/product_added_to_cart?utm_source=openai)) | | **`InitiateCheckout`** | Checkout actually starts (`checkout_started`) | `content_ids` and `contents` for checkout lines; `value`: checkout value using a consistent subtotal/total convention; `currency`: ISO code. Don’t fire merely because someone views the cart. | | **`Purchase`** | Completed checkout (`checkout_completed`) and/or server-side order event | `value`: order total under the chosen convention; `currency`: ISO code; **`content_ids`**: IDs for every purchased catalog item; `content_type: "product"`; and `contents` entries with each item’s ID, quantity, and item price. Include an order identifier for reconciliation and deduplication. | For Purchase, Shopify documents checkout `totalPrice` as the total including duties, taxes, and discounts. Use the same value definition in the browser and server events, and confirm that it agrees with the store’s order totals. Do not hardcode `$68`; the actual purchase may include multiple lamps, discounts, taxes, or other checkout adjustments. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed)) ## 3. Exactly how Pixel/CAPI deduplication works When both sources report the **same customer action**, send: 1. The same event name from both sources—for example, `Purchase`. 2. The same unique ID to the same Meta dataset: - Browser Pixel: `eventID` in the **fourth argument** to `fbq('track', ...)`. - CAPI: `event_id` on the server event. For a Purchase, the Shopify order ID can be the shared ID. In a custom integration, the browser’s Purchase event must use that same order ID—not a separately generated browser UUID. For other shared events, create one ID and pass it to both senders. Meta checks the event name and ID; matching events received within 48 hours are eligible for deduplication. If their contents are not meaningfully different, Meta generally prefers the event received first. ([developers.facebook.com](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)) Browser example: ```js fbq( 'track', 'Purchase', { value, currency, content_ids, content_type: 'product' }, { eventID: String(orderId) } ); ``` The server event must have `event_name: "Purchase"` and `event_id: String(orderId)`. **Matching email, `fbp`, or `fbc` is not a substitute for matching IDs** in the recommended method. Shopify’s native channel is the simpler choice if you don’t want to build and maintain the shared-ID flow yourself. ## 4. Prepare customer information before sending server-side Send only information the store is permitted to share and actually has. For identifiers Meta requires to be hashed, normalize first and then SHA-256 hash the normalized value—for example, trim and lowercase email. Normalize phone and address fields according to Meta’s field-specific requirements; don’t apply one generic cleanup rule to every field. - **Hash before sending:** email (`em`), phone (`ph`), and any other personal-information fields you choose to send that Meta marks as requiring hashing. - **Do not hash:** `fbp`, `fbc`, `client_user_agent`, or `client_ip_address`. Include these only when lawfully available and relevant. Meta identifies `client_user_agent`, `action_source`, and `event_source_url` as required for website CAPI events. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/)) - **Capture context correctly:** the IP address of Shopify’s webhook request is Shopify’s server, not the shopper. Don’t send it as the customer’s IP. If using a custom integration, securely associate consented browser context—such as the shopper’s user agent and available `fbp`/`fbc`—with the order. - **Protect credentials:** keep the Meta access token on the server, never in theme or Pixel code. Hashing is not anonymization or a consent workaround. Treat hashed customer identifiers as sensitive data. ## 5. Shopify setup: native channel vs. custom implementation ### Native Meta sales channel — recommended for this store 1. In Shopify Admin, install/open **Facebook & Instagram by Meta** and connect the appropriate Meta business assets: business portfolio, ad account, catalog, and Pixel/dataset. 2. Go to **Sales channels → Facebook & Instagram → Settings → Data sharing settings** (the label may appear as **Share data settings**). 3. Enable customer data sharing, connect the intended Pixel, and select **Enhanced**. Shopify says Enhanced uses both the Pixel and CAPI; Maximum also uses both and adds Meta’s latest advertising technology. Verify the current description in the store’s admin before choosing a level. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing)) 4. Remove old Meta Pixel snippets from `theme.liquid`, preferences, GTM, and other tracking apps if they duplicate events. Shopify specifically warns that leaving old Pixel code in place can create duplicate or incorrect reporting. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-pixel/?utm_source=openai)) **Why this is the small-store recommendation:** it covers the common Shopify-to-Meta path without Cedar & Coil having to maintain order webhooks, event-ID sharing, hashing, retries, and consent logic. A **custom implementation** is reasonable only if there’s a concrete requirement the native channel cannot meet and someone can own those tasks. If building custom tracking, avoid sending overlapping events through both systems unless deduplication is deliberately implemented. ### Custom server-side Purchase sketch This is an implementation sketch, not a drop-in Shopify app. `order`, `tracking`, and `lineItems` below are normalized values your integration must build from a verified Shopify order event and consented customer context. Validate Shopify’s webhook signature, persist an idempotency record, and retry transient Meta failures without sending the same order repeatedly. For a custom Pixel, the browser Purchase must use the same order ID: ```js // On Shopify's checkout_completed event, after checking the applicable consent: const checkout = event.data.checkout; fbq( 'track', 'Purchase', { value: Number(checkout.totalPrice.amount), currency: checkout.currencyCode, content_ids: checkout.lineItems.map(item => catalogIdFor(item.variant)), content_type: 'product' }, { eventID: String(checkout.order.id) } ); ``` Server-side Node.js example: ```js import { createHash } from "node:crypto"; const sha256 = (value) => createHash("sha256").update(value, "utf8").digest("hex"); async function sendPurchase(order) { // Run only after webhook validation, consent checks, and an idempotency check. // tracking context must come from the shopper's permitted browser/session, // not from the Shopify webhook request's IP or user agent. if (!order.tracking?.marketingAllowed) return; const email = order.email?.trim().toLowerCase(); const eventId = String(order.id); const event = { event_name: "Purchase", event_time: Math.floor(new Date(order.purchaseAt).getTime() / 1000), event_id: eventId, action_source: "website", event_source_url: order.tracking.eventSourceUrl, user_data: { ...(email ? { em: sha256(email) } : {}), client_user_agent: order.tracking.userAgent, ...(order.tracking.fbp ? { fbp: order.tracking.fbp } : {}), ...(order.tracking.fbc ? { fbc: order.tracking.fbc } : {}) }, custom_data: { value: Number(order.total.amount), currency: order.total.currencyCode, content_type: "product", content_ids: order.lineItems.map(item => item.catalogId), contents: order.lineItems.map(item => ({ id: item.catalogId, quantity: item.quantity, item_price: Number(item.unitPrice) })), order_id: eventId } }; const url = `https://graph.facebook.com/${process.env.META_API_VERSION}/` + `${process.env.META_PIXEL_OR_DATASET_ID}/events` + `?access_token=${encodeURIComponent(process.env.META_ACCESS_TOKEN)}`; const response = await fetch(url, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ data: [event], ...(process.env.META_TEST_EVENT_CODE ? { test_event_code: process.env.META_TEST_EVENT_CODE } : {}) }) }); if (!response.ok) { throw new Error(`Meta CAPI error: ${response.status} ${await response.text()}`); } } ``` Map the payload to the current Shopify order schema, use the actual catalog IDs, and ensure the browser/server `value`, `currency`, event name, and order ID agree. The test-event code is for validation only—remove it before live sending. Keep the API version configurable and use a currently supported version. Meta’s website-event parameter requirements and customer-data hashing rules are documented in its CAPI parameter reference. ([developers.facebook.com](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/v25.0/)) ## 6. Validate end to end before scaling spend 1. **Remove duplicate sources** and confirm only the intended Pixel/dataset is connected. 2. **Place a test order** through the actual Shopify storefront and checkout using an appropriate test-payment method. 3. In **Meta Events Manager → Test Events**, verify `ViewContent`, `AddToCart`, `InitiateCheckout`, and `Purchase` arrive with correct names and values. Check currency, content IDs, quantities, and Purchase order value. 4. For the custom setup, verify that browser and server Purchase carry the same event name and shared ID, and that Meta shows the pair as deduplicated. Confirm a repeated webhook or thank-you-page refresh does not create another Purchase. 5. Test with marketing consent granted and denied/opted out. Confirm the integration follows Shopify’s configured privacy permissions in both cases. 6. Compare the test order in Shopify with the event payload and Meta’s received event. Check Events Manager diagnostics and server logs for rejected requests or retries. Shopify’s pixel system supports standard customer events and privacy settings; custom pixel code is an advanced path and requires the implementer to configure consent behavior. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/code)) ## 7. Consent and compliance CAPI is **not** a way around browser consent or an opt-out. Configure Shopify’s customer privacy settings and consent banner so the Pixel and any custom server sender respect the shopper’s permissions; store and apply the relevant permission state before sending order data. Shopify documents that pixels honor configured privacy signals, and its Meta integration requires Cedar & Coil to explain its data sharing in the privacy policy. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/code)) Applicable rules vary by where the store and customers are located. Some regions require opt-in consent for tracking; some US state laws provide opt-out rights for targeted advertising or sale/sharing of personal data. Minimize what is sent, document retention and deletion handling, and have counsel review the setup. **Do not promise a particular percentage of attribution recovery**: results depend on consent, available signals, browser behavior, matching, and Meta’s processing.
Score · attempt 3 the judge's verdict, criterion by criterion11/11 criteria passed
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends the Pixel plus CAPI to the same dataset and explains that ad blockers can block Pixel requests, that server-to-server sends are more resilient, and that consent limits still apply.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The section 2 table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase lists value, currency, content_ids, content_type and contents.
code_sketch
A concrete server-side Purchase event code sketch or request example is included showing event_name, event_time, event_id, action_source, and a user_data block.
✓The Node.js sendPurchase sketch builds an event with event_name, event_time, event_id, action_source: "website" and a user_data block, and POSTs it to the /events endpoint.
validation
End-to-end validation is described using Meta's Events Manager test events tool and an explicit check that duplicate browser/server events are being deduplicated.
✓Section 6 uses Meta Events Manager Test Events and says to verify that browser and server Purchase share an event name and ID and that Meta shows the pair as deduplicated.
sources_defined
For each event it is clear where it fires (browser vs server) and what the source of truth is (e.g. Purchase from the Shopify order webhook/server, not only the thank-you page).
✓Section 1 puts ViewContent, AddToCart and InitiateCheckout in the browser and the completed Purchase on the server, and the sketch builds it from a verified Shopify order event; the table's "checkout_completed and/or server-side order event" is slightly loose.
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 "Do not promise a particular percentage of attribution recovery", calls the setup "not complete", and says CAPI is not a way around consent and that rules vary by region.
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓Section 3 requires the same event name and the same ID in the browser fbq eventID and the CAPI event_id, shows both code forms, and says matching email/fbp/fbc is not a substitute.
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.
✓event_id is derived from the Shopify order ID (String(order.id)) in both browser and server code, and the sketch adds an idempotency record and retries without re-sending the same order.
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.purchaseAt).getTime()/1000), the order's own timestamp in Unix seconds rather than the send time, so a retry reuses the same value, though the guide never says so explicitly.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓Section 4 and the code trim and lowercase the email and then SHA-256 hash it (em: sha256(email)), and say fbp, fbc, user agent and IP are not hashed.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓It recommends the native Facebook & Instagram by Meta channel with Enhanced data sharing, gives numbered setup steps including removing duplicate pixels, and states when custom would be justified.