通过url跟踪用户并避免手动篡改
我想跟踪有多少人点击通过电子邮件发送的链接。
目前,我正在考虑建立一个单独的页面,通过带有 get 变量的链接调用该页面,以指示这是通过电子邮件完成的。
显然,这可以通过导航器的地址栏手动篡改。我可以使用什么方法来限制这种情况?
I'd like to keep track of how many people follow a link sent through an email.
At the moment, I'm thinking of having a separate page which is called through the link with a get variable to indicate this was done from an email.
Obviously, this can be tampered with manually through the address bar of a navigator. What approaches could I use to limit this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
1) 使用完全不同的 URL 重定向到真实 URL:
http://www.mysite.com/emailOffer
->http://www.mysite.com/specialpage
emailOffer 会进行日志记录,然后发送一个指向真实页面(specialpage)的
Location
HTTP 标头http ://www.mysite.com/emailOffer
看起来像这样:2)添加一个 GET 参数,例如:
http://www.mysite.com/specialpage?email
然后在 php 中,您可以执行以下操作:
if(array_key_exists('email',$_GET)) addToCounter();
3)您可以为访问该页面并运行查询的每个人记录 HTTP Referer 标头对于包含“mail”的引荐来源网址(例如,mail.google.com、hotmail.com)
为了帮助防止篡改,您可以使该参数看起来值得:
http://www.mysite.com/specialpage?secretOffer
祝你好运! :)
PS - 抱歉我的答案格式很糟糕......
1)Use a completely different URL to redirect to the real one:
http://www.mysite.com/emailOffer
->http://www.mysite.com/specialpage
emailOffer would do the logging, and then send a
Location
HTTP header pointing to the real page (specialpage)http://www.mysite.com/emailOffer
would look like this:2)Add a GET parameter like:
http://www.mysite.com/specialpage?email
then in php, you can do:
if(array_key_exists('email',$_GET)) addToCounter();
3)You could log the HTTP Referer header for everyone who hits the page and run a query for referers containing "mail" (e.g., mail.google.com, hotmail.com)
To help prevent tampering, you could make the parameter seem worth while:
http://www.mysite.com/specialpage?secretOffer
Good luck! :)
PS - sorry for the terrible formatting of my answer...
在大多数情况下,人们可能只使用 GET 方法,但在所有情况下,它都可以被篡改,如果一个人真的愿意,几乎每个元素都可以更改,但就告诉某人从哪里来而言,你是相当不错的很受 GET 或检查引荐来源网址的困扰,这可能非常可疑,并且您必须检查各种各样的事情。
如果您不关心他们在电子邮件中跟踪的实际链接,您可以创建一个辅助页面,该页面会点击您的计数器,不输出任何内容,并且只是重定向它们,就像
他们的导航栏将更改为新地址 一样几乎不会注意到原来的。
In most cases people probably just use the GET method, in all cases though, it can be tampered with, pretty much every element can be changed if a person really wants to, but as far as telling where someone is going from you're pretty much stuck with GET or checking the referrer, which can be highly suspect, and you'd have to check all sorts of things.
If you aren't concerned with the actual link they're following in the email, you could create a secondary page, that hits your counter, outputs nothing, and just redirects them like
Their navigation bar will change to the new address, and they'll barely even notice the original.