简体   繁体   English

有什么方法可以唯一标识访问我的网站网络的用户?

[英]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?有什么方法,最好在 java 中唯一标识用户?

I have the following scenario: I own 10 websites and i want to know when the same user accesses any of my websites.我有以下场景:我拥有 10 个网站,我想知道同一用户何时访问我的任何网站。 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?因此,如果用户访问站点 A,然后他访问站点 B,我希望得到对以下问题的回答:此特定用户之前访问过站点 A 吗?

Keeping track of the IP is a poor approach as mostly IPs are dynamic or more people share the same ip through a router.跟踪 IP 是一种糟糕的方法,因为大多数 IP 是动态的,或者更多人通过路由器共享相同的 ip。

I'm guessing that getting the MAC Address is a security branch:).我猜想获取 MAC 地址是一个安全分支:)。

Cookies are available only for a specific url?? Cookies 仅适用于特定的 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.我读到不可能跨多个域访问同一个cookie。 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"以下是参考:在: IE 和 Chrome 的 Cookie 问题(使用 java) “Cookie 是基于域的。许多浏览器拒绝 cookies 嵌入资源(CSS/JS/图像),这些资源来自其他域,而不是页面提供自"

So if i add a response.addCookie(UniqueCookieForCurrentUser);所以如果我添加一个response.addCookie(UniqueCookieForCurrentUser); will it be available on other domains?它会在其他域上可用吗?

I'm calling, as you suggested, from javascript:正如您所建议的,我正在从 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)在servlet中我返回这个:(在将cookie添加到响应之后)

    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.像所有广告网络一样做:你在每个站点上放置一个小的 web 错误,从你的一个服务器加载一个 cookie,这样无论用户访问哪个站点,他们总是从同一个错误服务器获得一个 cookie。 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.并将siteName替换为适合每个站点的内容。 eg src=siteA , src=siteB , etc...例如src=siteAsrc=siteB =siteB 等...

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 时,他们的浏览器将从您的 webbug 服务器加载此图像,并且将发出一个 cookie 来识别用户。 A PHP session cookie, or something like the one generated by Apache's mod_usertrack).一个 PHP session cookie,或者类似于 Apache 的 mod_usertrack 生成的cookie)。 The important thing is that the cookie's value is UNIQUE for each user.重要的是 cookie 的值对于每个用户都是唯一的。

So now this user has a cookie in their browser, example.com.track=2536t4234235423423 .所以现在这个用户在他们的浏览器中有一个cookie, 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.当用户随后访问站点 B 时,浏览器会将此 cookie 与图像请求一起发送到 web 错误服务器,现在您的日志将显示 cookie 2536t4234235423423 已访问站点 A 和站点 B。

The cookie by itself is useless, it just identifies a user. cookie 本身是无用的,它只是识别用户。 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 (eg user) visited.但是结合从 web 错误服务器请求的 URL,其中包含原始服务器的名称,您可以查看任何特定 cookie(例如用户)访问的站点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM