Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

logging page views and excluding web bots

Posted on 2010-11-22
5
337 Views
Last Modified: 2012-05-10
Hi,

I want to be able to do a count of how many times individual product pages are viewed on my webshop but need to log only visits made by actual users and exclude all web bots and search engine scans.
Does anyone know of a way to determine if the page view is an actual user?

Cheers
Leigh
0
Comment
Question by:Lmillard
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:effx
ID: 34187652
have you tried Google Analytics?
0
 

Author Comment

by:Lmillard
ID: 34187735
I do run analytics but this is for a component that sits in the ecommerce system itself
0
 
LVL 36

Accepted Solution

by:
SidFishes earned 250 total points
ID: 34188055
You can search for bots in the user agent string. I've shown just 3 in the example. There are over 300 listed at http://www.robotstxt.org/db.html so you'd have to add them to the regex string. This won't get -all- but it should be most.

caveat - not sure the impact of regex-ing a 300 word list on every page load so you'd want to watch performance.

<cfscript>
if (ReFindNoCase("Slurp|Googlebot|msnbot", CGI.http_user_agent )){
log= false;
} else {
log = true;
}
</cfscript>
 
<cfif log eq true>
your logging code
</cfif>

0
 
LVL 10

Assisted Solution

by:effx
effx earned 250 total points
ID: 34188423
@SidFishes Why would you exclude every bot? would the list not be smaller if you included only Browsers?
0
 

Author Closing Comment

by:Lmillard
ID: 34191052
I think between SidFishes logic and effx's suggestion of looking for the browser rather than the bots this should be perfect. Thanks both
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question