Atul
Atul

Reputation: 4603

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 ?

Upvotes: 7

Views: 19493

Answers (1)

RPM1984
RPM1984

Reputation: 73112

document.referrer

Example:

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

Upvotes: 10

Related Questions