Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the referral url in javascript

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

bit.ly

tinyurl.com

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

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 ?

like image 835
Atul Avatar asked Nov 09 '10 07:11

Atul


1 Answers

document.referrer

Example:

if (document.referrer && document.referrer != "")
      document.write('Thanks for visiting this site from ' + document.referrer);
like image 78
RPM1984 Avatar answered Oct 27 '22 09:10

RPM1984