How TagNexus modernised analytics for Treated using Google Analytics 4, Server-Side GTM, Google Tag Gateway, Consent Mode v2, and scalable measurement architecture across multiple ad platforms.
Treated
Healthcare
Ongoing
GA4 · sGTM · GTG
Consent Mode v2
Executive Summary
Treated operates complex digital healthcare journeys covering consultations, subscriptions, onboarding, prescriptions, and marketing acquisition across multiple regions and user types. As the platform scaled, the existing analytics setup could no longer keep pace - browser restrictions, growing privacy requirements, and the demands of multi-platform marketing attribution were each pulling in different directions.
TagNexus redesigned the entire analytics ecosystem around Google Analytics 4, Server-Side Google Tag Manager, and Google Tag Gateway - with Consent Mode v2 at the centre of every tracking decision. The result was a measurement framework that balanced business intelligence with user privacy, and marketing attribution that could actually be trusted across Google Ads, Meta, and TikTok.
This was not a simple implementation engagement. It required rethinking how data was collected, how consent was managed, how ad platforms received conversion signals, and how all of it flowed downstream into BigQuery for enterprise reporting.
The Challenge
Each challenge was interconnected - solving one without the others would have created a solution that worked in isolation but failed in the real world of a complex healthcare platform.
Treated's onboarding involves multiple steps, redirects, eligibility checks, and dynamic form flows. Accurately tracking user progression without duplicate events, missed steps, or false conversions required careful dataLayer design and trigger management beyond what standard GTM auto-events could handle.
Healthcare data carries heightened sensitivity. Consent Mode v2 had to be implemented correctly - not just technically, but in a way that ensured no personally identifiable or health-related data ever flowed through analytics systems without explicit user consent. Getting this wrong carried both legal and reputational risk.
Safari ITP, Firefox ETP, and ad blockers were collectively eroding a significant portion of Treated's analytics and conversion data - particularly on iOS where healthcare content is frequently accessed. Client-side measurement alone was no longer reliable enough for marketing decisions at this scale.
Conversion data reaching Google Ads, Meta, and TikTok through client-side pixels was incomplete, inconsistent, and subject to the same browser restrictions affecting GA4. Without reliable server-side signals, campaign optimisation algorithms were working with poor quality data - directly impacting acquisition costs and performance.
Analytics data flowing into BigQuery for enterprise reporting had to be structured correctly from the point of collection. Inconsistencies in event naming, parameter structure, or data types at the GTM level created compounding problems when business intelligence teams tried to work with the data in Snowflake.
Treated's development team releases new features frequently. The analytics framework had to be flexible enough to accommodate new tracking requirements quickly - without requiring a specialist to rewrite the GTM container for every product update.
Treated is a Single Page Application where the subdomain changes when a user begins the onboarding or consultation journey — moving from the main marketing site to a separate application subdomain. Standard GTM tracking assumptions break completely in this scenario: pageview events do not fire on route changes, consent state does not persist across subdomain boundaries without explicit configuration, and cross-domain user identification requires careful implementation to avoid session fragmentation.
The Solution
Every decision in this engagement was made with privacy, data quality, and long-term maintainability as the primary constraints. The technical implementation followed from those decisions - not the other way around.
Treated operates across European markets under GDPR, making consent management a non-negotiable foundation of the analytics implementation. We implemented Consent Mode v2 Basic — where no analytics or ad platform tags fire until the user explicitly grants consent through the CMP. This is the strictest approach and the correct one for a healthcare platform where data sensitivity is highest.
The implementation used OneTrust as the CMP, with the consent initialisation configured on Consent Initialisation - All Pages in GTM. One of the most technically significant challenges was a consent initialisation race condition: the Google tag was configured to fire on Consent Initialisation - All Pages, but OneTrust fires at the same moment — meaning the consent state had not yet been updated when the Google tag attempted to fire. The fix was adding an explicit analytics_storage consent check directly on the Google tag itself, so it only fires after the consent state has been confirmed as granted.
This fix also solved a secondary issue: when users declined consent, GA4 was appending _gl parameters to browser URLs — creating duplicate URL variants in GA4 reports that made path analysis unusable. By ensuring the Google tag only fires after consent is granted, the _gl parameter is never appended for non-consenting users, keeping URLs clean and reporting accurate.
The dataLayer schema was designed specifically around Treated's complex user journeys - onboarding steps, subscription events, consultation tracking, prescription fulfilment, and marketing conversion events - with consistent naming conventions and parameter structures that worked for both GA4 and the downstream BI stack.
A Solution Design Reference (SDR) was produced and shared with Treated's development team so that any new product feature could be instrumented consistently without needing to involve analytics at every step. The SDR is a living document that continues to evolve as the platform grows.
The server-side infrastructure was built on Addingwell — a managed server-side tagging platform that simplifies sGTM deployment and management. Addingwell handled the server container hosting, allowing us to focus on tag configuration and data routing rather than infrastructure management. Google Tag Gateway was then configured to serve GTM scripts through Treated's own first-party domain - making them invisible to ad blockers and browser extension filters that target Google's domains. This was particularly important for Treated's iOS audience, where Safari's ITP restrictions and content blockers are most prevalent.
The server-side GTM container was set up on Google Cloud Run with custom clients for GA4 and each ad platform. All ad platform conversion events were moved to server-side, dramatically improving the completeness and reliability of signals sent to Google Ads, Meta, and TikTok.
The GA4 property was built from scratch with an event taxonomy aligned to Treated's healthcare user journeys - not a generic ecommerce setup retrofitted to a healthcare context. Custom dimensions were configured to capture the metrics that Treated's marketing and product teams actually needed: treatment category, journey stage, subscription type, and acquisition source.
Funnel exploration configurations were set up for the key onboarding and conversion journeys, and cross-domain tracking was implemented to ensure consistent user identification across Treated's digital properties.
Meta's Conversions API was integrated at the server-side GTM level - sending conversion events directly from the server to Meta's endpoint, bypassing client-side browser restrictions entirely. Event deduplication was configured to ensure that events reaching Meta via the browser pixel and via CAPI did not result in double-counting.
The result was a significant improvement in match quality and conversion event completeness - giving Meta's algorithm better data to optimise campaigns against, which directly improved campaign performance.
Google Ads Enhanced Conversions were implemented server-side to pass hashed first-party customer data alongside conversion events - improving attribution accuracy for users who interact across multiple devices or who block client-side tracking. This is particularly relevant for Treated's subscription journey where purchase decisions often span multiple sessions.
TikTok's Events API was integrated server-side to mirror the approach taken with Meta - ensuring consistent conversion signals reach TikTok independently of client-side browser behaviour.
GA4's BigQuery export was configured with event schemas designed to map cleanly into Treated's Snowflake data warehouse. The naming conventions and parameter structures from the dataLayer architecture were chosen from the start to minimise transformation work at the warehouse layer - ensuring the BI team could work with clean, consistent data without needing to unpick inconsistent event structures.
Implementation Timeline
Full audit of existing GTM container and GA4 setup, consent compliance review, event taxonomy design, and SDR documentation.
Consent Mode v2 Advanced implementation, CMP integration, dataLayer schema build with developer coordination and validation.
GTG configuration, sGTM setup on Cloud Run, GA4 client, Meta CAPI, Google Ads Enhanced Conversions, and TikTok Events API.
Full QA across all consent states and user journeys, BigQuery export, launch, and ongoing support for new product features.
Ongoing enterprise analytics partnership - initial implementation followed by continuous support as Treated's product evolves.
The Outcome
The engagement delivered more than a working implementation - it gave Treated an analytics foundation they can build on confidently as the platform continues to grow.
I've been working with Hitesh for over 4 years, and his expertise has been invaluable in implementing GA4 and GTM. His strong technical skills and thorough documentation make the process seamless and efficient.
Key Learnings
Healthcare analytics taught us lessons that apply across every privacy-sensitive implementation.
The race condition between Consent Initialisation triggers and the Google tag firing order is a real and common problem. Adding an explicit consent check directly on the Google tag — requiring analytics_storage to be granted before it fires — is the correct fix, not a workaround. It prevents both consent violations and _gl URL pollution in GA4 reports.
With iOS privacy restrictions, content blockers, and GDPR enforcement all tightening simultaneously, client-side measurement alone cannot be relied upon for marketing decisions at scale in a healthcare context.
Running browser pixels alongside server-side APIs without proper deduplication creates inflated conversion numbers that damage campaign optimisation. Getting this right is as important as getting the signals there in the first place.
When data flows through to a data warehouse, the naming and structure decisions made at the dataLayer level have long-term consequences. Designing with the warehouse in mind from the start avoids painful migration work later.