Cozmo Scan My SEO Logo

Diagnosing TBT and CLS: A Deep Dive into Complex Core Web Vitals Bottlenecks

Diagnose Diagnosing TBT and CLS, interpret the evidence, choose a proportionate fix, and verify the result without introducing a regression.

Run an Audit

Advanced CWV Troubleshooting: Isolating TBT and CLS Caused by External Dependencies

Core Web Vitals (CWV) are user-centric metrics designed to measure the real-world experience of your website, directly impacting user retention and search visibility web.dev. When performance degrades beyond what basic optimizations address, the issue often lies in complex interactions involving third-party scripts or intricate CSS loading, leading to poor TBT and CLS. This guide provides a layered diagnostic workflow for performance engineers and senior SEOs to systematically isolate these external bottlenecks and implement targeted fixes.

The Impact: Why TBT and CLS Fail Standard Optimization

Poor TBT hinders interactivity, meaning users experience delays before they can interact with the page, which negatively affects engagement. Simultaneously, high CLS causes layout instability, where content jumps around as resources load, leading to visual frustration and potential abandonment. Both issues signal poor page experience to search engines, which use these metrics as signals for ranking quality Google Search Central. If a user is blocked waiting for a third-party analytics script to execute, or if a dynamically injected ad causes content to shift unexpectedly, the resulting poor experience directly impacts user retention and search visibility.

Defining Advanced CWV Troubleshooting: The Dependency Isolation Workflow

Advanced CWV troubleshooting is a systematic workflow that moves beyond checking basic metrics to actively hunting for the external code or CSS rule causing the performance degradation. This process requires distinguishing between how a site functions in a controlled development environment and how real users experience it, as this difference often masks the true source of the problem. The workflow follows a clear path: Observe $\rightarrow$ Hypothesize $\rightarrow$ Isolate $\rightarrow$ Test Fix $\rightarrow$ Verify. The goal is to pinpoint the specific third-party element causing the measurable degradation, rather than applying broad, non-targeted optimizations web.dev.

Diagnosing TBT: Isolating Blocking Third-Party Scripts

Total Blocking Time (TBT) occurs when long-running JavaScript tasks monopolize the main thread, preventing the browser from responding to user input web.dev. To diagnose TBT caused by external scripts, use the browser's Performance tab in DevTools to identify long tasks.

  1. Record a Load: Start a performance recording while navigating to the affected page.
  2. Analyze the Main Thread: Focus on the 'Long Tasks' section. These tasks indicate periods where the main thread was blocked for more than 50ms, directly contributing to TBT.
  3. Trace the Source: Examine the flame chart associated with the long task. The stack trace will point to the specific JavaScript file responsible for the blocking execution. If the script is third-party (e.g., an ad network or analytics tracker), this is your TBT culprit. Note that scanning the stack trace for external domain names or known third-party library signatures can quickly identify the source web.dev.

Once the script is identified, the fix involves modifying its loading behavior. For scripts that do not need to execute immediately upon page load, apply attributes like defer or async to prevent them from blocking the main thread during initial rendering.

Diagnosing CLS: Pinpointing Layout Shift Sources in External CSS/Assets

Cumulative Layout Shift (CLS) measures visual stability by tracking how often elements shift position unexpectedly during the page lifecycle. When CLS is high due to external factors, the cause is usually a late-loading image or an element without a reserved space defined by its parent or CSS rules.

  1. Capture Layout Shifts: Use the Layout Shift recording feature in DevTools. This captures all layout shifts that occur during the recording period.
  2. Identify the Culprit Element: Review the recorded shifts. Determine which element moved and when the shift occurred.
  3. Inspect the Source: Trace the element back to its source. If the shift is caused by an image or embedded resource, check the CSS rules governing that element. Look for missing width and height attributes, or dynamic styling that fails to reserve space for content that loads later, such as dynamically injected banner ads web.dev.

The targeted fix for CLS often involves explicitly reserving space. For images, this means setting explicit dimensions. For dynamically loaded content, ensure the container element has a defined height or aspect ratio set via CSS to prevent content from shifting when the external resource finally renders.

Remediation Matrix: Targeted Fixes for External CWV Bottlenecks

The final stage translates diagnostic findings into surgical code changes. The fix must directly address the identified source:

Diagnosed Culprit CWV Metric Affected Targeted Remediation Action Verification Step
Third-Party Script Blocking Main Thread TBT Apply defer or async attributes to the script tag. Re-run diagnostic workflow (Section 003); confirm the long task disappears or is significantly reduced.
Late-Loading Image/Ad Without Dimensions CLS Add explicit width and height attributes to the <img> tag or use CSS aspect ratio boxes. Re-run Layout Shift recording; confirm the specific element no longer shifts upon load.
Inefficient CSS Injection TBT/CLS Audit external CSS files for complex selectors or large, unoptimized rule sets; consider inlining critical CSS. Re-run both recordings; check if main thread activity and layout instability metrics improve.

Verification Loop

After implementing any fix, you must re-run the diagnostic workflow (Sections 003 and 004) to confirm the specific bottleneck has been eliminated. If TBT was the issue, verify that the main thread is no longer blocked by the targeted script. If CLS was the issue, verify that the layout shift recording shows no significant movement for the affected elements. Success is confirmed when the specific performance metric associated with the external dependency returns to an acceptable range, allowing you to iterate on the next potential bottleneck.

Get more from ScanMySEO

Run an audit to see which technical, content, accessibility, performance, and UX issues need attention first.

Run an Audit
Hansel McKoy

Hansel McKoy is the founder of ScanMySEO and a technical SEO specialist with more than 10 years of experience across agency, in-house, public-sector, and founder-led roles.

Hansel McKoy

Founder of ScanMySEO


Get More Out of ScanMySEO