Merchants & developers

Profit analysis and Shopify reconciliation

Adds product cost, inventory, order, and contribution-margin context so experiment results can be read against profit, not only conversion rate.

Simple terms

Profit analysis adds cost and order context so a winning test can be judged by margin, not only conversion rate.

Adds product cost, inventory, order, and contribution-margin context so experiment results can be read against profit, not only conversion rate.

Routes

  • /settings/integrations
  • /api/analytics/shopify-reconciliation
  • /api/analytics/commerce

Implementation behavior

  • Shopify sync jobs fetch product, inventory, order, and cost data when required scopes are connected.
  • Reconciliation compares Shopify events and Apex events to detect missing or mismatched revenue records.
  • Variant cost and margin data can be joined to experiment outcomes to judge business impact.
  • Analytics endpoints expose reconciliation state, commerce metrics, sync health, and data quality state.

How to use it

  • Reconnect Shopify with the needed scopes before relying on margin reporting.
  • Run or monitor sync jobs before reading profit-sensitive experiments.
  • Check reconciliation when revenue differs between Shopify and Apex.
  • Use contribution margin as a secondary decision metric when discounts, bundles, or upsells are involved.

When not to use it

  • Do not use margin reporting before Shopify scopes and cost data are confirmed.
  • Do not compare profit across variants if revenue attribution is failing.
  • Do not treat delayed Shopify sync data as real-time truth.

Implementation source

  • Integration UI lives under src/app/(dashboard)/settings/integrations.
  • Handlers include /api/analytics/shopify-reconciliation, /api/analytics/commerce, commerce sync, and the Shopify webhook reconciliation cron.
  • Prisma product/order/cost records are joined with Tinybird revenue and experiment context for reporting.

Data and API

  • Shopify product/order/inventory/cost records, variant costs, reconciliation records, and experiment revenue events.
  • APIs under /api/analytics/shopify-reconciliation, /api/analytics/commerce, /api/analytics/commerce/sync, /api/cron/shopify-webhook-reconcile, and integration settings.
  • Tinybird revenue events plus Prisma product/order cost tables.

Failure modes

  • Margin unavailable: missing Shopify scopes or no cost data.
  • Revenue mismatch: Web Pixel settings, order sync delay, currency, or duplicate events.
  • Sync stale: rerun sync and inspect job logs before trusting profit readback.