大网数据广告活动
网站运营与故障问答

Is it illegal to track website visitors' ip addresses? If so, what precautions can you take to make sure you're covered?

· 52CE 我爱测

Essentially what I'm wanting to know is, if I set up my website to collect user IP addresses using a mysql database to see when they first visited + when they last visited and other info like what pages they have visited on my we…

问题原文

原帖链接 · TheShah1 · CC BY-SA 3.0

Essentially what I'm wanting to know is, if I set up my website to collect user IP addresses using a mysql database to see when they first visited + when they last visited and other info like what pages they have visited on my website, do I have to put a privacy policy to let the users know this is going on?

Also, do I have to provide proof of what it is their data will be used for?

To be more specific, this is my portfolio/blog that I'm making with this feature and I don't know if my efforts are worth it.

Thanks.

//This is the php code that grabs the IP address.

if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
    $ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
    $ip = $_SERVER['REMOTE_ADDR'];
}

Also, I'm not associating their IP with who they are necessarily, but I'm using it to distinguish between 2 users because they may view different things.

Edit: This is for my professional portfolio/blog.

已采纳解答

原帖链接 · TopQnA · CC BY-SA 3.0

Generally, web servers store those details in a log file in anyways. Info like: IP Address, Time of Visit, Referal URL etc. So, in my view, it should be perfectly all right store and analyse these info based on the need.

Also, instead of coding, storing and analysing, i would recommend you to use Google Analytics which will give you greater details about user behaviour.

With regards to IP, there are other tools available (Like: Open Tracker) and you can integrate by placing their JS and it collects a massive amount of info with IP, page visit and much more.

Coding on your own may be an overhead unless there will be no option out there.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2017-05-26)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。