Skip to main content

Third-Party Providers Blocking Main Thread

Priority: Critical

Impact: Negative

What issues it may cause​

  • Delayed interactivity: While third-party code runs, the page can't respond to clicks, taps or typing, so users wait longer before they can use it.

  • Slower rendering: Scripts that run early in the page load can delay your own content from appearing.

  • Bigger impact on mobile: The same code takes longer to run on lower-powered devices, so mobile users feel the delay most.

  • Unpredictable performance: Providers host and update their own code, so its size and run time can change without any change to your site.

How do you fix it​

  • Remove what you don't need: Review every third-party script, including tags added through a tag manager, and remove any that no longer add value.

  • Load non-critical scripts with async or defer: Add the async or defer attribute to scripts that aren't needed for the first render.

  • Load embeds on interaction: Use a facade or lazy loading for chat widgets, video players and social embeds so they load only when a user interacts with them. The Third-Party Resources Not Deferred report lists candidates.

  • Connect early to essential providers: Use preconnect or dns-prefetch for third-party domains the page needs during load.

Learn more about reducing the impact of third-party code.

What is the positive impact​

  • Faster response to user input: Less main thread blocking means the page reacts sooner to clicks, taps and typing.

  • Better responsiveness scores: Reducing main thread blocking lowers Total Blocking Time and can improve Interaction to Next Paint (INP), one of Google's Core Web Vitals.

  • Better experience on mobile: Users on lower-powered devices see the biggest gains.

How to fetch the data for this report template​

You will need to run a crawl for report template to generate report. When report has been generated and you have crawl id you can fetch data for the report using the following query:

Operation: query GetReportStatForCrawl( $crawlId: ObjectID! $reportTemplateCode: String! $after: String ) { getReportStat( input: {crawlId: $crawlId, reportTemplateCode: $reportTemplateCode} ) { crawlSiteSpeedAuditOpportunities(after: $after, reportType: Basic) { nodes { opportunityDigest element title auditId exampleUrl blockingTimeSecsSum blockingTimeSecsAvg subItems failedAuditsCount warningAuditsCount infoAuditsCount } totalCount pageInfo { endCursor hasNextPage } } } }Variables: {"crawlId":"TjAwNUNyYXdsNDAwMA","reportTemplateCode":"third_party_summary_failed_items"}
GetReportStatForCrawlTry in Explorer
GraphQL
query GetReportStatForCrawl(
$crawlId: ObjectID!
$reportTemplateCode: String!
$after: String
) {
getReportStat(
input: {crawlId: $crawlId, reportTemplateCode: $reportTemplateCode}
) {
crawlSiteSpeedAuditOpportunities(after: $after, reportType: Basic) {
nodes {
opportunityDigest
element
title
auditId
exampleUrl
blockingTimeSecsSum
blockingTimeSecsAvg
subItems
failedAuditsCount
warningAuditsCount
infoAuditsCount
}
totalCount
pageInfo {
endCursor
hasNextPage
}
}
}
}