Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

logging page views and excluding web bots

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
Lmillard
Asked:
Lmillard
  • 2
  • 2
2 Solutions
 
effxCommented:
have you tried Google Analytics?
0
 
LmillardAuthor Commented:
I do run analytics but this is for a component that sits in the ecommerce system itself
0
 
SidFishesCommented:
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
 
effxCommented:
@SidFishes Why would you exclude every bot? would the list not be smaller if you included only Browsers?
0
 
LmillardAuthor Commented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now