HaLo2FrEeEk Posted February 17, 2009 Share Posted February 17, 2009 I have a click counter on some of the links on my frontpage. What it does is, obviously, counts the number of times a link has been clicked. It's very simple with no checks in place, meaning anyone could come and click it 100 times, and the count would just go right on up. What I wantto do, though, is exclude Googlebot from the counting process. I don't care if we get extra clicks from people, but I don't want search bots like googlebot, yahoo bot, etc. to influence the click counter. I know that Googlebot's IP range is 66.249.*.* (I think), but is there a better way? I mean, what if googlebot changes it's IP range? Anyone have any tips? Link to comment https://forums.phpfreaks.com/topic/145657-not-counting-googlebot-in-click-counter/ Share on other sites More sharing options...
trq Posted February 17, 2009 Share Posted February 17, 2009 You could check the user-agent. eg; if (!preg_match("^Mozilla\/5\.0 \(compatible\; Googlebot", $_SERVER['USER_AGENT']) && !preg_match("^Mozilla\/5\.0 \(compatible\; Yahoo! Slurp", $_SERVER['USER_AGENT'])) { // user not a bot. } Link to comment https://forums.phpfreaks.com/topic/145657-not-counting-googlebot-in-click-counter/#findComment-764672 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.