Matty B
Matty B

Reputation: 1068

What is the name of the Google PageSpeed User Agent?

This page indicates that it uses a custom user agent but it does not mention the name. I would like to be able to run some logic if the user agent is from PageSpeed. What is the name of the Google PageSpeed user agent?

Upvotes: 21

Views: 35884

Answers (14)

yannickoo
yannickoo

Reputation: 126

Update for March 2024

I just had to verify the answered above and can confirm that in 2024
Google is setting Chrome-Lighthouse in all of the following user agents ⬇️

PageSpeed Insights

Mobile

Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4590.2 Mobile Safari/537.36 Chrome-Lighthouse

Desktop

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4590.2 Safari/537.36 Chrome-Lighthouse

Publisher Ads Audits for Lighthouse

Mobile

Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Mobile Safari/537.36 Chrome-Lighthouse Google-AdSpeed-Insights

Desktop

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Safari/537.36 Chrome-Lighthouse Google-AdSpeed-Insights


Note: It seems like Chrome-Lighthouse has been removed in this pull request to avoid cheating here but it is currently still shown in the user agent.

The recommended way by Paul Irish is to use a query parameter like ?isLighthouse for testing.

Upvotes: 3

Andrew Zyuzin
Andrew Zyuzin

Reputation: 1

Current data for today:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36(KHTML, like Gecko) Chrome/94.0.4590.2 Safari/537.36 Chrome-Lighthouse

Upvotes: 0

Marcin Dargacz
Marcin Dargacz

Reputation: 146

Update for March 2023

Google Page Speed Insights updated instance of Lighthouse to version 10.x and this event changes User-Agents:

For mobile:

Mozilla/5.0 (Linux; Android 11; moto g power (2022)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36"

For Desktop:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"

Passing Chrome-Lighthouse string has been stopped.

More details is here: https://github.com/GoogleChrome/lighthouse/pull/14384

Upvotes: 6

Grimm
Grimm

Reputation: 791

July 2021 (according to our logs):

Mobile agent is the same as in Ghassan Maslamanis answer from February 2021.

Desktop user agent is now:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.175 Safari/537.36 Chrome-Lighthouse

So they put the "Chrome-Lighthouse" back at the end of the string like they already did in May 2020 according to Oleg Kopachovets answer.

Upvotes: 5

Ghassan Maslamani
Ghassan Maslamani

Reputation: 809

I have just made a test, requested my site and checkout logs in real time.

User-Agent logs

Web Client test: @ https://developers.google.com/speed/pagespeed

date : "21/Feb/21"
user-agent-mobile : "Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.175 Mobile Safari/537.36 Chrome-Lighthouse",
user-agent-desktop :  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.175"

node-cli lighthouse --version @ 7.1.0:

command : `lighthouse example.com --view`
date : "21/Feb/21"
user-agent-mobile : "Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4143.7 Mobile Safari/537.36 Chrome-Lighthouse",
user-agent-desktop :  "Mozilla/5.0 ($ENV_OS) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/$ENV_CHROME Safari/537.36"

Note that for the user-agent-desktop in the node-cli for test, there are two variables $ENV_OS and $ENV_CHROME which will vary according to the running envirmoent.

Upvotes: 5

Oleg Kopachovets
Oleg Kopachovets

Reputation: 79

May 2020, there you go:

Mobile:

Mozilla/5.0 (Linux; Android 7.0; Mo to G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4143.7 Mobile Safari/537.36 Chrome-Lighthouse

Desktop:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4143.7 Safari/537.36 Chrome-Lighthouse

Upvotes: 7

nico_lrx
nico_lrx

Reputation: 290

In 2020 :

  1. Chrome-Lighthouse : for mobile
  2. Google Page Speed Insights : for desktop

Upvotes: 7

Mohamed El Mrabet
Mohamed El Mrabet

Reputation: 633

Check if we have

like Gecko

In $_SERVER['HTTP_USER_AGENT']

Upvotes: -3

Sjaak Wish
Sjaak Wish

Reputation: 475

Dec - 2019

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Safari/537.36 Chrome-Lighthouse

Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Mobile Safari/537.36 Chrome-Lighthouse

Upvotes: 1

kilinkis
kilinkis

Reputation: 602

This regex matches the UA as of the time of this answer:

// javascript PSI regex
navigator.userAgent.match(/nux.*oto\sG|x11.*fox\/54|x11.*ome\/39|x11.*ome\/62|oid\s6.*1.*xus\s5.*MRA58N.*ome|JWR66Y.*ome\/62|woobot|speed|ighth|tmetr|eadle/i)
// taken from WP plugin Fast Velocity Minify

Use it responsibly 🙌🏻 and avoid using document.write if you plan to inject js.

Upvotes: -2

Checking the User Agent from Google Page Speed Insights these are the two instances of the service to check mobile and web

{   "pattern": "Chrome-Lighthouse",
    "instances": [
      "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Safari/537.36 Chrome-Lighthouse",
      "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Mobile Safari/537.36 Chrome-Lighthouse"
    ]}

i'm using these object to validate with a regex if the user agent is a bot

regex = RegExp("Chrome-Lighthouse","ig")
regex.test("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Safari/537.36 Chrome-Lighthouse")

Upvotes: -1

Dmitrii Fediuk
Dmitrii Fediuk

Reputation: 410

The information in other answers is outdated: currently, Google PageSpeed does not pass the «Google Page Speed Insights» string in its User-Agent HTTP header, it passes the «Chrome-Lighthouse» string instead.
An example:

Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36(KHTML, like Gecko) Chrome/69.0.3464.0 Mobile Safari/537.36 Chrome-Lighthouse

Please note that the string is exactly «Chrome-Lighthouse» even if you run Google PageSpeed in other browsers (e.g. Firefox).

Upvotes: 15

ghmulchandani
ghmulchandani

Reputation: 304

I created a script, it returns two USER AGENT one for desktop and other for mobile, these are

for MOBILE:

Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko; Google Page Speed Insights) Chrome/27.0.1453 Mobile Safari/537.36

FOR DESKTOP

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko; Google Page Speed Insights) Chrome/27.0.1453 Safari/537.36

Upvotes: 8

Stand__Sure
Stand__Sure

Reputation: 278

This source (http://riskyinternet.com/google-page-speed-insights-tool-open-for-use-by-scammers/) suggests that the UA string looks like this:

“Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.8 (KHTML, like Gecko; Google Page Speed Insights) Chrome/19.0.1084.36 Safari/536.8”

Upvotes: 1

Related Questions