Web app2026
One dashboard for Shopify, GA4 and Meta
A dashboard on the agency's domain that brings each client brand's sales, traffic and ad figures together, with one named source for every metric and incomplete periods flagged. Before it, the same figures lived in different tools and disagreed on what "revenue" meant.
Credits Implementation assisted by AI coding agents

Problem
Reporting started in spreadsheets. Sales, traffic, advertising and site-performance data sat in different tools, and the same word, "revenue", produced different figures depending on whether it came from Shopify, GA4 or Meta. That made the reports hard to use for decisions.
What I built
An operations dashboard on the agency's domain, with a separate view for each client brand:
- Sales from Shopify (orders, products, discounts and refunds), synced daily and refreshed during the day;
- Sessions and funnel from the GA4 Data API and the GA4 BigQuery export;
- Checkout signals from a Shopify Web Pixel extension;
- Advertising spend and reported purchases from the Meta Marketing API;
- Site performance from Core Web Vitals collected from real visitors;
- Operations: the shipment timeline from the integration platform (case 01) and a public tracking page.
Every figure names its source, and figures with different sources, units or attribution models are never added together.
Proof
- Live on the agency's own domain, configured for several client brands, each with its own data access.
- A reporting mismatch, resolved the same day. In July 2026 I corrected a product ranking that used an outdated revenue definition and an incomplete date range. After the fix, the raw data and both reporting views matched under the agreed definition.

Tech details
How it's built
Data rules
- One designated source per metric: orders and revenue from Shopify; sessions from GA4; the funnel from the BigQuery export; ad spend from Meta; Web Vitals from real users.
- Incomplete data is flagged, not shown as zero: each view states which period is closed and which day is still partial; GA4 reporting uses a two-day lag.
- A migration ledger records which database changes have been applied, in order.
- Access by brand: brand-level access checks run on the server; the service key stays server-side, and row-level security blocks direct table access.
After the July incident
- What went wrong: the ranking read an older view built on a superseded revenue definition, the selected date range had been silently shortened by a day (and the comparison period with it), and a revenue check had passed because it tested a different view from the one the screen used.
- A later re-check of an earlier period showed small differences; I traced them, order by order, to three late cancellations in Shopify, a legitimate change at the source.
- The fix: a new sales view, a check that prevents incomplete reporting periods from being displayed as complete, and a separate refresh after each sync. The next morning's scheduled sync was checked against the agreed revenue definition.
- A release checklist of checks that can pass while missing a real error: a test that validates one view while the screen reads another; a deployment marked "ready" without confirming which commit it serves; a green build without a logged-in smoke test; an empty dataset used as a benchmark; an aggregate total "reconciled" without matching the underlying rows.
Quality
- Tests in CI on 1 October 2026: 6,938 automated tests (6,936 passed, 2 skipped, 0 failed), alongside linting, type checks and a production build.
Stack
Next.js 16, TypeScript, Supabase Postgres, Vercel Cron (13 schedules on 12 endpoints: syncs, refreshes, reconciliation, monitoring and alerts), Shopify Admin API and a Web Pixel extension, GA4 Data API and BigQuery export, Meta Marketing API, Sentry, Playwright.
Scheduled calls, 1–3 Oct 2026HTTP 200 shows that each job was called and answered. It does not prove that a sync finished or how much data it moved.
| Job | Schedule (BRT) | Last call | HTTP seen |
|---|---|---|---|
| Daily sync of each client's sources | daily 05:00 | 3 Oct 05:00 | 2, all 200 |
| Customer base sync, store A | Mon, Wed, Fri 05:45 | 2 Oct 05:45 | 1, 200 |
| Customer base sync, store B | Tue, Thu, Sat 06:00 | 3 Oct 06:00 | 1, 200 |
| Platform sentinel | daily 06:30 | 3 Oct 06:30 | 2, all 200 |
| AI sentinel | daily 07:00 | 3 Oct 07:00 | 2, all 200 |
| Instagram sync (shadow tables) | daily 07:40 | 3 Oct 07:40 | 2, all 200 |
| Insights digest (e-mail) | daily 08:00 | 3 Oct 08:00 | 2, all 200 |
| Commerce reconciliation | daily 08:20 | 3 Oct 08:20 | 3, all 200 |
| Alert evaluation | 09:00 and 16:00 | 3 Oct 09:00 | 5, all 200 |
| GA4 sessions catch-up (BigQuery) | daily 13:00 | 2 Oct 13:00 | 2, all 200 |
| Checkout app token refresh | every 30 min | 3 Oct 10:00 | 50, all 200 |
| Shopify orders, intraday refresh | :10 and :40 | 3 Oct 10:10 | 50: 49 × 200, 1 × 500 |
13 schedules on 12 endpoints (alert evaluation runs twice a day), read from the production logs on 3 Oct 2026 at about 10:15. The one 500 was the Shopify intraday refresh on 2 Oct at 14:40; the next call, at 15:10, answered 200. The two half-hourly jobs show the last ~24 hours (query limit).
What this means for your business
When Shopify, GA4 and ad-platform figures disagree, I start by checking how each metric is defined, which source it uses and which period it covers. Then I make the dashboard say so.
or e-mail contato@rafaelshopify.dev


