# Cedar & Coil: Shopify-to-Meta Conversion Tracking Guide
## 1. Recommended architecture: Meta Pixel + Conversions API
Use one Meta dataset/pixel with two coordinated event paths:
```text
Shopify storefront/checkout
│
├── Browser path: Meta Pixel
│ └── Immediate storefront and checkout events
│
└── Server path: Meta Conversions API
└── Events sent by Shopify or Cedar & Coil’s server
│
└── Meta deduplicates matching copies
```
### Why both are needed
**The browser Meta Pixel provides:**
- Immediate, low-latency interaction signals.
- Browser context such as the page URL, user agent, `_fbp`, and `_fbc`.
- Straightforward coverage for product views, cart actions, and checkout starts.
**Conversions API provides:**
- A second path that is less dependent on the browser, thank-you page, ad blockers, or client-side script execution.
- A reliable server-triggered `Purchase` from the Shopify order lifecycle.
- Better access to permitted customer matching fields from the completed order.
Shopify’s native Meta integration supports the Meta Pixel and Conversions API at its Enhanced and Maximum data-sharing levels. Shopify specifically notes that server-to-server events are not blocked by browser-based ad blockers. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai))
CAPI should **supplement, not replace, the Pixel**. The Pixel has useful browser and click context that an order webhook might not contain, while CAPI can still report a completed order when the browser event is unavailable. CAPI is not a mechanism for bypassing consent.
### Operating rule
For any customer action sent through both paths:
1. Send the same Meta standard event name.
2. Send the same unique event ID.
3. Send both copies to the same Meta dataset/pixel.
4. Let Meta deduplicate them.
---
## 2. Events and required parameters
Use Meta’s standard event names exactly as written:
| Meta event | Shopify trigger | Recommended parameters |
|---|---|---|
| `ViewContent` | Product detail page for the Arc Clip Lamp | `content_ids`, `content_type`, `content_name`, `value`, `currency`, optionally `contents` |
| `AddToCart` | Arc Clip Lamp is successfully added to the cart | `content_ids`, `content_type`, `value`, `currency`, `contents` |
| `InitiateCheckout` | Customer begins Shopify checkout | `content_ids`, `content_type`, `value`, `currency`, `contents`, `num_items` |
| `Purchase` | Completed or paid Shopify order, according to the chosen purchase definition | `content_ids`, `content_type`, `value`, `currency`, `contents`, `order_id` |
Shopify exposes corresponding customer events named `product_viewed`, `product_added_to_cart`, `checkout_started`, and `checkout_completed`. The completed-checkout payload includes the order, line items, total price, currency, and customer information where the integration has the required protected-data access. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events?utm_source=openai))
### `ViewContent`
Trigger when the Arc Clip Lamp product detail page is viewed.
```json
{
"content_ids": ["<META_CATALOG_ITEM_ID>"],
"content_type": "product",
"content_name": "Arc Clip Lamp",
"value": 68.00,
"currency": "USD",
"contents": [
{
"id": "<META_CATALOG_ITEM_ID>",
"quantity": 1,
"item_price": 68.00
}
]
}
```
Use the live product or variant price rather than permanently hardcoding `$68` if discounts, markets, or product pricing can change.
### `AddToCart`
Trigger only after Shopify confirms that the cart operation succeeded—not merely when the button is clicked.
```json
{
"content_ids": ["<META_CATALOG_ITEM_ID>"],
"content_type": "product",
"value": 68.00,
"currency": "USD",
"contents": [
{
"id": "<META_CATALOG_ITEM_ID>",
"quantity": 1,
"item_price": 68.00
}
]
}
```
If two lamps are added in one action, use quantity `2` and a value of `136.00`.
### `InitiateCheckout`
Use the entire checkout, not just the Arc Clip Lamp line that led to it.
```json
{
"content_ids": ["<META_CATALOG_ITEM_ID>"],
"content_type": "product",
"value": 68.00,
"currency": "USD",
"num_items": 1,
"contents": [
{
"id": "<META_CATALOG_ITEM_ID>",
"quantity": 1,
"item_price": 68.00
}
]
}
```
Meta’s server-side data model identifies `num_items` as an `InitiateCheckout` parameter. ([github.com](https://github.com/facebook/facebook-nodejs-business-sdk/blob/main/src/objects/serverside/custom-data.js))
### `Purchase`
Build this from the actual Shopify order:
```json
{
"content_ids": ["<META_CATALOG_ITEM_ID>"],
"content_type": "product",
"value": 73.61,
"currency": "USD",
"order_id": "gid://shopify/Order/1234567890",
"contents": [
{
"id": "<META_CATALOG_ITEM_ID>",
"quantity": 1,
"item_price": 68.00
}
]
}
```
Requirements:
- **`value`:** Use the actual order/checkout total according to one documented rule. Shopify’s native integration uses the total including applicable duties, taxes, and discounts. Do not simply send `$68` if tax, shipping, discounts, or multiple quantities changed the final total. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai))
- **`currency`:** Use the order’s ISO currency, normally `USD`.
- **`content_ids`:** Include every purchased catalog item ID.
- **`contents`:** Include each item’s catalog ID, quantity, and item price.
- **`order_id`:** Use Shopify’s stable order ID.
- **`content_type`:** Usually `product` for product or variant-level catalog items.
Meta supports `content_ids`, `contents`, `content_type`, `value`, `currency`, and `order_id` in CAPI custom data. ([github.com](https://github.com/facebookincubator/Facebook-Server-Side-API-Swagger/blob/main/server-side-api.yaml?utm_source=openai))
### Critical catalog-ID rule
`content_ids` must exactly match the item identifiers in Cedar & Coil’s Meta catalog. Do not mix:
- Shopify product IDs,
- Shopify variant IDs,
- SKUs,
- GraphQL GIDs, and
- catalog-generated IDs.
Choose the identifier format used by the synced Meta catalog and apply it consistently to all four events. Inspect an Arc Clip Lamp item in Commerce Manager to confirm the exact ID.
---
## 3. Exactly how Pixel–CAPI deduplication works
Meta deduplicates browser and server copies using the combination of:
- Browser `event` ↔ server `event_name`
- Browser `eventID` ↔ server `event_id`
Both values must match exactly. Meta’s documented deduplication window is 48 hours. ([github.com](https://github.com/facebook/facebook-nodejs-business-sdk/blob/main/src/objects/serverside/server-event.js))
### Example: one Purchase reported twice but counted once
Browser:
```javascript
fbq(
'track',
'Purchase',
{
value: 73.61,
currency: 'USD',
content_ids: ['<META_CATALOG_ITEM_ID>'],
content_type: 'product'
},
{
eventID: 'purchase:gid://shopify/Order/1234567890'
}
);
```
Server:
```json
{
"event_name": "Purchase",
"event_id": "purchase:gid://shopify/Order/1234567890"
}
```
Meta receives two transport copies of one business event and treats them as one conversion event.
### Recommended event-ID convention
```text
view:<UUID>
add_to_cart:<UUID>
checkout:<SHOPIFY_CHECKOUT_TOKEN>
purchase:<SHOPIFY_ORDER_GID>
```
For `Purchase`, Shopify’s `checkout_completed` event exposes `checkout.order.id`, while the order webhook exposes `admin_graphql_api_id`. Both represent the Shopify order GID, making it a suitable stable deduplication key. ([shopify.dev](https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed))
### Implementation requirements
- Generate one ID per actual customer action.
- Reuse that ID on both browser and server copies.
- Reuse the same ID on retries.
- Never generate a new ID every time a server request is retried.
- Do not reuse one ID across separate add-to-cart actions.
- Do not use `fbclid`, `_fbc`, `_fbp`, or customer ID as the event ID.
- The capitalization must match: `Purchase` does not match `purchase`.
- Both copies must be sent to the same Meta pixel/dataset.
### Common failures
| Failure | Result |
|---|---|
| Pixel has no `eventID` | Browser and server events can both be counted |
| Server generates a fresh UUID | Deduplication fails |
| Browser sends `Purchase`; server sends `purchase_web` | Deduplication fails |
| Order number used in browser; numeric order ID used on server | Deduplication fails |
| Native Meta app plus an additional manual Pixel installation | Events may fire more than twice |
| Server retry creates a new ID | One order can produce multiple server events |
---
## 4. Preparing customer information for server-side transmission
CAPI customer information belongs in `user_data`.
### Recommended fields
Send only fields Cedar & Coil is permitted to process:
| CAPI field | Source |
|---|---|
| `em` | Checkout/order email |
| `ph` | Checkout/order phone |
| `fn` | Billing or shipping first name |
| `ln` | Billing or shipping last name |
| `ct` | City |
| `st` | State or province code |
| `zp` | ZIP/postal code |
| `country` | Two-letter country code |
| `external_id` | Stable Shopify customer ID, if available |
| `client_ip_address` | Captured browser/order IP |
| `client_user_agent` | Captured browser user agent |
| `fbp` | `_fbp` browser identifier |
| `fbc` | `_fbc` click identifier |
### Normalize, then hash
Before hashing:
- Email: trim surrounding whitespace and lowercase.
- Phone: include country code and digits only.
- Country: use a lowercase two-letter code, such as `us`.
- State: use a normalized state/province value.
- Names and locality fields: normalize according to Meta’s field-specific rules.
- External ID: use a stable, non-secret value.
Then SHA-256 hash the normalized customer fields. Meta’s official SDK and parameter-builder utilities can perform normalization and hashing automatically, reducing the chance of a hand-built mismatch. ([github.com](https://github.com/facebook/facebook-nodejs-business-sdk/blob/main/README.md?utm_source=openai))
Example:
```javascript
import crypto from 'node:crypto';
const sha256 = value =>
crypto
.createHash('sha256')
.update(value)
.digest('hex');
const normalizeEmail = email =>
email?.trim().toLowerCase();
const normalizePhone = phone =>
phone?.replace(/\D/g, '');
const hashedEmail = sha256(normalizeEmail('Customer@Example.com '));
const hashedPhone = sha256(normalizePhone('+1 (415) 555-0100'));
```
### Do not hash these fields
Send the following in their prescribed, unhashed formats:
- `client_ip_address`
- `client_user_agent`
- `fbc`
- `fbp`
The Meta SDK’s server-side model supports email, phone, names, address fields, external IDs, IP address, user agent, `fbc`, and `fbp`. ([github.com](https://github.com/facebook/facebook-ruby-business-sdk/blob/main/lib/facebook_ads/ad_objects/server_side/user_data.rb?utm_source=openai))
### Custom implementation requirement for click IDs
A Shopify order webhook will not necessarily contain `_fbp` or `_fbc`. A custom implementation should capture permitted click/browser identifiers before checkout and associate them with the checkout or order through:
- A first-party server-side session record keyed by checkout token; or
- An approved Shopify cart/order attribute strategy.
Do not put raw email addresses, phone numbers, or other customer information into URLs, UTMs, cart attributes intended for display, event IDs, or `custom_data`.
---
## 5. Concrete Shopify setup path
### Option A: Native Facebook & Instagram by Meta sales channel
**Recommended for Cedar & Coil as a small DTC store.**
#### Setup
1. In Shopify, install or open **Facebook & Instagram by Meta**.
2. Connect the correct:
- Meta Business Portfolio,
- Facebook Page,
- ad account,
- commerce/catalog account, and
- Meta pixel/dataset.
3. In Shopify admin, go to:
- **Sales channels**
- **Facebook & Instagram**
- **Settings**
- **Data sharing settings**
4. Activate customer data sharing.
5. Choose **Maximum**, subject to Cedar & Coil’s consent and legal configuration.
6. Connect the intended Meta pixel.
7. Confirm the Arc Clip Lamp is synchronized into the intended Meta catalog.
8. Remove any old theme-level, GTM, custom-pixel, or third-party Meta installation that sends the same events to the same dataset.
Shopify documents Standard as browser Pixel only, Enhanced as Pixel plus CAPI, and Maximum as Pixel, CAPI, and Meta’s latest supported advertising technology. The native integration automatically tracks standard events including `ViewContent`, `AddToCart`, `InitiateCheckout`, and `Purchase`. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing?utm_source=openai))
#### Advantages
- Fastest implementation.
- Shopify and Meta maintain the integration.
- Pixel and server-event coordination is handled by the partner integration.
- No custom token storage, webhook queue, hashing implementation, or deduplication service.
- Catalog and product IDs are less likely to drift apart.
#### Limitations
- Less control over event payloads and event-ID conventions.
- Debugging is dependent on the visibility provided by Shopify and Meta.
- Custom business rules—such as only counting captured payments—can be harder to implement.
- Cedar & Coil must verify, rather than assume, which events are arriving from Browser, Server, or both.
### Option B: Custom implementation
Choose this only if Cedar & Coil needs:
- Custom purchase definitions.
- Specialized checkout or subscription behavior.
- A proprietary first-party event pipeline.
- More detailed logging and replay.
- Control over which permitted identifiers are sent.
- Additional destinations from a shared server-side event service.
A custom Shopify implementation normally requires:
1. A Shopify app web pixel or custom pixel subscribing to standard customer events.
2. Pixel mapping:
- `product_viewed` → `ViewContent`
- `product_added_to_cart` → `AddToCart`
- `checkout_started` → `InitiateCheckout`
- `checkout_completed` → browser `Purchase`
3. A secure server endpoint or queue.
4. An `orders/paid` webhook for confirmed server-side purchases.
5. Shopify webhook HMAC verification.
6. Idempotency storage keyed by Shopify order ID.
7. Customer-data normalization and hashing.
8. Storage of the Meta access token in a secret manager.
9. Consent state propagated to both browser and server processing.
Shopify supports storefront and checkout customer events through its sandboxed Pixel Manager, and `orders/paid` webhooks are available for triggering server-side processing. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/overview?utm_source=openai))
### Recommendation
Start with the **native Meta sales channel at Maximum data sharing**, after configuring consent. For a single-product, small DTC store, the maintenance and data-quality risks of a custom CAPI implementation usually outweigh the additional control.
Do not run native and custom implementations simultaneously against the same dataset unless there is a documented migration plan and every overlapping event shares the correct deduplication ID.
### Server-side Purchase request sketch
The following illustrates a custom `orders/paid` worker. As of August 26, 2026, Meta’s current Business SDK generation is v26; pin and periodically update the Graph API version rather than using an unversioned endpoint. ([github.com](https://github.com/facebook/facebook-nodejs-business-sdk/releases?after=v3.0.0&utm_source=openai))
```javascript
import crypto from 'node:crypto';
const META_PIXEL_ID = process.env.META_PIXEL_ID;
const META_ACCESS_TOKEN = process.env.META_ACCESS_TOKEN;
const META_GRAPH_VERSION = 'v26.0';
const STORE_URL = 'https://cedar-and-coil.example';
function sha256(value) {
return crypto
.createHash('sha256')
.update(value)
.digest('hex');
}
function hashed(value, normalizer = v => v.trim().toLowerCase()) {
if (!value) return undefined;
const normalized = normalizer(String(value));
return normalized ? [sha256(normalized)] : undefined;
}
function digitsOnly(value) {
return value.trim().replace(/\D/g, '');
}
// This must return the exact ID used by Cedar & Coil's Meta catalog.
function mapToMetaCatalogId(lineItem) {
// Example placeholder only. Confirm the real catalog ID format.
return String(lineItem.variant_id ?? lineItem.product_id);
}
export async function sendMetaPurchase(order, attribution = {}) {
const orderGid =
order.admin_graphql_api_id ??
`gid://shopify/Order/${order.id}`;
// Must exactly match the browser Pixel's eventID.
const eventId = `purchase:${orderGid}`;
const address =
order.billing_address ??
order.shipping_address ??
{};
const contentIds = order.line_items.map(mapToMetaCatalogId);
const contents = order.line_items.map(lineItem => ({
id: mapToMetaCatalogId(lineItem),
quantity: Number(lineItem.quantity),
item_price: Number(lineItem.price)
}));
const userData = {
em: hashed(order.email ?? order.contact_email),
ph: hashed(
order.phone ?? address.phone,
digitsOnly
),
fn: hashed(address.first_name),
ln: hashed(address.last_name),
ct: hashed(address.city),
st: hashed(address.province_code ?? address.province),
zp: hashed(address.zip),
country: hashed(address.country_code),
external_id: hashed(order.customer?.id),
// These fields are not SHA-256 hashed:
client_ip_address: order.browser_ip,
client_user_agent: order.client_details?.user_agent,
fbp: attribution.fbp,
fbc: attribution.fbc
};
// Remove undefined fields before sending.
Object.keys(userData).forEach(key => {
if (userData[key] == null) delete userData[key];
});
const event = {
event_name: 'Purchase',
event_time: Math.floor(
new Date(
order.processed_at ??
order.updated_at ??
Date.now()
).getTime() / 1000
),
event_id: eventId,
action_source: 'website',
event_source_url:
attribution.eventSourceUrl ?? STORE_URL,
user_data: userData,
custom_data: {
value: Number(order.total_price),
currency: order.currency,
content_ids: contentIds,
content_type: 'product',
contents,
order_id: orderGid,
num_items: order.line_items.reduce(
(sum, item) => sum + Number(item.quantity),
0
)
}
};
const body = {
data: [event]
// Add only while using Meta Test Events:
// test_event_code: process.env.META_TEST_EVENT_CODE
};
const endpoint =
`https://graph.facebook.com/${META_GRAPH_VERSION}/` +
`${META_PIXEL_ID}/events?access_token=` +
encodeURIComponent(META_ACCESS_TOKEN);
const response = await fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
});
const result = await response.json();
if (!response.ok) {
throw new Error(
`Meta CAPI failed: ${response.status} ${JSON.stringify(result)}`
);
}
return result;
}
```
Production requirements omitted from the sketch:
- Verify the Shopify webhook HMAC against the **raw request body**.
- Return success to Shopify promptly and enqueue processing.
- Store webhook and Meta delivery status.
- Make the worker idempotent using `purchase:<order GID>`.
- Retry transient failures with the same `event_id`.
- Never log raw customer data or the Meta access token.
- Use a secret manager rather than Shopify theme settings.
- Prevent test orders from contaminating production optimization unless intentionally testing a controlled low-volume flow.
- Decide how refunds, cancellations, and order edits will be handled separately.
Meta also provides official server-side Business SDK classes for `ServerEvent`, `UserData`, `CustomData`, and `EventRequest`, including automatic normalization and hashing support. Using the SDK is preferable to maintaining normalization rules manually. ([github.com](https://github.com/facebook/facebook-nodejs-business-sdk/blob/main/README.md?utm_source=openai))
---
## 6. End-to-end validation before scaling spend
### A. Configuration audit
Confirm:
- Only one intended Meta dataset/pixel is connected.
- The ad account has access to it.
- The correct domain is associated with the business.
- The Arc Clip Lamp exists in the correct catalog.
- Event `content_ids` match the catalog item ID exactly.
- No legacy theme code or duplicate GTM tag remains.
- The native app and any third-party Meta app are not both sending overlapping events.
### B. Test the funnel
Run these actions individually:
1. View the Arc Clip Lamp product page.
2. Add one lamp to the cart.
3. Start checkout.
4. Complete a test order.
5. Repeat with quantity two.
6. Repeat with a discount.
7. If relevant, repeat with shipping and tax.
8. Test both guest and logged-in checkout.
9. Test desktop and mobile.
10. Test Safari/iOS and a browser with tracking protection or an ad blocker.
Shopify supports simulated transactions through its test payment gateway or Shopify Payments test mode. Turn test mode off immediately after testing because customers cannot place normal live orders while the relevant provider is in test mode. ([help.shopify.com](https://help.shopify.com/en/manual/checkout-settings/test-orders?locale=en-US&utm_source=openai))
### C. Inspect Meta Events Manager
Use **Events Manager → Test Events** and check each event:
- Correct standard event name.
- Correct dataset/pixel.
- Correct Browser or Server connection method.
- `value` is numeric.
- `currency` is `USD` for US orders.
- `content_ids` are present and match the catalog.
- `Purchase` contains the correct actual total.
- `Purchase` contains `order_id`.
- Browser and server `Purchase` copies have the same event ID.
- Meta recognizes the browser/server pair as deduplicated.
- No unexpected duplicate Pixel installations appear.
For custom CAPI testing, add the Test Events code as `test_event_code`, then remove it before production.
### D. Compare against Shopify
For the test window, create a reconciliation table:
| Shopify order | Shopify total | Browser Purchase | Server Purchase | Deduplicated | Meta value |
|---|---:|---:|---:|---:|---:|
| Test order 1 | $73.61 | Yes | Yes | Yes | $73.61 |
Investigate any case where:
- Shopify has a paid order but Meta has no server event.
- Meta has two counted purchases for one Shopify order.
- Meta’s value differs from Shopify.
- Browser and server event IDs differ.
- `content_ids` do not resolve to catalog items.
- Server events arrive with significant unexplained delay.
Compare **received event ingestion** with Shopify orders during implementation. Do not expect Ads Manager’s attributed purchase count to equal Shopify’s total order count because attribution applies separate campaign, identity, and attribution-window rules.
### E. Failure-mode tests
Deliberately test:
- Browser event blocked, server event received.
- Thank-you page closed quickly, server event received.
- Server request temporarily fails, retry uses the same event ID.
- Shopify webhook is delivered twice, only one logical Purchase is sent.
- Missing phone but valid email.
- Missing customer account ID.
- Discounted and multi-quantity orders.
- Consent denied: no prohibited browser or server marketing event is transmitted.
### F. Ongoing monitoring
For at least the first weeks after launch, monitor:
- Shopify paid orders versus unique CAPI `Purchase` event IDs.
- CAPI response errors and latency.
- Deduplication warnings.
- Event Match Quality diagnostics.
- Missing or invalid currency/value parameters.
- Catalog content-ID match errors.
- Sudden event-count changes after theme, checkout, consent-banner, or app updates.
---
## 7. Consent and compliance
Hashing customer information does **not** make it anonymous. Hashed email, phone, address fields, IP addresses, browser identifiers, and purchase activity can still be regulated personal information.
Cedar & Coil should:
- Clearly disclose Meta Pixel and CAPI data sharing in its privacy policy.
- Obtain consent where required before activating marketing tracking.
- Honor applicable opt-outs of sale, sharing, or targeted advertising.
- Apply the same consent decision to the server path; do not suppress the Pixel while continuing to send an unrestricted CAPI event.
- Send only fields needed for matching and measurement.
- Avoid collecting sensitive information in URLs or event parameters.
- Restrict access to Meta tokens and customer data.
- Define retention and deletion procedures.
- Review Shopify’s Customer Privacy configuration and integrate its consent banner or a compatible consent-management platform.
- Have counsel confirm requirements for the states and countries in which Cedar & Coil operates or markets.
Shopify’s Pixel Manager can gate pixels based on required marketing and analytics permissions, and pixels configured as data sale/sharing should respect applicable customer opt-outs. Shopify also warns that custom code must not be used to bypass consent requirements. ([help.shopify.com](https://help.shopify.com/en/manual/promoting-marketing/pixels/overview?utm_source=openai))
## Final implementation recommendation
For launch:
1. Install the native **Facebook & Instagram by Meta** sales channel.
2. Connect one correct Meta dataset and catalog.
3. Set data sharing to **Maximum**, subject to consent configuration.
4. Remove duplicate manual Meta tags.
5. Confirm the four standard events and their values in Test Events.
6. Complete at least one full Shopify test order.
7. Verify browser/server Purchase deduplication.
8. Reconcile the Meta event with the Shopify order.
9. Test consent-denied and browser-blocked scenarios.
10. Scale spend only after event names, totals, catalog IDs, and deduplication remain stable across repeated tests.