开发者

Store referring keyword in a PHP Session

I'd like to store the keyword that customers use to visit my website in a PHP Session.

Can someone explain how this is done?

So if a customer types 'football laces' and clicks on my site in the list of results, my script would store this data in a session.

Is it universal or would it change depen开发者_JAVA百科ding on Google/Bing/Yahoo search engine.

UPDATE This looks good for me: http://www.liamdelahunty.com/tips/php_google_referer.php Thanks for the input with the answers. Much appreciated.

Many thanks


You could use $_SERVER['HTTP_REFERER'] to see where a user came from. Google does for example put the keywords in the URL.


Strarted to write an answer and then found this :)... Take a look:

http://www.vonfelten.com/blog/2007/06/05/referral-url-from-session-using-php/

And what you get is the url the came from which would include the keyword in question. You could then create functions to extract the keyword from Google, Bing etc URL's


Try this Server and execution environment information

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜