Repository navigation
Open
Copy link
Milestone
Description
Description
The 2026-07-05 performance and architecture review grouped three possible client performance changes: defer the main tsjs bundle, reserve slot space to reduce layout shift, and avoid duplicate initial ad requests. They need separate compatibility checks before implementation. The original 7.3 KB bootstrap size and “guaranteed CLS fix” are review-era assertions, not current measurements.
Current behavior
- The main tsjs bundle is still inserted synchronously near the start of
<head>(html_processor.rs:317-349;tsjs.rs:15-44). Deferred integration modules are already supported separately. GPT also injects an inline bootstrap (integrations/gpt.rs:493-540), whose order-sensitive behavior must be preserved. - No general per-slot
min-heightinjection appears in the head-insert path. Slot formats are available in configuration, but responsive formats and unknown/variable creative heights need a sizing policy before a style can safely reserve space. - GPT now has first-impression claims and handoff logic. The bootstrap refreshes reused publisher-owned slots to apply server-side targeting and avoids a second request for TS-owned slots when initial load is enabled (
gpt_bootstrap.js:730-891). A blanketdisableInitialLoad()call could alter publisher-owned behavior or leave slots blank. Duplicate requests should be measured on a specific call sequence before changing the load policy.
Proposed work
- Bundle loading: Inventory code that must execute before publisher scripts. Keep that small bootstrap inline, defer only code proven safe to load later, and check script ordering across immediate and deferred integrations. Compare navigation timings and failure behavior before and after.
- Slot reservation: Define how a slot's configured formats map to height across breakpoints, including fluid/unknown formats. Inject a narrowly scoped early style only where a safe reservation can be derived; test pages with and without matching slots and measure layout shift.
- GPT initial load: Capture a reproducible publisher-owned-slot sequence and count native
display/refreshrequests, includinghb_*targeting on the first impression. Fix any confirmed duplicate with the narrowest ownership-aware change. EvaluatedisableInitialLoad()only if it preserves existing publisher setup and the required initial request for TS-owned slots.
Done when
- A dependency inventory and browser test show the main bundle can defer without breaking early integration initialization or ad startup; otherwise record the blocking dependencies.
- Slot-height rules and tests cover responsive and unknown formats, with measured layout-shift effect rather than a claimed guaranteed result.
- A request-count test reproduces any duplicate GAM request, and the fix yields one intended initial request with server-side targeting for both TS-owned and publisher-owned slots.
- Before/after page measurements report the actual CWV and ad-request effects.
Related
- Original review: 2026-07-05 performance and architecture review, client-side web vitals items 1, 2, and 4; sequencing item 8 of 10.
Metadata
Metadata
Assignees
Labels
No labels
Activity
Complete client CWV loading and reservation coverage