Fixing Analytics & Migrating a Compound Review SPA to Next.js by Aman Mollah Fixing Analytics & Migrating a Compound Review SPA to Next.js by Aman Mollah

Fixing Analytics & Migrating a Compound Review SPA to Next.js

Aman Mollah

Aman Mollah

Overview

testedsources is a vendor review platform for research compounds, originally built as a Replit-hosted single-page app. The client came in with a clear analytics problem and an opportunity to improve the app's architecture, SEO, and UX.

The Problem

Because the app was a SPA with no full page reloads, Google Analytics 4 was blind to most user activity. Pageviews weren't being recorded, and affiliate link clicks (the site's primary revenue mechanism) weren't tracked at all. On top of this, all pages reported the same generic title in Analytics, making it impossible to understand what content users were actually engaging with.

What I Did

I recommended migrating from the Replit SPA setup to Next.js, which solved the SEO and dynamic routing problems at the architecture level. From there, I implemented manual GA4 page_view event triggers on internal navigation, and built affiliate click tracking that detects outbound links by domain match across all configured vendor domains. I also added dynamic page titles so every compound and vendor page shows up as a distinct entry in Analytics.
Beyond analytics, I rebuilt the search and filter experience: unifying the compounds and COA lab results tabs into a single search interface with a toggle, persistent URL state (so shared links land on the right tab and country filter), and Supabase-powered sorting on the live database.

Outcome

GA4 now correctly tracks pageviews across all internal navigation and fires events on every affiliate click, giving the client full visibility into their traffic and revenue-driving interactions for the first time.
Like this project

Posted Mar 17, 2026

Migrated SPA to Next.js for better SEO, UX, and analytics tracking.