how do you detect if your website visitor came from a google search result?

前端 未结 6 479
粉色の甜心
粉色の甜心 2020-12-03 16:06

when a user searches from google and lands on our site from the results he/she was shown in the results page, is there a way for my site to detect that he came from google?<

6条回答
  •  执念已碎
    2020-12-03 16:53

    Yes, use the HTTP_ REFERER var in the $_SERVER array:

    $_SERVER['HTTP_REFERER'];
    

    This shoudl then include something like http://www.google.com/?q=etc

    Note however that the REFERER is not always set because clients can disable their browser to send it in the request.

提交回复
热议问题