Hello,

I tryed it before but didn't go ahead with the idea.

I was creating each document for each access, and put inside the document a
lot of info related to the request.

In my opinion all depends on the among of access you cite receive, but I'm
sure it isn't a sustainable way to store access histories. The databases
become huge I hours and maybe in minutes.

I think, if you want to do that with couchdb or other document databases,
you will need to think in a way to process those stored data before it
becomes to big and maybe store the result of this data into another database
with documents within processed data according to your needs.

Take a look at: https://github.com/fabiobatalha/Analytics---CouchDB
There are a javascript to be inserted into a website (like Google
Analytics). This javascript will store the following JSON in a couchdb
database.


  var location = { "latitude":
navigator.geolocation.getCurrentPosition.latitude,
           "longitude": navigator.geolocation.getCurrentPosition.longitude,
           "altitude": navigator.geolocation.getCurrentPosition.altitude,
           "accuracy": navigator.geolocation.getCurrentPosition.accuracy,
           "altitudeAccuracy":
navigator.geolocation.getCurrentPosition.altitudeAccuracy,
           "heading": navigator.geolocation.getCurrentPosition.heading,
           "position": navigator.geolocation.getCurrentPosition.position
       };

   var json = {
       "instance": val,
       "date": isoDate(),
       "time": isoTime(),
       "url": window.location.href,
       "host": window.location.host,
       "urlParams": urlParams(window.location.href),
       "referrer": document.referrer,
       "referrerParams":  urlParams(document.referrer),
       "location": location,
       "appCodeName": navigator.appCodeName,
       "appVersion": navigator.appVersion,
       "cookieEnable": navigator.cookieEnable,
       "language": navigator.language,
       "platform": navigator.platform,
       "product": navigator.product,
       "userAgent": navigator.userAgent,
       "vendor": navigator.vendor,
       "vendorSub": navigator.vendorSub
   };


Regards,
*Fabio Batalha C. Santos*
Colegiado SciELO
www.scielo.org
FAPESP - CNPq - BIREME - FapUNIFESP



On Tue, May 10, 2011 at 6:05 AM, He Shiming <heshim...@gmail.com> wrote:

> Hi,
>
> I'm working on this project, that needs to count page views. I came up
> with two possible solutions:
>
> 1. For each page to be counted, use a single count document, and an
> update handler to count on each page view
> 2. Create a new document on each page view, this way I get to record a
> history of views, which I prefer
>
> I was wondering if the second method will consume too much space and
> CPU on a heavy traffic website. If I need the log of page views, it
> looks like this is the only way. But is it the correct and optimal way
> of doing counters?
>
> Or should I pick an alternative database for counters?
>
> --
> Best regards,
> He Shiming
>

Reply via email to