How to block domains in Lighthouse

June 6, 2020

We all know that third-party JavaScript and Ads have a big impact on performance.

To know how much of an impact third-party JavaScript and Ads have on our performance we need to be able to measure our websites performance without them.

As of now, this feature is not available in google chrome directly, so we have to use the Lighthouse CLI.

1. Download the Lighthouse CLI

  npm install -g lighthouse

2. Create a Lighthouse config file

module.exports = {
  extends: "lighthouse:default",
  settings: {
    onlyCategories: ["performance"],
    blockedUrlPatterns: [

You use the blockedUrlPatterns array to specify which domains you want to block.

"*"; // Blocks
// Blocks
// Blocks

There is no other way to block domains using more complex patterns.

3. Run Lighthouse

lighthouse --config-path=path/to/custom-config.js

4. Get correct results

Make sure to run Lighthouse at least 3 times if you want somewhat accurate results.