Answer the question
In order to leave comments, you need to log in
How to get Referer from the first visit to the site using js?
You need to get the link from which the user came to the site, moreover, if you use document.referrer, then this is not quite right, so you need to get exactly the external link.
those. I came from the site 'site.com', then I walked around my site, and I need to get exactly the link 'site.com'.
you need at least a verbal algorithm how to do this, a site on WordPress, although this is not the point, php sessions cannot be used, because the site is cached, i.e. getting the correct referer will not work. and local storage is also probably, the site will support ie6-8 sometime
Answer the question
In order to leave comments, you need to log in
Use cookies. Check if there is no such cookie and the referer domain does not match your domain, then write the referer in the cookie. There is a new browser policy where if the referer is https and your site is http you will only get the domain instead of the full address.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question