sahava / multisite-lighthouse-gcp

Run Lighthouse audits on URLs, and write the results daily into a BigQuery table.
MIT License
46 stars 25 forks source link

Passing --blocked-url-patterns in config.json #8

Open goranculibrk opened 5 years ago

goranculibrk commented 5 years ago

Hi there, I'm trying to pass an argument to the lighthouse, which would block Google Analytics. Here's the code from config.json.

"lighthouseFlags": { "output": ["html", "csv"], "emulatedFormFactor": "desktop", "blocked-url-patterns": [ "*www.google-analytics.com/analytics.js*" ] }

Based on Lighthouse documentation, it's possible to pass that argument. I've tried passing just the URL, without brackets, it didn't work, then I tried using the brackets without the asterisk and it didn't help. Any idea how to block requests for this url: www.google-analytics.com/analytics.js?

My goal is to perform audit reports but without notifying google analytics about it, since running 100-200 tests on websites that have maybe 1, 2000 monthly visitors would mess the data.

goranculibrk commented 5 years ago

Actually, after a little bit of digging, figured it out. I was using blocked-url-patterns instead of blockedUrlPatterns. The full code that's working properly from what I can see is:

"lighthouseFlags": { "output": ["html", "csv"], "emulatedFormFactor": "desktop", "blockedUrlPatterns": [ "www.google-analytics.com/analytics.js" ] }

danderson421 commented 5 years ago

You could just filter your traffic from analytics...