Skip to content

Client CWV: defer tsjs bundle, CLS min-height injection, disableInitialLoad #854

Description

@aram356

Description

From the 2026-07-05 performance & architecture review (client-side web vitals section, items 1/2/4).

Three direct Core Web Vitals wins that the server can deliver, since it already knows every slot's configured formats:

  1. Defer the main tsjs bundle. It is a synchronous parser-blocking script prepended at the very start of <head> (tsjs.rs:13-18), ahead of the publisher's CSS and preloads, plus 7.3 KB of inline GPT bootstrap per page. Inline only the few hundred order-sensitive bytes (googletag stub, cmd patch, script guards) and defer the rest; audit which integrations genuinely need to be parser-blocking.
  2. CLS min-height injection. No CLS protection today despite the server knowing every slot's formats: inject a <style> block at head-open with per-slot min-height from the smallest configured format. Server-side injection applies before first paint; a guaranteed-CLS fix that costs a few lines.
  3. disableInitialLoad() to kill the double GAM request. Reused publisher-owned slots fire twice (request without hb_*, then TS refresh with it): visible creative replacement plus ~2x GAM request volume. Queue disableInitialLoad() from the head bootstrap, which runs before the publisher's GPT setup.

Effort / expected effect

  • Effort: Small each
  • Expected effect: Direct CWV wins; removes double GAM requests.

Sequencing item 8 of 10.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions