PDA

View Full Version : Can you help me? Cookie stuff.



LastActionHero
July 6th, 2001, 07:31
I want to do something like this.

Page A.html
Embed a cookie originating from mydomainname with a dynamically generated date and time as it's value.

Page B.php
Read the cookie from the users hard drive(if it exists) and read the date and time and store it in a flat file (text file) on the server in a organized manner i.e. comman seperated or tabbed.
This can be done with javascript or php.

Can you please help me with this i'm not good with cookies or php.

puDDs
July 6th, 2001, 22:43
So essentially, you're trying to log repeat visits? Is that right? If that's the case, I don't think its invasive, as long as you don't start stamping those visits with IP addresses too. Personally, I don't care if sites wnat to see if I've been there before, as long as they don't store any personally identifiable info, like an IP address.

LastActionHero
July 7th, 2001, 00:40
Originally posted by puDDs
So essentially, you're trying to log repeat visits? Is that right? If that's the case, I don't think its invasive, as long as you don't start stamping those visits with IP addresses too. Personally, I don't care if sites wnat to see if I've been there before, as long as they don't store any personally identifiable info, like an IP address.

No IP address is involved. Page A is basically a newsletter which stores a cookie on the persons hard disk. Page b is a page on my website. So I can get to know if the newsletter influenced the visitor to visit my website and if yes how what time did he read it and how much time before he visited my website.

Can someone please help me implement it?

Thank you.

puDDs
July 7th, 2001, 01:10
Sounds like a decent system, however, there is one problem: Cookies can only be accessed by the domain that set them. IE, if thisdomain.com sets a cookie on a users hard drive, thatdomain.com will not be able to access that cookie. So, if you're not setting a retrieving the cookie from the same domain, your plan's not going to work.

If that is the case, my suggestion would be a redirection script, meaning in your newsletter you direct the user to:
www.thisdomain.com/referrer.cgi-----newsletter
instead of just www.thisdomain.com

Then you use a cgi script (referrer.cgi in the example) to add the date/time to a log file. Of course, this could easily be done in ASP or PHP as well.

If you'd like me to throw together a quick perl/asp script for you, just say the word...if you need it in php, i'm not your guy :)

LastActionHero
July 7th, 2001, 11:37
Thanks for your help. But i rather use a cookie system because the user mya decide to directly type in the url in the address bar.

I always thought you can set a cookie using any domain. Suppose I'm browsing msn.com , doubleclick.com's add is being show on msn.com so doubleclick can set a cookie on the using it's ad code from msn.com using doubleclick.com domain name and then when the user goes to doubleclick.com the cookie which was set when the user was browsing msn.com can be accessed by doubleclick.com

Isn't that so?

simply speaking
1. user goes to msn.com
2. doubleclick.com ad shown on msn.com
3. doubleclick.com ad code also set's a cookie using doubleclick.com as the domain name
4. now user goes do doubleclick.com and then the site can access the cookie which was actually set on msn.com

I hope you are getting my point.

puDDs
July 7th, 2001, 12:07
Yes, that is possible, because its the same domain setting and retrieving the cookie. If you have the option of doing that, it should be no trouble for you...

As to how to do it, well, I'm not too experienced with cookies, as I try to avoid them when I can (I don't like getting them, so I try not to set them). I'll see if I can dig any examples up for you though.

Just as a side note, what you're doing is referred to as third-party cookies, and is something some people like to block. Because ad agencies are the most common users of third-party cookies, and I don't like doubleclick or any other place to know where I've been and when, I have third party cookies set to be rejected in my browser. That's not saying everyone will have that, since most users wouldn't even know what a cookie is, but it will skew the results slightly, should you get the system up and running.

LastActionHero
July 7th, 2001, 13:30
Ok. Thanks for your help anyways. I'll implement both the cookie system and your idea about redirection.

Can you please write me that script you were talking about in perl?

puDDs
July 7th, 2001, 13:46
Sure, no problem, I'll start on it right now. What exactly do you want in the log file, something like this?

July 05, 2001 - 12:05 - << link referrer >>
July 07, 2001 - 14:45 - << link referrer >>

<< link referrer >> would be the page they clicked on the link from...if you want that.

LastActionHero
July 8th, 2001, 02:17
Originally posted by puDDs
Sure, no problem, I'll start on it right now. What exactly do you want in the log file, something like this?

July 05, 2001 - 12:05 - << link referrer >>
July 07, 2001 - 14:45 - << link referrer >>

<< link referrer >> would be the page they clicked on the link from...if you want that.

Since I would be using the script for only the newsletter, instead of link referrer a better option would be which domain they were reffered from. Thanks again.