AdTrace Enterprise is a Shopify-first tracking and attribution platform for merchants that sell across multiple markets, multiple domains, and multiple storefront experiences.
This repository now models the app as a real Shopify product:
- an embedded admin surface for onboarding and diagnostics
- merchant-facing product, purchase, and order tracking dashboards
- a multi-tenant backend for shops, domains, markets, and identities
- server-side event ingestion and Meta Conversion API delivery
- Shopify OAuth, billing plan catalog, and compliance webhook handling
- a Web Pixel extension scaffold for storefront capture
- a deployable hosted backend runtime for one app serving many stores
- optional Postgres persistence for tenants, installations, tracking config, and events
This is not a generic "Facebook Pixel" plugin.
It is a:
- multi-market attribution engine
- multi-domain identity layer
- server-side conversion pipeline
- Shopify control plane for tracking integrity
For each Shopify merchant, the platform can:
- capture storefront events
- enrich events with domain and market context
- unify shopper identity across sessions and domains
- deduplicate browser and server copies of the same event
- send clean conversion data to Meta, GA4, Google Ads, and TikTok
- expose diagnostics through an operator-friendly admin dashboard
- let merchants monitor tracked products, recent purchases, order status, and destination delivery health without leaving the app
This repository is structured as an enterprise Shopify app, not a one-endpoint prototype.
- Embedded admin dashboard at
GET /app - Admin APIs for tenants, plans, install links, and Meta settings
- OAuth install and callback routes
- Compliance and lifecycle webhook endpoint
- One deployable backend for all installed stores
- Public app URL used by Shopify OAuth, embedded admin, webhooks, and app proxy
- Merchant-specific configuration stored per tenant, not in
.env
- Event ingestion API at
POST /api/events - Web Pixel extension scaffold in
extensions/adtrace-web-pixel - Theme app embed bridge in
extensions/adtrace-theme-bridge - Multi-market and multi-domain tenant modeling
- Billing plan catalog aligned to Starter, Growth, and Enterprise
- Tenant-level plan assignment and recommendation logic
.
├── docs/
│ ├── architecture.md
│ └── postgres-schema.sql
├── extensions/
│ └── adtrace-web-pixel/
│ ├── shopify.extension.toml
│ └── src/index.ts
├── src/
│ ├── admin/
│ │ └── dashboard.ts
│ ├── config/
│ │ └── env.ts
│ ├── container.ts
│ ├── lib/
│ │ └── logger.ts
│ ├── modules/
│ │ ├── billing/
│ │ ├── events/
│ │ ├── identity/
│ │ ├── meta/
│ │ ├── platform/
│ │ └── shopify/
│ ├── routes/
│ │ ├── admin.ts
│ │ ├── app.ts
│ │ ├── auth.ts
│ │ ├── events.ts
│ │ ├── health.ts
│ │ └── webhooks.ts
│ ├── app.ts
│ └── index.ts
├── tests/
├── shopify.app.toml
└── package.json
Each merchant installation is represented as a tenant profile containing:
- shop domain
- plan
- supported markets
- supported storefront domains
- destination adapter settings
- enabled scenario set
- custom event mappings
Every normalized event carries:
countryCodecurrencyCodemarketIddomain
This is essential for Shopify Markets and regional storefronts.
The identity resolver supports:
- anonymous browser IDs
- customer IDs
- phone
- external IDs
This is the base layer for cross-domain attribution.
The event pipeline now supports the full Shopify standard ecommerce journey, including:
page_viewedcollection_viewedproduct_viewedsearch_submittedcart_viewedproduct_added_to_cartproduct_removed_from_cartcheckout_startedcheckout_contact_info_submittedcheckout_address_info_submittedcheckout_shipping_info_submittedpayment_info_submittedcheckout_completedalert_displayedui_extension_errored- merchant-defined
custom:*events
The app includes scaffolds for:
- OAuth install flow
- embedded admin experience
- mandatory compliance webhooks
- app uninstall handling
- billing plan catalog
- web pixel extension
The repository now includes deployment-oriented backend assets:
.env.exampleDockerfilerender.yamldocs/backend-hosting.md
This backend is meant to be hosted once and reused by all merchant installs.
Every normalized event is enriched with:
- a canonical event name
- an event category
- a quality score
- quality warnings for missing identity, market, checkout, or purchase fields
The repository now includes a top-frame bridge for checkout implementations that emit GTM or dataLayer events outside Shopify's standard pixel bus.
It normalizes events such as:
begin_checkoutadd_shipping_infoadd_payment_infopurchaseremove-from-cartproduct-impressiongtm.historyChangetd_ssc_id_success
The app now includes a broad ecommerce scenario registry and alias system so it can normalize a large set of Shopify, GA4-style, GTM, and merchant-defined event names into canonical platform events.
Use:
GET /api/admin/scenarios
The embedded dashboard now lets each merchant:
- enable only the scenarios they actually use
- map custom
dataLayer, GTM, or iframe event names into canonical scenarios - configure destination adapters for Meta, GA4, Google Ads, and TikTok
- inspect recent normalized delivery outcomes
The admin now also includes merchant-facing tracking views for:
- top tracked products by views, carts, purchases, and revenue
- recent purchases with delivery health across connected destinations
- tracked orders with checkout timeline and delivery status
- purchase delivery breakdown by destination
GET /healthPOST /api/eventsGET /api/admin/overviewGET /api/admin/tenants/:tenantId
PUT /api/admin/tenants/:tenantId/meta
PUT /api/admin/tenants/:tenantId/tracking
PUT /api/admin/tenants/:tenantId/destinationsGET /auth/install?shop=merchant-store.myshopify.com
GET /auth/callback
POST /webhooks/shopifynpm install
npm run devOpen:
http://localhost:3000/app
For hosting and deployment guidance, see:
docs/backend-hosting.md
Copy .env.example and configure:
SHOPIFY_API_KEYSHOPIFY_API_SECRETSHOPIFY_APP_URLSHOPIFY_SCOPESDEFAULT_META_PIXEL_IDDEFAULT_META_ACCESS_TOKEN
The codebase is now structured for enterprise implementation, but the next production milestones are still important:
- Replace the in-memory repositories with PostgreSQL-backed repositories using the schema in
docs/postgres-schema.sql. - Wire Shopify Admin GraphQL for billing activation, web pixel creation, and shop settings sync.
- Add queueing and retries for destination delivery.
- Add a persistent identity graph for cross-domain shopper resolution.
- Add audit logs, role-based access, and merchant onboarding workflows.
You are building a premium Shopify app for merchants who need clean attribution across markets, currencies, and domains.
This repository is now much closer to that product shape.