Unfortunately this approach does not work in HTTPS world. See https://tools.ietf.org/html/rfc2616#section-15.1.3
Clients SHOULD NOT include a Referer header field
in a (non-secure) HTTP request if the referring page
was transferred with a secure protocol.