0

I have a django application hosted on a server running on Apache + Ubuntu. I deployed the application using mod_wsgi. Is there any way to find out the number of visitors to my web site.

I realize that this query might have little to do with django and more do with the server. Any help would be appreciated.

unni
  • 2,891
  • 4
  • 19
  • 22

4 Answers4

1

How about using some free statistics provider like Statcounter or Google Analytics?

Uku Loskit
  • 40,868
  • 9
  • 92
  • 93
1

Why not just use Google Analytics? You can easily monitor user behavior, traffic source, time spend on each page, etc.

If you really want to do this with Django you could write a context processor to record each request, but then you would have to write the user's IP and check if the user has not visited before and this would be incredibly imprecise since there might be different users sharing the same IP, etc.

Raphael
  • 7,972
  • 14
  • 62
  • 83
0

There's also this free and powerful Django app Chartbeat that you could try to work with.

Chartbeat provides real-time analytics to websites and blogs. It shows visitors, load times, and referring sites on a minute-by-minute basis. The service also provides alerts the second your website crashes or slows to a crawl.

daniellambert
  • 109
  • 1
  • 8
0

If you don't want to use Google Analytics or similar, but do it all yourself, you have two options:

One is to alter all views, if you are using class-based view then add a mixin (see this SO question for more information about mixins,) or if you are using the old function-based view you have to manually call another function to keep track.

The other alternative, and probably best one, is to write a middleware class, and keep track through that.

Community
  • 1
  • 1
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621