Rafael SilvaContact

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.

Contribution
Product scope, data contracts, build and operation
Status
In production on the agency's domain
Client
A commerce agency serving several Shopify brands
Period
Since April 2026
Stack
Next.js, TypeScript, Supabase, GA4 and BigQuery, Meta Marketing API

Credits Implementation assisted by AI coding agents

Production capture · figures redactedProduction screens with all figures and the brand name redacted.
Executive summary screen: revenue, orders, average order value, sessions and conversion cards, figures and brand name redacted

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.
Data-quality screen comparing GA4 and Shopify volumes, with a warning that the view compares aggregates from different sources and units and should be read as a validation signal (figures redacted).
Tracking-quality view (real screen, figures redacted). The footnote keeps Shopify as the official revenue source.

Tech details

How it's built

Data rules

  1. 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.
  2. 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.
  3. A migration ledger records which database changes have been applied, in order.
  4. 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.
Execution record · hosting logs, anonymised
JobSchedule (BRT)Last callHTTP seen
Daily sync of each client's sourcesdaily 05:003 Oct 05:002, all 200
Customer base sync, store AMon, Wed, Fri 05:452 Oct 05:451, 200
Customer base sync, store BTue, Thu, Sat 06:003 Oct 06:001, 200
Platform sentineldaily 06:303 Oct 06:302, all 200
AI sentineldaily 07:003 Oct 07:002, all 200
Instagram sync (shadow tables)daily 07:403 Oct 07:402, all 200
Insights digest (e-mail)daily 08:003 Oct 08:002, all 200
Commerce reconciliationdaily 08:203 Oct 08:203, all 200
Alert evaluation09:00 and 16:003 Oct 09:005, all 200
GA4 sessions catch-up (BigQuery)daily 13:002 Oct 13:002, all 200
Checkout app token refreshevery 30 min3 Oct 10:0050, all 200
Shopify orders, intraday refresh:10 and :403 Oct 10:1050: 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).

Status of each scheduled call, read from the hosting logs. Store names replaced.

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.

Contact on LinkedIn

or e-mail contato@rafaelshopify.dev


Explore more