1

document.referrer Returns the URI of the page that linked to this page. The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark),

as https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer states.

My question is:

When we click on the link within an email account from the browser, we land on the page where document.referrer is empty.

At least it's valid for several email providers I've tested when clicked on ads/URLs within subscribed newsletter emails I receive.

Will it be true for any email provider or not true?

I need to filter (no the exact criteria though) visitors when link was clicked from customer's email.

With another words, if document.referrer is NOT empty, does this mean the customer definitely came to my web site NOT from email link (not from Yahoo, not from Google etc)?

Haradzieniec
  • 9,086
  • 31
  • 117
  • 212

1 Answers1

1

It's easy enough to fake the document.referrer value to spoof another site, but you can't supply it with a value when coming from an email link, since it's not being loaded by another web page in the browser.

EDIT: It would be possible to simulate a document.referrer value when an email link is clicked -- you would send the user to another web page, which would supply the referrer value, then pass them along to the destination page -- but for your purposes, that's not a likely situation.

Short answer: If it has a value set, unless someone is trying to spoof it, it didn't come from an email link.

freginold
  • 3,946
  • 3
  • 13
  • 28