Determining whether a user arrived from Google (and the query he used if so)
From within my Rails app, how do I determine whether a user arrived on a given page by clicking a Google (or Bing or Yahoo) search result?
If the user arrived in this fashion, ho开发者_如何学Pythonw do I determine what search terms he used?
Have a look at
referer = @request.env["HTTP_REFERER"]
then, parse the info you're looking for (site, query) from that string.
精彩评论