What is the name of the Google PageSpeed User Agent?
Asked Answered
P

14

20

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?

Preestablish answered 6/5, 2013 at 16:46 Comment(0)
C
15

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).

Cowper answered 23/11, 2018 at 12:44 Comment(4)
Probably outdated now too, just tried it and neither "Google Page Speed Insights" or "Chrome-Lighthouse" work.Biltong
This does not work anymore. Page Speed Insights powered by Lighthouse uses a default userAgent, that cannot be detected anymore :(Wynne
@Wynne that may have been true in June '20 but either way the API sends a 'Chrome-Lighthouse' user agent now (March '21)Couture
@Jake1986 Right now PageSpeed says it sends a user-agent with "Chrome-Lighthouse", but in reality it doesn't do this at all. I echoed the user-agent and it was a completely different one. It didn't include anything like "lighthouse" or "pagespeed".Ametropia
F
8

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

Fearfully answered 28/4, 2016 at 16:25 Comment(0)
A
7

In 2020 :

  1. Chrome-Lighthouse : for mobile
  2. Google Page Speed Insights : for desktop
Accomplishment answered 11/4, 2020 at 13:57 Comment(0)
B
7

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

Burt answered 30/5, 2020 at 4:0 Comment(1)
It is valid on 2022, except it is not "Mo to", but "Moto.Threnody
D
6

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

Disk answered 14/3, 2023 at 7:53 Comment(2)
Oh no... now we have to remove all Google products that really were the cause for low LH scores. Google Analytics, Google Ad Manager, Google Tag Manager, Google AdSense just to name a few. Without these it was always 80-90%+ on LH. I guess it's 2 teams at Google. One that works on improving performance and one that kills it. Someone needs to get the two in touch, LOL...Angelangela
I checked the access_logs today and they still included 'Chrome-Lighthouse' in the UA.Moleskins
H
5

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.

Haynor answered 21/2, 2021 at 16:57 Comment(1)
I just checked my access logs after running the API in both desktop and mobile and can confirm this is correct.Couture
P
5

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.

Plague answered 20/7, 2021 at 10:57 Comment(0)
H
1

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”

Hesperian answered 16/8, 2013 at 21:1 Comment(0)
T
1

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

Tee answered 24/12, 2019 at 0:25 Comment(0)
T
1

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.

Trapezohedron answered 11/3 at 0:25 Comment(0)
R
0

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

Radiophone answered 26/5, 2023 at 14:22 Comment(0)
S
-1

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")
Sinful answered 27/3, 2019 at 21:26 Comment(0)
B
-2

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.

Biltong answered 10/4, 2019 at 8:19 Comment(0)
P
-3

Check if we have

like Gecko

In $_SERVER['HTTP_USER_AGENT']

Pegu answered 5/2, 2020 at 11:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.