javascript 在javascript中获取推荐网址

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4131455/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 10:27:48  来源:igfitidea点击:

Get the referral url in javascript

javascripthttp-status-code-301referrals

提问by Atul

I want to see how much traffic I get from various URL shortening services like

我想看看我从各种 URL 缩短服务中获得了多少流量,例如

bit.ly

一点点

tinyurl.com

tinyurl.com

But because they use 301 redirection, they don't show up in my analytics.

但是因为它们使用 301 重定向,所以它们不会出现在我的分析中。

How can I find out who is redirecting the traffic?

如何找出谁在重定向流量?

Or

或者

More precisely how could i get the referral url in javascript for different kind of redirection ?

更准确地说,我如何在 javascript 中获取不同类型重定向的推荐 URL?

回答by RPM1984

document.referrer

document.referrer

Example:

例子:

if (document.referrer && document.referrer != "")
      document.write('Thanks for visiting this site from ' + document.referrer);