I've developed a web application in django, and I'm interested in accurately knowing how many people visited certain pages and keeping that info in my database. As I was already running some code whenever a page was loaded, I had a small bit of code that increased the counter in 1.
However, when implementing memcached in this application, the cached pages are served statically and the c开发者_开发百科ode is not executed. I'm thinking on adding javascript code in the page that tells the server the page has been served, but somehow that doesn't look like the best idea.
Is there any way to compromise between having memcached statically provide the dynamic pages as long as they don't change, but still be able to know the page has been served for statistical purposes in my database?
Thanks in Advance!
A) Use Google Analytics to determine within 2% your page views
B) Build an app to hold request data (time, browser, IP, etc) and create middleware that stores info about each request in that app. Place this middleware above your cache middleware.
精彩评论