473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

domain cookie problem...

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?

Sep 18 '06 #1
8 1802
mu******@gmail.com wrote:
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
Sep 18 '06 #2
Ok, if it can not be done that way,
and I know many tracking and conversions system does that, how can I do
that?

Sep 18 '06 #3
mu******@gmail.com wrote:
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
Sep 18 '06 #4
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.

Sep 18 '06 #5
mu******@gmail.com wrote:
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"]

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
>
--
Thanks.
Sep 18 '06 #6
mu******@gmail.com wrote:
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"

Sep 19 '06 #7
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 =]

Sep 19 '06 #8
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 =]

Sep 19 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Navin | last post by:
hi, guys my website is on server say servera. i have a website on serverb now servera and serverb are on different domians... if serverb website creates a cookie on client pc with domain say...
0
by: Kuldeep | last post by:
Hi, I implemented Forms authentication for my apps (more than one). Since it'll be hosted on a webfarm, I set cookie.domain = "nnn.nnn.com". This works fine. I can signin and then go to other...
3
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code...
1
by: Paul | last post by:
My site does not have a domain name, just an IP address. I set a cookie in ASP.Net and I can read it with no problem on subsequent pages. My problem is that I want to actually see the file on...
2
by: patilj | last post by:
OK, here's the deal. Let's say I got a website called: https://www.blah.com/~account/application/login.php When the user arrives they see a https which is more secure than just http alone....
17
by: Bruno | last post by:
I have a feature that is hosted on a different domain from the primary one in a frame, and need to retain values in a cookie. example: A web page at one.com contains a frame which has a page...
3
by: ulabala | last post by:
I was trying to retrieve the cookie collection and display the domain to which those cookies were written to, but I always see a NULL value for the domain property. Can anyone shed some light?...
2
by: kelly.pearson | last post by:
Is this a bug? I am trying to write a cookie that can be accessed by various .Net applications on our domain. However, whenever I add the domain property to the cookie, no errors get thrown but...
5
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, Is there an easier way to handle that? I used Javascript to handle this when our two domains are hosted on two different servers(on different networks) and our search engine marketing...
16
by: Stevo | last post by:
I'm guessing this is a laughably obvious answer to many here, but it's not to me (and I don't have a server or any knowledge of PHP to be able to try it). It's not strictly a PHP question, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.