Instrumenting seven ad-lifecycle events, building the CMS, then reordering execution
Ad metrics lived in several places, so no one could name the bottleneck. I defined the events, collected them, split the path in BigQuery, then changed the order in which the bundle and the ad script run.
- GA4
- BigQuery
- React
- TypeScript
- Node.js
Specification
- Organisation
- Nudge Healthcare
- Period
- 2024
- Instrumentation
- Seven events from ad request through click
- Deliverables
- Event schema, BigQuery analysis, company-wide ad CMS
- Role
- Event design, data analysis, CMS product and development, loading optimisation
Context
Advertising data was scattered. Revenue, impressions, clicks and failures could not be read on one screen, and when something went wrong there was no way to name the segment where the delay or failure happened.
Reading a metric required a developer to run a query. Operators had no path to the ad's current state.
Approach
I designed events to trace the ad lifecycle segment by segment — seven stages from request to click, among them ad_request, response, impression, failed and clicked.
GA4 collected the events and BigQuery analysed them, which turned request → impression → failure → click into per-segment data.
I specified and built a CMS that gathers company-wide ad data in one place: revenue, click-through rate, impressions, requests and failures, broken down by medium and by placement, so operators could read it without a developer.
With that data I analysed the full path to impression. Comparing the execution order of the React bundle and the ad script showed the ad logic waiting on the bundle.
I reordered the two so an ad request no longer depends on the whole application finishing execution.
After deploying I measured P90 loading time with the same events, then followed the effect through to click-through rate and placement revenue.
System
The ad request no longer waits for the bundle.
Before, the React bundle ran after HTML parsing and the ad request came after that. After, the ad request and the bundle no longer wait on each other.
Measured
Before: 4–5 sAfter: 2–3 s
Measured with the same events before and after the reordering.
+30%
Ads appeared sooner, so more of them were actually seen.
+20%
The performance change was verified through to a business metric.
7
The units that split the path from request to click.
Boundaries
- The ad network's own response time was outside my control; what changed was the execution path on our side.
- The CTR and revenue figures are for that placement, not for company-wide ad revenue.
- Five of the seven event names are given because they are confirmed; the remaining names are omitted rather than guessed.
- What the CMS displays combines data collected and aggregated through GA4 and BigQuery with metrics supplied by the ad platforms. The source data itself was not under my control.