Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine search query forwarding user to my website?

Greetings,

I'm trying to work out what query is being used to forward people to my website. I'd appreciate it if anyone could tell me what api call I should be looking into. I'm sure this is possible with javascript as well as ruby and php so any technology is fine.

Just for learning sake I don't mind know what I should be using for all three :)

like image 362
Steve Avatar asked Feb 13 '10 10:02

Steve


People also ask

How do you find out what people are searching to find your website?

Google Search Console To see what type of keywords users are searching for to find your website, pop over to Google Search Console > Search Traffic > Search Analytics. Once you're here, you'll see a list of keywords that are getting some traction.

What are the 3 common types of search intent?

Common types of Search Intent include informational, commercial, navigational and transactional.


1 Answers

Having worked with search engines for more than 5 years, I can tell you there's no standard way to retrieve the query value.

As other answers already told you, the first step is to inspect the HTTP_REFERER header. Assuming you are using Rails, you can get it from the request

request.referrer

Otherwise, you need to extract it from request headers in an other way.

Once you have the referrer, then you are in front of 3 main possibilities:

  1. variable is empty. sorry, you can't do nothing
  2. variable is not empty, it's a search engine
  3. variable is not empty, it's not a search engine

The first option is simple. What you want to know is if the referrer is a search engine. If so, then you need to extract the query.

The most common way to do this is using a checklist. The checklist is usually a list of key/value where the key is the search engine domain and the value the name of the query string parameter that holds the query value.

google.com,q
yahoo.com,p
...

This is the same approach used by Google Analytics. From the ga.js file

g.T=l("daum:q,eniro:search_word,naver:query,images.google:q,google:q,yahoo:p,msn:q,bing:q,aol:query,aol:encquery,lycos:query,ask:q,altavista:q,netscape:query,cnn:query,about:terms,mamma:query,alltheweb:q,voila:rdata,virgilio:qs,live:q,baidu:wd,alice:qs,yandex:text,najdi:q,aol:q,mama:query,seznam:q,search:q,wp:szukaj,onet:qt,szukacz:q,yam:k,pchome:q,kvasir:q,sesam:q,ozu:q,terra:query,mynet:q,ekolay:q,rambler:words");

First host matches both key and value, first wins.

like image 93
Simone Carletti Avatar answered Sep 23 '22 02:09

Simone Carletti