← Run 20261118-005654-d8bda826
Shopify to Meta ads conversion tracking implementation
task shopify-meta-capiNov 18, 2026Models on marketing tasks Model only

Answers & verdicts

Claude Haiku 5.5 high 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.017 · 84.4s · 18.7k tok
# Cedar & Coil: Arc Clip Lamp Meta Conversion Tracking Guide **Scope:** Pre-launch. No campaign has run and no performance data exists, so every check below is a setup test, not a result. I can't give expected attribution-recovery percentages, so measure your own before and after. ## 1. Recommended architecture: Pixel plus Conversions API, deduplicated Run the browser Meta Pixel and the server-side Conversions API (CAPI) together from the same Shopify store. Send the same event name and the same event ID through both paths, and let Meta deduplicate them. **Why both are needed:** - **The browser Pixel** sees on-page behavior (product views, add-to-cart, checkout start) and carries the `_fbp` and `_fbc` browser cookies that help Meta match people to accounts. Meta recommends running CAPI alongside the Pixel rather than instead of it, as Meta recommends running the Conversions API together with the Pixel, not instead of it. - **CAPI** sends events from your server, so it does not depend on a browser script loading or on a cookie surviving. Browser restrictions such as ad blockers, script blocking, and cookie lifetime limits can cut into what the Pixel sees. Server events also carry confirmed order fields. The two sources are complementary, not alternatives: the Pixel fires from the browser and CAPI fires from the server. - **Each path covers the other's gaps.** If the browser event is lost, the server event may still arrive. Deduplication prevents double-counting when both arrive. ## 2. Standard events and key parameters Send these four events. Use the same `content_ids` values as your Meta product catalog so Dynamic Product Ads can match them. content_ids must match the product IDs in your Meta product catalog for Dynamic Product Ads retargeting to work. | Event | Fires when | Key parameters | |---|---|---| | ViewContent | Arc Clip Lamp product page loads | `content_ids`, `content_type: 'product'`, `value`, `currency` | | AddToCart | Shopper adds the lamp (or a variant) to cart | `content_ids`, `content_type`, `value`, `currency` | | InitiateCheckout | Checkout begins | `content_ids`, `num_items`, `value`, `currency` | | Purchase | Order confirmed (thank-you or checkout-completed step) | `value`, `currency`, `content_ids`, `content_type`, `num_items`, `contents`, `event_id`, `order_id` | **Value and currency rules:** - **Purchase `value`** should represent the total basket value, which Meta defines as the total basket value, including other fees, such as shipping fee and tax. Some practitioners send the subtotal instead. Pick one definition, document it, and use it identically in the Pixel and CAPI. Reconcile it against Shopify's order total. - **AddToCart `value`** is not the cart total. Meta defines it as the value of new items added to cart at once. It's not the current total basket value. - **`currency`** must be an ISO 4217 code such as `USD`. Read it from the order rather than hardcoding it. - **Purchase** is the event where `value` and `currency` matter most. Leave them out and Meta optimises on pure count, so a small order and a large order look the same. - **`content_ids`** on Purchase should list every line item's catalog ID. Use the variant-to-catalog mapping, not a placeholder. The sample catalog ID `REPLACE_WITH_CATALOG_ID` in the code below must be replaced. Event names are case-sensitive. Use exactly `Purchase`, `AddToCart`, and so on. ## 3. How deduplication works Meta deduplicates on two fields together: the event name and the event ID. - **Pixel side:** pass the ID as the fourth argument to the track call. Note that the eventID parameter for the Pixel is the fourth argument in the fbq track call. - **Server side:** send the same value as `event_id` in the CAPI payload. - **Matching rule:** Meta deduplicates a pixel event and a server event only when eventID matches event_id and the event names match, within 48 hours of the first event received. - **Window:** deduplication applies within 48 hours of the first event Meta receives with that ID, so a delayed server retry still matches. - **Scope:** deduplication only matters for events sent from both sources. If you are sending different event types from the client and server with no overlap between the two, then deduplication is not necessary. **Generate the ID once, from the order.** The most common failure is each side inventing its own ID. One source describes the failure directly: The theme or tag manager generates something for the browser event, and the server integration generates something else... It counts both, and your reported revenue doubles. The fix is to derive the ID from the order on both sides: - Purchase: `purchase_{order_id}`, the same string in the pixel call and the server payload. - Keep it a string, with identical casing and no whitespace. - Retries on the server produce the same ID, so retries do not create new purchases. **Other ways to break dedup:** - Two Pixel sources firing the same Purchase. Shopify warns that before you add a custom pixel, remove or modify any existing pixels to ensure customer events aren't counted twice. - Mismatched event names (`purchase` vs `Purchase`). - Pixel and CAPI sent to different Pixel/dataset IDs, since deduplication happens within a single Pixel ID and a limited time frame. ## 4. Preparing customer information for server-side sends Customer information parameters (`user_data`) are how Meta matches a server event to an account. Each event needs at least one of them. Contact fields must be normalized and hashed. **Normalize, then hash with SHA-256 (lowercase hex digest of UTF-8 text):** | Field | Normalization | |---|---| | `em` (email) | Trim whitespace and lowercase. Email: trim leading and trailing spaces and convert to lowercase. | | `ph` (phone) | Digits only, with country code, leading zeros removed. A US number like (650) 555-1212 becomes 16505551212 before hashing. | | `fn`, `ln`, `ct`, `st`, `zp` | Lowercase, trimmed. Check Meta's current Customer Information Parameters page for character rules. | | `country` | Lowercase two-letter ISO code. Country: the lowercase two-letter ISO 3166-1 code, such as us. | | `external_id` | Your customer ID, hashed. Hashing recommended: external ID, your own customer identifier such as a loyalty or user ID. | **Do not hash these:** - `client_ip_address`: the visitor's IP. - `client_user_agent`: the visitor's own browser user agent. Send the visitor's original browser user agent, never the one belonging to the webhook sender or your own HTTP client. - `fbp` and `fbc`: the browser cookie values, sent as received. Meta is strict about this. Any other customer information parameters that are not hashed are automatically rejected by Facebook. **Other requirements for website events:** - `event_source_url`: the page where the event happened. The thank-you page for Purchase. - `client_user_agent`: the fields client_user_agent and event_source_url are required for website events. - `event_time`: Unix seconds, within the allowed window. A Conversions API event_time can be up to seven days old; one older event in a request makes the whole request fail. Check how queued or retried events are timestamped. - Capture `_fbp` and `_fbc` in the browser at checkout and pass them to the server. A server-side webhook has no access to browser cookies. ## 5. Shopify setup path ### Option A: Native Facebook & Instagram sales channel Install the official channel from Settings > Sales channels, connect your Business portfolio, Page, Ad Account, and dataset (Pixel), and set Customer data sharing to Enhanced or Maximum. Standard sharing does not send server events. Of the three data sharing levels, Standard uses only the Meta pixel; Enhanced and Maximum also use the Conversions API. Maximum uses the Conversions API and the pixel and, in Shopify's words, is updated with Facebook's latest advertising technology. Shopify notes the options offer different privacy settings depending on when you installed the channel. Check what your install actually offers. Deduplication is handled for you. One source says Shopify automatically passes order IDs as the event_id parameter for deduplication. Confirm this in your own Diagnostics and deduplication views rather than assuming it. ### Option B: Custom implementation A custom web pixel (Settings > Customer events) subscribes to Shopify's checkout events and forwards the Purchase to your own endpoint, which calls CAPI directly. You control the parameters and hashing. You also own retries, token storage, API version upgrades, error monitoring, and consent logic. ### Comparison | | Native channel | Custom | |---|---|---| | Developer needed | No | Yes, ongoing | | Dedup | Handled by the channel (verify) | You build and verify it | | Parameter control | Limited to what the channel sends | Full | | Maintenance | Low; Shopify and Meta maintain it | High | | Risk of duplicate sources | Low if you remove other Meta pixels | Higher; you must remove old pixels | ### Recommendation For a small DTC store with one product and no developer on staff, use the native Facebook & Instagram channel with Maximum data sharing, if your install offers it. Remove any theme snippets, legacy Meta Pixel code, and other Meta app pixels so only one browser source fires. Add custom code only if you find a required parameter or event the native channel does not send. Then verify everything in section 6. ### Code sketch: server-side Purchase to CAPI (custom path) This is a sketch, not production code. It assumes a trusted server receives the order and browser context from your Shopify custom web pixel. Replace the API version and placeholders, and confirm the current version in Meta's docs. ```js import { createHash } from 'node:crypto'; const DATASET_ID = process.env.META_DATASET_ID; // Events Manager pixel/dataset ID const ACCESS_TOKEN = process.env.META_CAPI_TOKEN; // server secret, never sent to the browser const API_VERSION = 'v25.0'; // confirm current version in Meta docs const sha256 = (s) => createHash('sha256').update(s, 'utf8').digest('hex'); const normEmail = (s) => s.trim().toLowerCase(); const normPhone = (s, cc) => { // cc = country calling code digits, e.g. '1' const digits = s.replace(/\D/g, ''); if (s.trim().startsWith('+')) return digits; // already has country code return cc + digits.replace(/^0+/, ''); }; export async function sendPurchaseToMeta({ order, browser, marketingConsent }) { if (!marketingConsent) return { skipped: 'no marketing consent' }; const user_data = {}; if (order.email) user_data.em = [sha256(normEmail(order.email))]; if (order.phone) user_data.ph = [sha256(normPhone(order.phone, '1'))]; if (order.firstName) user_data.fn = [sha256(order.firstName.trim().toLowerCase())]; if (order.lastName) user_data.ln = [sha256(order.lastName.trim().toLowerCase())]; if (order.countryCode) user_data.country = [sha256(order.countryCode.toLowerCase())]; user_data.external_id = [sha256(String(order.customerId))]; // Not hashed: user_data.client_ip_address = browser.ip; user_data.client_user_agent = browser.userAgent; if (browser.fbp) user_data.fbp = browser.fbp; if (browser.fbc) user_data.fbc = browser.fbc; const lineItems = order.lineItems; const body = { data: [{ event_name: 'Purchase', // must match the pixel event name event_time: Math.floor(new Date(order.processedAt).getTime() / 1000), event_id: `purchase_${order.id}`, // must equal the pixel eventID action_source: 'website', event_source_url: browser.pageUrl, // thank-you page URL user_data, custom_data: { currency: order.currency, // ISO 4217, e.g. 'USD' value: Number(order.total), // total basket, per your documented definition content_type: 'product', content_ids: lineItems.map(li => li.catalogId), // REPLACE_WITH_CATALOG_ID mapping contents: lineItems.map(li => ({ id: li.catalogId, quantity: li.quantity, item_price: Number(li.unitPrice), })), num_items: lineItems.reduce((n, li) => n + li.quantity, 0), order_id: String(order.id), }, }], // test_event_code: process.env.META_TEST_EVENT_CODE, // only while testing }; const url = `https://graph.facebook.com/${API_VERSION}/${DATASET_ID}/events?access_token=${ACCESS_TOKEN}`; const res = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), }); if (!res.ok) throw new Error(`CAPI ${res.status}: ${await res.text()}`); return res.json(); } ``` Browser side, in the same Purchase flow, uses the identical ID. The `eventID` goes in the fourth argument, using the same `purchase_{order_id}` value: ```js fbq('track', 'Purchase', { value: orderTotal, currency: 'USD', content_ids: [...], content_type: 'product', num_items: n }, { eventID: `purchase_${orderId}` }); ``` ## 6. Validating end to end before scaling spend 1. **Inventory every Meta source.** Remove legacy pixel code from the theme, "Additional scripts," and any apps that add a second Meta pixel. Keep one browser source. 2. **Test Events.** In Events Manager, open Test Events, set a test event code on the server side only while testing, and browse the product page. Confirm ViewContent, AddToCart, and InitiateCheckout arrive, and that the Pixel and server sources both show. 3. **Test order.** Use Shopify's test payment options and place one full order. Confirm one Purchase per order from each source, both showing the same event ID. 4. **Deduplication check.** In the Event Details for Purchase, open the Event Deduplication tab. One source advises to trace a test purchase in Test events, then monitor the Event Deduplication tab. 5. **Payload audit.** Confirm hashed `em` and `ph`, unhashed `fbp`, `fbc`, IP, and user agent, `event_source_url`, and `value` and `currency` matching the Shopify order total. 6. **Match quality.** Check Event Match Quality for Purchase. One source suggests a target Event Match Quality should aim for 6.0 or higher. Treat this as a guide, not a guarantee. 7. **Reconciliation.** For a set of test orders, confirm one Purchase per Shopify order ID, with value and currency matching. 8. **Failure tests.** Send an event with an old `event_time` and an invalid token in a staging environment. Confirm your logs capture the errors and that a retry does not create a second purchase. 9. **Consent tests.** Decline marketing and confirm the Pixel does not load and no server event is sent. Accept and confirm both fire. 10. **Limited live soak.** Run a small live budget and check daily that counts match orders and dedup is clean. Scale only after several consecutive clean days. Set your own thresholds. ## 7. Consent and compliance note This is operational guidance, not legal advice. Have counsel review it for your markets. - **Shopify consent controls the browser Pixel.** Custom pixels can require customer permission, and custom pixels on the checkout page will not fire for visitors who have declined marketing or analytics consent. - **Server events need the same consent logic.** Shopify states that server pixels are still subject to your store's customer privacy and consent settings. Store the consent state with the order, and skip the CAPI call when marketing consent is absent, as in the code sketch. - **Your cookie banner must sync to Shopify.** If you use a third-party tool to manage consent, such as a cookie banner app, then that tool must sync consent to Shopify through the Customer Privacy API. If consent isn't synced to Shopify, then your pixels might not fire even after a customer provides consent. - **Hashing is not anonymization.** Hashing is pseudonymization, not anonymization: a hashed email is still tied to a person, and consent and data-protection obligations still apply. - **Meta's use of data.** Meta uses customer information for the purposes described in its Business Tools Terms, including ads attribution and ads delivery optimization. - **Data sale settings.** Review the data sale permission on each pixel in Shopify. Custom pixels let you customize whether data collected qualifies as data sale. - **Privacy policy.** Disclose the Meta Pixel and server-side event sharing in your policy, and send only the fields you actually need. - **Ad copy.** Keep ads within the approved facts and CTA (Explore the Arc Clip Lamp). Don't imply that tracking or optimization guarantees results. **Verify before launch:** API versions, the current Customer Information Parameters rules, and the Shopify channel's data-sharing options change over time. Check Meta's and Shopify's current documentation when you build.
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 the browser Pixel plus CAPI with deduplication and explains why both are needed, citing ad blockers, script blocking and cookie lifetime limits.
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 JS sketch builds a payload with 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 and the Event Deduplication tab, and checks that Pixel and server events share the same event ID.
sources_defined
For each event it is clear where it fires (browser vs server) and what the source of truth is (e.g. Purchase from the Shopify order webhook/server, not only the thank-you page).
✗The table gives only 'Fires when' triggers, not browser versus server per event; Purchase is 'thank-you or checkout-completed step', and the sketch takes the order from a custom web pixel, not stating the Shopify order webhook as the source of truth.
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 scope note says 'I can't give expected attribution-recovery percentages', and section 7 treats consent and Shopify privacy settings as constraints on what is sent.
dedup_correct
Deduplication is technically correct: the same event_id and event_name sent on both the Pixel and CAPI event so Meta drops the duplicate; not a vague mention.
✓Section 3 says the same event name and event_id on both Pixel (fourth fbq argument) and CAPI, within 48 hours, and the code sketch and browser snippet use the same ID.
event_id_retry_stability
The event_id is generated or derived once per commerce event, shared by browser and server, and reused unchanged on webhook retries or order updates; a new random suffix per send or retry fails.
✓The ID is derived from the order as `purchase_{order_id}` on both sides, and the guide says 'Retries on the server produce the same ID'.
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(new Date(order.processedAt).getTime()/1000), the order timestamp in Unix seconds rather than send time, so retries keep 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.
✓Section 4 and the code trim and lowercase email and other fields, hash them with SHA-256, and leave IP, user agent, fbp and fbc unhashed.
actionable_path
The recommended Shopify path is decisive and executable for a small DTC store (a clear recommendation with concrete setup steps, not an undifferentiated list of options).
✓It compares native and custom options in a table, then recommends the native channel with Maximum data sharing and steps such as removing legacy pixels and verifying in Diagnostics.