Connecting Tech Pros Worldwide Help | Site Map

domain cookie problem...

mutale82@gmail.com
Guest
 
Posts: n/a
#1: Sep 18 '06
I need to integrate a tracking system with a few clients, the clients
agree to place <img src="....."tags but not to place a file on there
servers.

I need to set a cookie on the visitor computer and when the visitor
preform an action to read the cookie and send the cookie infotmation to
my server.

I tried everything, and I cant read the cookie, I can set the cookie
using a javascript file that I placed on my server.

But to read the cookie and send the information I need to use PHP or
ASP file, and I cant do that unless the visitor has 3rd party cookies
enable.

How can I intergrate the systems?

Erwin Moller
Guest
 
Posts: n/a
#2: Sep 18 '06

re: domain cookie problem...


mutale82@gmail.com wrote:
Quote:
I need to integrate a tracking system with a few clients, the clients
agree to place <img src="....."tags but not to place a file on there
servers.
>
I need to set a cookie on the visitor computer and when the visitor
preform an action to read the cookie and send the cookie infotmation to
my server.
>
I tried everything, and I cant read the cookie, I can set the cookie
using a javascript file that I placed on my server.
>
But to read the cookie and send the information I need to use PHP or
ASP file, and I cant do that unless the visitor has 3rd party cookies
enable.
>
How can I intergrate the systems?
You can not.
Cookies are domainbound.
So if you set a cookie from www.yourfirstdomain.com, you cannot retrieve
that cookie from www.yourseconddomain.com.
The reason is simply that the browser (if it is not broken) only sends that
cookies set by some domain (via JavaScript, or PHP), along with its request
for some page, if the domains match.

If this was not the case, you could read all cookies from all domains, which
is not desirable.

Maybe IE's 'trusted domains' can overcome this valid limitation, not sure.

Regards,
Erwin Moller
mutale82@gmail.com
Guest
 
Posts: n/a
#3: Sep 18 '06

re: domain cookie problem...


Ok, if it can not be done that way,
and I know many tracking and conversions system does that, how can I do
that?

Erwin Moller
Guest
 
Posts: n/a
#4: Sep 18 '06

re: domain cookie problem...


mutale82@gmail.com wrote:
Quote:
Ok, if it can not be done that way,
and I know many tracking and conversions system does that, how can I do
that?
Tracking across domains is not easy.
If you want to catch a user coming from www.w1.com that goes to www.2w.com,
or vise versa, both domainowners must agree to the tracking.

We you go to w2 from w1, w2 receives the information where you come from,
nothing more or less. (HTTP_REFERER)

If w2 wants to share this information with w1, fine.
If they don't, there is no way for w1 to find out where the visitor went.

What is it excactly you want to achieve?
If you want to pass information from w1 to w2, you can also use the url
itself by appending some info, eg:
[from w1]
<a href="http://www.w2.com?id=38726487234">go to w2</a>

[from w2]
if (isset($_GET["id"]){
// do something with $_GET["id"]
}

This can also be done with a form and method POST.

Regrads,
Erwin Moller
mutale82@gmail.com
Guest
 
Posts: n/a
#5: Sep 18 '06

re: domain cookie problem...


I use the url to pass w2 the value to put in the cookie (if i want it
to be written from w2...),
that's not the problem, the problem is if i want to do the same thrue
an IMG TAG (for example)...
When im not actually moving to w1...
On w2 (in Another page, not the landing page) i want to call a php file
on w1, but NOT redirecting to it,
i can read the cookie in w2 (only by JS) but i cant put the value in
the query string of the file im calling...
btw. i tried to read the cookie from the php file that im calling, but
it says that there is no cookie set (apperantly its trying to read it
from w1-Domain).

so i need a way to do one of two:
1. transfer the value of the cookie (which read by w2 -JS) to a file on
w1...
2. read the cookie from the file in w1 (whose been called by IMG TAG on
w2).

--
Thanks.

Erwin Moller
Guest
 
Posts: n/a
#6: Sep 18 '06

re: domain cookie problem...


mutale82@gmail.com wrote:
Quote:
I use the url to pass w2 the value to put in the cookie (if i want it
to be written from w2...),
that's not the problem, the problem is if i want to do the same thrue
an IMG TAG (for example)...
Hi

You can pass information with the imagetag just fine, eg:
[from w1]
<img src="http://www.w2.com/images/doimage.php?id=762357">
and vise versa
[from w2]
<img src="http://www.w1.com/images/doimage.php?id=762357">

It works the same as GET as far as PHP is concerned.
doimage.php can retrieve the value with $_GET["id"]

Quote:
When im not actually moving to w1...
On w2 (in Another page, not the landing page) i want to call a php file
on w1, but NOT redirecting to it,
i can read the cookie in w2 (only by JS) but i cant put the value in
the query string of the file im calling...
btw. i tried to read the cookie from the php file that im calling, but
it says that there is no cookie set (apperantly its trying to read it
from w1-Domain).
>
so i need a way to do one of two:
1. transfer the value of the cookie (which read by w2 -JS) to a file on
w1...
2. read the cookie from the file in w1 (whose been called by IMG TAG on
w2).
I am not sure if you need file for that, but I do not know your setup.

Summarizing:
If you want to pass the value of the cookie from w1 to w2 via an image that
is displayed on the w1 page:

JS:
var cookiename, cookievalue;
// fill them with appropriate values

var theImgURL = "http://www.w2.com/images/doimage.php?";
theImgURL += "cookiename="+escape(cookiename);
theImgURL += "&cookievalue="+escape(cookievalue);

document.images.mycookiegif.src=theImgURL;

<img src="0.gif" name="mycookiegif">

Then from w2 doimage.php:
[php]
$cookiename = $_GET["cookiename"];
$cookievalue = $_GET["cookievalue"];

[not tested, just the bare idea]

Does that help?

Regards,
Erwin Moller
Quote:
>
--
Thanks.
cloudcmh@gmail.com
Guest
 
Posts: n/a
#7: Sep 19 '06

re: domain cookie problem...


mutale82@gmail.com wrote:
Quote:
I need to integrate a tracking system with a few clients, the clients
agree to place <img src="....."tags but not to place a file on there
servers.
>
I need to set a cookie on the visitor computer and when the visitor
preform an action to read the cookie and send the cookie infotmation to
my server.
>
I tried everything, and I cant read the cookie, I can set the cookie
using a javascript file that I placed on my server.
>
But to read the cookie and send the information I need to use PHP or
ASP file, and I cant do that unless the visitor has 3rd party cookies
enable.
>
How can I intergrate the systems?
In this case, ur act 3rd part cookie.
3rd part cookie was denied by browser by default.
add a HTTP header named P3P in your HTTP response, like below:
NAME: P3P
VALUE: CP="NOI DSP COR CURa ADMa DEVa PSAa PSDa OUR IND UNI PUR NAV"

mutale82@gmail.com
Guest
 
Posts: n/a
#8: Sep 19 '06

re: domain cookie problem...


thats kind of what i did:

<img id="cookies" src="" style="display:none;"/>
<script language="JavaScript" type="text/javascript"
src="http://he.wesell.co.il/Scripts/CookieFuncs.js"></script>
<script type="text/javascript">
function sendCook()
{
document.getElementById('cookies').src =
'http://domain.com/file.php?param1=1&param2=2&Cookie=' +
readCookie(name);
}

sendCook();
</script>

it works just fine...

thanks =]

mutale82@gmail.com
Guest
 
Posts: n/a
#9: Sep 19 '06

re: domain cookie problem...


thats kind of what i did:

<img id="cookies" src="" style="display:none;"/>
<script language="JavaScript" type="text/javascript"
src="http://domain.com/Scripts/CookieFuncs.js"></script>
<script type="text/javascript">
function sendCook()
{
document.getElementById('cookies').src =
'http://domain.com/file.php?param1=1&param2=2&Cookie=' +
readCookie(name);
}

sendCook();
</script>

now it works just fine.

thanks =]

Closed Thread