Title: Lighthouse User Agent
Last modified: May 1, 2023

---

# Lighthouse User Agent

 *  Resolved [arfanzr77](https://wordpress.org/support/users/arfanzr77/)
 * (@arfanzr77)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/lighthouse-user-agent/)
 * You have write some user agent to be ignored from script.js (/bot|crawl|spider
   |seo|lighthouse|preview/i). But when i check Google page speed insight it still
   increase the number of page views.
 * Just note : I use WP Fastest Cache.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Danny van Kooten](https://wordpress.org/support/users/dvankooten/)
 * (@dvankooten)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/lighthouse-user-agent/#post-16702931)
 * Hello,
 * [Google stopped passing an identifiable User-Agent string ](https://github.com/GoogleChrome/lighthouse/pull/14384)
   because of developers gaming the system in order to get better scores, thus impressing
   clients while their actual website was still slow.
 * Therefore we can no longer reliably remove Google Lighthouse hits from Koko Analytics,
   unless you include an easily detectable identifier in the URL yourself and write
   some code to instruct Koko Analytics to not record hits to this URL.
 * Here’s a sample snippet on how to disable tracking for certain URL’s: [https://github.com/ibericode/koko-analytics/blob/master/code-snippets/disable-tracking-on-certain-urls.php](https://github.com/ibericode/koko-analytics/blob/master/code-snippets/disable-tracking-on-certain-urls.php)
 * I hope that helps.
 * Danny
 *  Thread Starter [arfanzr77](https://wordpress.org/support/users/arfanzr77/)
 * (@arfanzr77)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/lighthouse-user-agent/#post-16703369)
 * Thanks Danny,
 * If I cant catch Lighhouse user-agent, Can i Exclude Lighthouse IP ?? E.g : 66.249.
   xx.xx (Lighthouse IP)
 *  Plugin Support [Lap](https://wordpress.org/support/users/lapzor/)
 * (@lapzor)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/lighthouse-user-agent/#post-16703599)
 * You could adjust this code snippet to look for an IP instead of a UserAgent
 * [https://github.com/ibericode/koko-analytics/blob/master/code-snippets/ignore-tracking-for-certain-user-agents.php](https://github.com/ibericode/koko-analytics/blob/master/code-snippets/ignore-tracking-for-certain-user-agents.php)
 *  Thread Starter [arfanzr77](https://wordpress.org/support/users/arfanzr77/)
 * (@arfanzr77)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/lighthouse-user-agent/#post-16703756)
 * I used tthis…
 *     ```wp-block-code
       // Disable Tracking by remote IP Address - Koko Analytic
       add_filter( 'koko_analytics_load_tracking_script', function() {
           $ip_address = $_SERVER['REMOTE_ADDR'];
           $excluded_ip_addresses = array(
               '127.0.0.1',
               '114.79.0.0',
           );
           if (in_array($ip_address, $excluded_ip_addresses, true)) {
               return false;
           }
   
           return true;
       });
       ```
   
 * Unfortunately it does’t work with Cache Plugin. These snippet make script disapear..
 *  Plugin Support [Lap](https://wordpress.org/support/users/lapzor/)
 * (@lapzor)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/lighthouse-user-agent/#post-16704375)
 * What caching do you use that you think is preventing this from working?
   I recommend
   you also check if $_SERVER[‘REMOTE_ADDR’] is indeed returning the visitors IP,
   that depends on your server configuration. It might be returning an array of 
   IPs if there is some proxy in between. or it may not return anything.
 *     ```wp-block-code
       // Disable Tracking by remote IP Address - Koko Analytic
       add_filter( 'koko_analytics_load_tracking_script', function() {
           $ip_address = $_SERVER['REMOTE_ADDR'];
           echo "<!-- DEBUG: ". $_SERVER['REMOTE_ADDR']." -->";
           $excluded_ip_addresses = array(
               '127.0.0.1',
               '114.79.0.0',
           );
           if (in_array($ip_address, $excluded_ip_addresses, false)) {
               return false;
           }
   
           return true;
       });
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Lighthouse User Agent’ is closed to new replies.

 * ![](https://ps.w.org/koko-analytics/assets/icon.svg?rev=2980600)
 * [Koko Analytics - Privacy-Friendly WordPress Analytics](https://wordpress.org/plugins/koko-analytics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/koko-analytics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/koko-analytics/)
 * [Active Topics](https://wordpress.org/support/plugin/koko-analytics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/koko-analytics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/koko-analytics/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Lap](https://wordpress.org/support/users/lapzor/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/lighthouse-user-agent/#post-16704375)
 * Status: resolved