Web Hosting Talk







View Full Version : maximum cookie size and referral tracking


breps
03-28-2006, 11:30 PM
hi,

I need to write a simple addon to an e-commerce site that tracks a users referral.
As I started writing it, I thought of an easy way to track it plus I expanded it to track every page hit.... It basically just catches the http referral on every page and logs it into a cookie.

I am concerned though that there may be a limit on the cookie size and that this may slow down page browsing as the user navigates the site. I can log it into a database but I didnt want to really go this route as I think it may create more traffic to the db, or should I be doing this instead????

What is the maximum size of a cookie, and what would happen when the limit is reached? And, are there any good solutions out there that already exist to do this? I am writing the code in ASP 3, I am open to suggestions in PHP also as I can understand it and rewrite code into ASP very easily.

Thank you for any suggestions.

zoid
03-29-2006, 02:04 PM
So you would append each new referrer to this cookie's value? I do not know the exact limitations and think they are probably browser specific but according to Netscape's cookie specification (http://wp.netscape.com/newsref/std/cookie_spec.html) a cookie should not be larger than 4 KB (4096 bytes) - however this might be outdated.

What about storing the referrers in a session variable?

Burhan
03-29-2006, 02:14 PM
No, its still valid. Including the 20 cookies per server/domain limit.