Removing cookie consent banners from your Lighthouse test


Many websites use cookie consent banners because they are required to do so by law if they want to use 3rd-party tools for analytics and marketing, or if they simply use cookies in order for the website to work.

When running Lighthouse tests - either in your browser or using a tool like PageVitals - you'll see the cookie consent banner in the resulting report, and none of the 3rd party tools will load.

This may give you a false impression of your site's performance. Sometimes it makes more sense to simulate that the user has already clicked "Accept all".

Configure the agent

Most cookie consent solutions rely on (duh) cookies to store the user's choice. Some solutions use a combination of cookies and localStorage variables.

In PageVitals, if you navigate to Settings and then Test agent you'll see that you can add both cookies and localStorage variables, as well as many other configuration options.

Here is a list of some well-known cookie consent solutions and how to simulate that the synthetic browser has accepted all cookies:

Quantcast Choice

Storage typeNameValue
Cookieeuconsent-v2...
Cookieaddtl_consent...
localStorageCMPList...
localStoragenoniabvendorconsent...
localStorage_cmpRepromptHash...

Note that the three dots is the actual value to be used.

Cookiebot

Storage typeNameValue
CookieCookieConsent{necessary:true, preferences:true, statistics:true, marketing:true, ver:2 }
Cookie__hstc1
Storage typeNameValue
CookieCookieInformationConsent{ "consents_approved": ["cookie_cat_necessary", "cookie_cat_functional", "cookie_cat_statistic", "cookie_cat_marketing", "cookie_cat_unclassified" ],"consents_denied":[] }

If you're using a different cookie consent provider, let us know and we'll try to add it to this list.

What is the consequence of adding these cookies?

When you choose to bypass the cookie consent banner when running Lighthouse tests, you'll simulate a user that has previously accepted cookies, but otherwise load the page with a cold HTTP cache and a cold DNS cache.