← Run 20261123-050555-a3de92b9
Shopify to Meta ads conversion tracking implementation
task shopify-meta-capiNov 23, 2026

Answers & verdicts

GPT-6.2 Sol medium effort

Task failed
Task the exact prompt the model was given — assignment and source material
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.
Answer the model's full response$0.033 · 42.2s · 3.2k tok
# Cedar & Coil draft implementation guide: Shopify → Meta conversion tracking ## 1. Recommended architecture: Meta Pixel + Conversions API Use Shopify’s **Facebook & Instagram by Meta** sales channel to connect the Arc Clip Lamp store to one Meta dataset. Start with the native integration rather than running a separate Pixel or server implementation alongside it. - **Browser — Meta Pixel:** Records product views, cart actions, checkout starts, and purchases when the browser and the shopper’s consent choices permit it. It also captures browser context that can help Meta match events. - **Server — Conversions API (CAPI):** Sends supported commerce events directly from Shopify’s servers to Meta. The server path is particularly valuable for `Purchase`: it does not depend on a browser script running on the order confirmation page. - **Deduplication:** When both paths report the same action, Meta should count it once. Both paths must use the same dataset, event name, and event ID. The two paths are complementary. CAPI reduces dependence on browser delivery, but it does not bypass consent, guarantee a match to a Meta account, or guarantee ad attribution. An event received by Meta is not necessarily a conversion attributed to an ad. ## 2. Standard events and parameters Use Meta’s standard event names exactly as written. For every `content_ids` entry, use the **exact item ID in the connected Meta catalog**. Check the catalog before choosing an identifier: a Shopify product ID, variant ID, SKU, and Meta catalog item ID are not necessarily interchangeable. | Event | When to send | Key parameters | |---|---|---| | `ViewContent` | The Arc Clip Lamp product detail page is viewed. | `content_ids` for the viewed item, `content_type: "product"`, `value` for the displayed item price, and `currency`. | | `AddToCart` | The item is successfully added, not just when someone clicks the button. | `content_ids`, `content_type`, `contents` with item IDs and quantities added, `value` for the items added in that action, and `currency`. | | `InitiateCheckout` | The shopper starts checkout. | All checkout item IDs in `content_ids`, `content_type`, `contents` with quantities, `num_items` as the sum of quantities, checkout `value`, and `currency`. | | `Purchase` | An order meets the store’s chosen purchase milestone. For a custom build, use the same milestone on both paths. | **`value`**, **`currency`**, and **`content_ids`** for all purchased items; also send `content_type` and `contents` with quantities and item prices. An `order_id` can help with reconciliation but is not the deduplication key. | Send `value` as a number in major currency units and `currency` as an uppercase ISO 4217 code, such as `USD`. For `Purchase`, use the actual order amount and currency, not a hard-coded `68`. Document how your reporting treats discounts, shipping, and tax, and verify the resulting value against Shopify. A single lamp with a final total of $68.00 USD should arrive as `value: 68` and `currency: "USD"`. ## 3. How Pixel–CAPI deduplication works Meta matches browser and server copies when they arrive at the **same dataset** with the **same event name** and the **same event ID** within its deduplication window, documented as 48 hours. Send both promptly; don’t use that window as a delivery target. For one purchase, the browser call might look like: ```js fbq("track", "Purchase", purchaseParams, { eventID: "purchase:1234567890" }); ``` The corresponding CAPI event must include: ```json { "event_name": "Purchase", "event_id": "purchase:1234567890" } ``` `eventID` is the Pixel option; `event_id` is the top-level CAPI event field. In a custom build, derive the ID on both sides from the same canonical order identifier, or pass a shared ID between them. Normalize the identifier consistently: a Shopify order GID on one side and its numeric suffix on the other will not match unless you convert them to the same format. Reuse the ID for webhook retries and confirmation-page reloads, and use a different ID for each distinct purchase. Don’t generate independent random IDs in the browser and server, or rely on `order_id`, email, or matching order values to deduplicate. Also make the server delivery idempotent so webhook redelivery does not trigger a fresh conversion. With the native integration, let the app own the IDs; don’t add another `Purchase` sender. ## 4. Preparing customer information for CAPI Send only customer information you’re permitted to use for advertising measurement. In a custom implementation: - **Normalize, then SHA-256 hash** fields Meta expects hashed. For `em`, trim surrounding whitespace and lowercase the email. For `ph`, include the country calling code and strip the `+`, spaces, and punctuation so only digits remain. If using other supported fields, apply Meta’s field-specific normalization rules before hashing. Hash once; omit missing or invalid fields rather than hashing empty strings. - **Do not hash** `fbp`, `fbc`, `client_ip_address`, or `client_user_agent`. If collected and permitted, pass the browser identifiers in Meta’s expected format. Don’t fabricate `fbc` when there’s no genuine Meta click identifier. If you send IP and user agent, use the shopper’s actual browser context, not the Shopify webhook sender’s or your worker’s. - Keep raw customer data, hashed identifiers, and access tokens out of routine logs. Sanitize `event_source_url` so it does not expose customer details or checkout secrets. Treat hashes as customer data, not as anonymous data. The native app handles payload preparation. Your job is to verify its settings and consent behavior, not to pre-hash Shopify customer records. ## 5. Shopify setup: native app vs. custom implementation ### Recommended for Cedar & Coil: the native Meta sales channel 1. In **Shopify Admin → Sales channels**, open **Facebook & Instagram**. If it isn’t installed, add **Facebook & Instagram by Meta** from the Shopify App Store. 2. Complete onboarding and connect the correct Meta business portfolio, ad account, catalog, and dataset/Pixel. Record the dataset ID and confirm it is the one the ad account will use. 3. In **Facebook & Instagram → Settings → Data sharing settings**, enable customer data sharing and select the connected dataset. Choose **Maximum** if approved under Cedar & Coil’s consent and data-use policy. Shopify offers **Standard**, **Enhanced**, and **Maximum**; verify the current description in the app and confirm server-side `Purchase` in Events Manager. Don’t assume every funnel event will be sent by both paths. 4. In **Shopify Admin → Settings → Customer privacy**, configure the applicable regions and consent experience. If using a third-party banner, confirm that it integrates with Shopify’s customer privacy controls. 5. Audit **Settings → Customer events**, theme scripts, tag managers, and existing apps for duplicate Meta senders. Retire redundant senders after confirming the native connection works. Check that the Arc Clip Lamp’s catalog item ID matches the ID sent in events. ### When to build a custom integration Build custom only if you need something the native app can’t support, such as a different purchase milestone or checkout flow. Use Shopify’s **Customer Events / Web Pixels** for supported browser events rather than injecting checkout theme scripts. On the server, verify Shopify webhook signatures against the raw request body and queue eligible orders for delivery. Make sure the worker can retrieve the consent decision associated with that checkout; a webhook is not evidence of consent. For example, if `Purchase` means **payment confirmed**, use the paid-order webhook. Send a browser copy only if the browser can confirm that same milestone and use the same order ID. For delayed payments, an eligible server-only `Purchase` is better than a premature browser event at checkout completion. **Draft code sketch — custom path only. Do not deploy alongside the native Purchase sender.** The worker below assumes a verified webhook, a normalized order record, and an eligibility decision tied to the checkout. ```js async function sendPurchase(order, consent, match, testEventCode) { if (!consent.metaMeasurementAllowed || !order.paidAt) return; const sha256 = s => createHash("sha256").update(s, "utf8").digest("hex"); const email = match.email?.trim().toLowerCase(); const user_data = { ...(email ? { em: [sha256(email)] } : {}), ...(match.fbp ? { fbp: match.fbp } : {}), ...(match.fbc ? { fbc: match.fbc } : {}) }; if (!Object.keys(user_data).length) return; const event = { event_name: "Purchase", event_time: Math.floor(Date.parse(order.paidAt) / 1000), event_id: `purchase:${order.canonicalId}`, // Same ID on Pixel, if sent action_source: "website", event_source_url: order.sanitizedSourceUrl, user_data, custom_data: { order_id: order.canonicalId, value: order.totalInMajorUnits, currency: order.currency, content_type: "product", content_ids: order.lines.map(line => line.metaCatalogId), contents: order.lines.map(line => ({ id: line.metaCatalogId, quantity: line.quantity, item_price: line.unitPriceInMajorUnits })) } }; const response = await fetch( `https://graph.facebook.com/${GRAPH_API_VERSION}/${DATASET_ID}/events`, { method: "POST", headers: { Authorization: `Bearer ${CAPI_ACCESS_TOKEN}`, "Content-Type": "application/json" }, body: JSON.stringify({ data: [event], ...(testEventCode ? { test_event_code: testEventCode } : {}) }) } ); const result = await response.json(); if (!response.ok || result.events_received !== 1) { throw new Error(`CAPI did not acknowledge Purchase (HTTP ${response.status})`); } } ``` Import `createHash` from `node:crypto`, pin a supported Graph API version, and keep the token in a server-side secret store. Validate order amounts, timestamps, currency, and catalog IDs before sending. Retry transient failures with the original `event_id` and `event_time`; route persistent errors for review. An API acknowledgment confirms receipt, not deduplication or attribution. ## 6. Validate end to end before scaling spend 1. **Walk the funnel with consent granted.** Open the lamp page, add it to the cart, start checkout, and place a controlled order. Use Meta Pixel Helper to inspect browser events where visible. In **Meta Events Manager → Test Events**, inspect event names, sources, parameters, and IDs where the integration exposes them. A custom sender can use `test_event_code`; if the native app doesn’t expose that control, use the dataset’s event details and Diagnostics. Some integrations may not forward Shopify test-mode orders, so verify that before interpreting a missing `Purchase`. 2. **Check one order against both systems.** Compare Shopify’s final order total, currency, quantities, and catalog IDs with Meta’s event details. Where both sources send `Purchase`, confirm the same event ID and look for deduplication rather than two counted purchases. Reload the confirmation page; for a custom integration, also replay the webhook in a controlled test. 3. **Test browser loss and denied consent separately.** In a consented session, block the Pixel request and confirm an eligible server `Purchase` still arrives. In a separate session, decline advertising consent and confirm that neither route sends events that require that consent. A successful server event in the first test is not a reason for one to appear in the second. 4. **Review Diagnostics before increasing spend.** Look for missing parameters, catalog mismatches, deduplication warnings, and server failures. Compare eligible Shopify orders with Meta’s received events over the same period, allowing for processing delays. Use Ads Manager to evaluate attribution separately; don’t expect it to equal Shopify order totals. ## 7. Consent and compliance Treat the Pixel and CAPI as two delivery paths for the same advertising measurement purpose. Apply the relevant consent, opt-out, and data-use rules to **both**. Don’t use CAPI to restore signals a shopper declined to share. Confirm the store’s privacy notice describes the Meta integration, limit payloads to necessary fields, and restrict access to tokens and event data. Have the store’s privacy owner approve the regional settings and test results before launch. This is a draft implementation plan; it does not imply that tracking or campaigns are live.
Score the judge's verdict, criterion by criterion10/11 criteria passed · failed: sources_defined
RequirementVerdictEvidence
architecture
The guide recommends browser Pixel plus server-side Conversions API with deduplication and explains why both are needed under browser privacy limits.
✓Section 1 recommends Pixel plus CAPI with deduplication and says CAPI "does not depend on a browser script running on the order confirmation page" and reduces dependence on browser delivery, so both paths are complementary.
events_mapped
All four standard events (ViewContent, AddToCart, InitiateCheckout, Purchase) are covered with key parameters, including value, currency, and content_ids on Purchase.
✓The table covers ViewContent, AddToCart, InitiateCheckout and Purchase with parameters, and Purchase explicitly lists value, currency and content_ids.
code_sketch
A concrete server-side Purchase event code sketch or request example is included showing event_name, event_time, event_id, action_source, and a user_data block.
✓The 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 dataset /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 for custom senders) and says to confirm the same event ID and look for deduplication rather than two counted purchases.
sources_defined
For each event it is clear where it fires (browser vs server) and what the source of truth is (e.g. Purchase from the Shopify order webhook/server, not only the thank-you page).
✗Only Purchase has a clear source of truth (paid-order webhook in the custom path); the table gives "when to send" for ViewContent, AddToCart and InitiateCheckout but never says whether each fires in the browser or on the server, and the native-app line says only "Don't assume every funnel event will be sent by both paths."
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 gives no attribution-recovery percentages, says CAPI does not "guarantee ad attribution", and Section 7 says consent and regional rules apply to both paths and that CAPI must not restore declined signals.
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 dataset, event name and event ID, shows Pixel eventID and CAPI event_id both as "purchase:1234567890", and gives the 48-hour window.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓The ID is derived from the canonical order identifier shared by browser and server, and the text says "Reuse the ID for webhook retries" and to "Retry transient failures with the original `event_id` and `event_time`".
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 sketch sets event_time to Math.floor(Date.parse(order.paidAt) / 1000), which is the order's paid timestamp in Unix seconds, and the guide says to keep the original event_time on retries.
pii_hashing
Customer data handling is correct: personally identifiable fields (e.g. email) are normalized (trimmed, lowercased) and SHA-256 hashed before sending in user_data.
✓Email is trimmed, lowercased and SHA-256 hashed in both the text and the code, phone normalization is described, and fbp, fbc, IP and user agent are correctly 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 for Cedar & Coil with five concrete admin steps and reserves a custom build for specific needs.