Lazarina Stoy
bite-sized marketing
1 min readApr 13, 2021

--

How to Filter Pagespeed Insights API Bot Traffic in Google Analytics.

Here is how to create a regex filter pattern in Google Analytics for the bot of Pagespeed Insights’ API before using it with Screaming Frog.

I am currently using Screaming Frog’s user interface to access the PageSpeed Insights API. PSI renders web pages to get lab data about their performance. This allows me to perform Core Web Vitals auditing for clients I do consultancy for.

However, it has a limitation.

Its instances appear to be recorded in Google Analytics as direct traffic, even when the ‘Exclude all hits from known bots and spiders’ view setting is enabled.

According to Screaming Frog, Google is aware of the issue and is working to resolve it. In the meantime, to stop PageSpeed Insights from falsely bloating GA data we can use a filter to exclude known Google IP addresses.

Copy and paste this filter pattern in the exclude section in the Google Analytics Settings:

^66\.249\.(6[4–9]|[7–8][0–9]|9[0–5])\.([0–9]|[1–9][0–9]|1([0–9][0–9])|2([0–4][0–9]|5[0–5]))$

filter out bot traffic from Pagespeed Insights API, when using Screaming Frog; settings from Google Analytics
Image courtesy of Screaming frog

Test that the filter works before using the PSI API.

~Last time I checked the filter works and excludes bot traffic successfully (last updated 13.April 2021)

--

--

Lazarina Stoy
bite-sized marketing

talks about wellbeing, productivity, marketing, and ML • Consultant, Speaker, Leader • lazarinastoy.comwww.mlforseo.com ✨ • www.womeninmarketing.bg 🇧🇬