Page 1 of 1
Setting Cookies
Posted: Tue Jan 06, 2004 5:09 am
by lazersam
Hi all
I want to place cookies on visits to my affiliate sites. The cookies should be set by my script on my server but the visitiors are calling on my affiliate's sites that are not connected to mine!
So, my question is... can I set a cookie on a users computer when they are not visiting my site? I think it can be done if the site they are on calls a image file(?) and this could trigger my script? Anyone know how this is done?
Thanks.
Lawrence.
Posted: Tue Jan 06, 2004 9:57 am
by Nay
eh? Not 100% sure what you mean but when you mention affiliates = different domains?
You can only access you domain's cookies, no one else's.
-Nay
Posted: Tue Jan 06, 2004 11:14 am
by lazersam
I am going to run an affiliate program. Affiliates can advertise my products on
their site (different domain to mine).
I want to be able to place a cookie on their visitor's computer when their visitors hit the affiliates page.
I do not wish to access any cookies just set them
Regards
Lawrence.
Posted: Tue Jan 06, 2004 1:28 pm
by redmonkey
lazersam wrote:
I do not wish to access any cookies just set them
I have to ask, what is the point in setting a cookie and then not accessing it?
Actually, what you are trying to do is quite easy, however I also consider it to be the biggest misuse of cookies, and it completely goes against the privacy nature of cookies as most users understand them.
If you show me an accurate P3P file that will accompany your intended cookie then I'll show you how to do it.
Posted: Tue Jan 06, 2004 3:04 pm
by lazersam
Hi redmonkey
I didnt realise this was a misuse of cookies. I only want to tag the visitor with my affiliates ID so I can credit my affiliate should their visitor buy my products.
I will be accessing these cookies should the visitor come to my sales site.
Whats a p3p file?
Regards
Lawrence.
Posted: Tue Jan 06, 2004 5:58 pm
by JAM
Not 100% sure, but this would qualify under 3rd part cookies. And if so, have in mind that alot of users have the "Ignore 3rd part cookies" option turned on in their browsers, firewalls, 3rd part protection software etc.
---
Just shooting another idea on the subject:
You can make a php script an image, and inside the code handling that add database functions.
If you have access to a database, you can collect user-ip/afil-sitename and so forth with the image, before displaying it, and insert that info into the database. Can be used to count hits, and depending on how much (and what) information you are to use in your cookie perhaps more.
Posted: Tue Jan 06, 2004 6:18 pm
by d3ad1ysp0rk
umm..
have them send their users to '
http://www.yoursite.com/aff.php?id=theirid'
and then on aff.php:
Code: Select all
<?php
//connect to DB
$id = $_GET['id'];
$sql = "UPDATE `table` SET `in` = in+1 WHERE `id` = '$id'";
mysql_query($sql) or die("Error in updating...");
header("location:index.php");
?>
no need for cookies..
Posted: Tue Jan 06, 2004 8:58 pm
by redmonkey
JAM is spot on with that idea, that is exactly how it works.
A P3P file is essentially an xml file associated with the cookie which contains various bits of info on how you use the cookie and the type of info that is stored in it.
Cookies of this nature do qualify as 3rd party and although many users reject 3rd party cookies many do not.