How can I find which search terms (if any) brought the user to my site?

I want to create dynamic content based on this. I know this somewhere, since web analytics mechanisms can get this data to determine how people got to your site (referrer, search terms used, etc.), but I don’t know how to do it myself.

+3
source share
2 answers

You can use the "referer" part in a request submitted by the user to find out what he was looking for. Example from Google:

http://www.google.no/search?q=stack%20overflow

So, you should look for the string (in ASP (.NET) it can be found in Request.Referer) for "q =" and then the URLDecode of the content.

, , , :

http://www.15seconds.com/issue/021119.htm

+7

querystring UrlReferrer Request. ( - , ), . (Page_Load, , )

public void Page_Load(Object Sender, EventArgs E) {
            if (null == Session["source"] || Session["source"].ToString().Equals(string.Empty)) {
                if (Request.QueryString["src"] != null) {
                    Session["source"] = Server.UrlDecode(Request.QueryString["src"].ToString());
                } else {
                    if (Request.UrlReferrer != null) {
                        Session["source"] = Request.UrlReferrer.ToString();
                    } else {
                        Session["source"] = string.Empty;
                    }
                }
            }}
0

Source: https://habr.com/ru/post/1696813/


All Articles