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