开发者

is there any way to uniquely identify an user that accesses my network of websites?

Is there any way, preferable in java, to uniquely identify a user?

I have the following scenario: I own 10 websites and i want to know when the same user accesses any of my websites. So if a user accesses site A, and after that he accesses site B i want to get a response to the question : Did this particular user accessed site A before?

Keeping track of the IP is a poor approach as mostly IPs are dynamic or more people share the same 开发者_如何转开发ip through a router.

I'm guessing that getting the MAC Address is a security branch :).

Cookies are available only for a specific url !?

Is there any way i can get this working?

EDIT:

I read that's not possbile to access the same cookie across multiple domains. Is it possbile after all ? Here's the reference : at: Cookie problems with IE and Chrome (working with java) "Cookies are domain based. Many browsers reject cookies on embedded resources (CSS/JS/images) which are served from other domain than the page is been served from"

So if i add a response.addCookie(UniqueCookieForCurrentUser); will it be available on other domains ?

I'm calling, as you suggested, from javascript :

    var query = '?requestURI=' + encodeURIComponent(requestURI)
         + '&resolution=' + encodeURIComponent(resolution)
         + '&websiteid=' + encodeURIComponent(id)
         + '&DisplayedBanners=' + encodeURIComponent(DisplayedBanners);
    document.getElementById("body").innerHTML = "<img src ='http://dan-vaio:8080/licenta/bannerimg.gif" + query + "' width = 728 height = 90 />";

And in servlet i return this: (after adding the cookie to the response)

    File f = new File(filePath);
byte[] b = new byte[(int)f.length()];
FileInputStream fis = new FileInputStream(f);
fis.read(b);
ServletOutputStream out  = response.getOutputStream();
out.write(b);
out.close();


Do as all ad networks do: You place a small web bug on each site that loads a cookie from ONE of your servers, so that regardless of which site the user goes to, they always get a cookie from the same bug server. Put a unique identifier into each site's bug so that you're not dependent on referers to identify the source site for each hit on the bug server.


following:

Ok. on each site you'll have this on each landing page:

<img src="http://bugs.example.com?src=siteName" width=1 height=1 alt="Track me, please!" />

and replace siteName with something appropriate for each site. e.g. src=siteA, src=siteB, etc...

When a user comes in to site A, their browser will load this image from your webbug server, and a cookie will be issued to identify the user. A PHP session cookie, or something like the one generated by Apache's mod_usertrack). The important thing is that the cookie's value is UNIQUE for each user.

So now this user has a cookie in their browser, example.com.track=2536t4234235423423. When the user then visits site B, the browser will send this cookie along with the image request to the web bug server, and now your logs will show that cookie 2536t4234235423423 has visited both site A and site B.

The cookie by itself is useless, it just identifies a user. But in combination with the URL requested from the web bug server, which contains the name of the originating server, you can then see which site any particular cookie (e.g. user) visited.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜