Install guide
Shopify · Meta CAPI

Meta says 100. Shopify says 10. Both are lying.

Server-side Meta Conversions API + 1st-party fbclid persistence + a reconciliation dashboard that shows you the actual number. Five steps, ~20 minutes if your Meta + Shopify credentials are at hand. Walks you from a clean Shopify store to a verified Purchase event in Meta Events Manager.

# storefront snippet · custom-app webhook · reconciliation dashboard
1

Storefront snippet: capture fbclid.

Meta's Pixel drops ?fbclid=… on every ad click. iOS 14.5+ and Safari ITP stop the cookie write within hours. We copy it into a 1st-party cookie + Shopify cart attributes, so it survives 90 days and arrives in the order webhook regardless of browser cooperation.

# Save the snippet into the merchant's theme cp plugins/shopify/tagdrishti-meta-capi/theme-snippet/\ tagdrishti-fbclid-capture.liquid \ /path/to/theme/snippets/tagdrishti-fbclid-capture.liquid # In layout/theme.liquid, just before </body>: {% render 'tagdrishti-fbclid-capture' %}
Smoke test: visit any storefront page with ?fbclid=test_value_123. DevTools → Application → Cookies should show tagdrishti_fbc = fb.1.<ts>.test_value_123. Add a product to cart, open /cart.js, look for attributes.tagdrishti_fbc.
2

Meta credentials: pixel ID + CAPI access token.

In Meta Events Manager → Data Sources → Your Pixel → Settings:

  1. Copy the Pixel ID — the 16-digit number at the top of the screen.
  2. Conversions API → Set up manuallyGenerate access token.
  3. Save the token. Meta only shows it once.
Why two credentials? The Pixel ID identifies the data destination; the access token authorises the server-side POST. The Pixel ID is public. The access token is a Meta secret — never paste it into a public file or repo.
3

TagDrishti dashboard: store credentials, issue a relay token.

Go to dashboard.tagdrishti.com/dashboard/integrations/shopify-meta-capi and paste both values. We encrypt the access token at rest with AES-256-GCM under per-region keys before it hits the database.

  1. Paste the Pixel ID + access token.
  2. Click Issue relay token. Copy the plaintext immediately — we hash it at rest, rotate on every save, and never show it again.
  3. Note your workspace_id (visible in the URL).
Heads up: the relay token is shown exactly once. If you miss it, click Save again to issue a fresh one — that automatically invalidates the previous.
4

Custom app: deploy the webhook receiver.

A Node + Express service that HMAC-verifies every Shopify webhook delivery, then forwards the validated payload to the regional TagDrishti relay. Cloud Run is the cheapest at typical Shopify volumes (effectively $0/month).

cd plugins/shopify/tagdrishti-meta-capi/shopify-app npm install cp .env.example .env # Edit .env: SHOPIFY_API_SECRET = <from Shopify custom-app credentials> SHOPIFY_SHOP_DOMAIN = the-shop.myshopify.com TAGDRISHTI_RELAY_BASE = https://apac.tagdrishti.com # or eu / us / au TAGDRISHTI_WORKSPACE_ID = <from step 3> TAGDRISHTI_RELAY_TOKEN = <from step 3> # Deploy to Cloud Run (Heroku / Render / Lambda also work) gcloud run deploy tagdrishti-shopify-meta-capi \ --source . --region asia-south1 \ --allow-unauthenticated --port 3000
Region picker: use apac for India / SE Asia / MENA, eu for GDPR-aligned EU/UK, us for the Americas, au for Australia / NZ. Workspace data residency is locked at sign-up — pick the matching region.
5

Shopify webhooks: two subscriptions.

Shopify admin → Settings → Notifications → Webhooks (or via the Admin API). Format JSON, API version 2024-04 or later. Both URLs point at the deployed app from step 4.

TopicURL
orders/createhttps://your-app.run.app/webhooks/orders/create
checkouts/updatehttps://your-app.run.app/webhooks/checkouts/update
Smoke test end-to-end: place a real test order. Cloud Run logs should show relay:{ok:true, status:202} within seconds. That confirms HMAC verification, fbclid in cart attributes, the forward to the regional relay, and a row written to meta_capi_delivery_log.

Verify: Meta Test Events tab + the dashboard.

Two checks. The first proves Meta accepted the event; the second proves the reconciliation dashboard is wired.

  1. Meta Events Manager → your Pixel → Test Events tab. Paste the test code shown there into TagDrishti's integration page (test_event_code field). Place a test order. The Purchase event should land within 30 seconds with EMQ 8+. Once verified, clear test_event_code — events with that flag don't count as production conversions.
  2. Open dashboard.tagdrishti.com/dashboard/shopify-meta-capi. The headline tile should show TagDrishti delivered ≥ 1 with the avg EMQ score. Per-order ledger row visible.
# emq_score_tuning

EMQ 8+ → 15-30% better Meta ad performance.

Meta's Event Match Quality score (0-10) measures how well CAPI events tie back to a person. Higher EMQ = Meta uses your data for ad optimisation, not just measurement. The TagDrishti install ships with full match coverage out of the box.

SourceTypical EMQ
Shopify native CAPI4 - 5 / 10
TagDrishti (no fbc)6 - 7 / 10
TagDrishti (fbc + email)8 - 9 / 10
TagDrishti (full match)9 - 10 / 10

Full match parameters we send: em (hashed email), ph (hashed phone), external_id (hashed customer_id), fn/ln (billing first/last name), ct/st/zp/country (billing address), client_ip_address, client_user_agent, fbc (from cart attributes), fbp.

# when_events_arent_landing

Diagnostic checklist (walk in order, stop at the first hit).

  1. Is the click being captured? Visit storefront with ?fbclid=test_diag_001. DevTools → Cookies → tagdrishti_fbc. Missing means the snippet didn't render — check layout/theme.liquid for the {% render %} line.
  2. Is the click reaching the cart? Add to cart, open /cart.js, look for attributes.tagdrishti_fbc. Missing means the AJAX call to /cart/update.js failed — check the browser console for CORS or 4xx.
  3. Is the order webhook firing? Place a test order. Cloud Run logs should show an event:"forwarded" line with the Shopify order ID. Missing means the webhook subscription topic / URL is wrong.
  4. Is the relay accepting the forward? The relay field should be {ok:true, status:202}. 401 means the relay token was rotated or the workspace is disabled — re-issue from the dashboard. 400 missing-order-id means the webhook payload is malformed (rare).
  5. Is Meta accepting the event? Meta Events Manager → Test Events with the test_event_code set in TagDrishti. Should appear within 30 seconds at EMQ 8+.
  6. Why is EMQ stuck at 5/10? Common causes: customer didn't log in (no email), guest checkout with no phone, storefront on a separate domain from checkout (Plus only). The /api/v1/shopify/meta-capi/diagnose endpoint returns a per-field breakdown of which match parameters were present on recent orders.
# or_install_on

Same engine, different platform.

14 days · your store · no card

Run reconciliation on this week’s orders.

Walk through the install above, place a test order, and within an hour the dashboard is showing you what Meta saw versus what Shopify saw versus what TagDrishti recovered. 14 days free, no card.