Skip Navigation LinksHome > Categories > Code from a Category

By what criteria the site in search engine

User Name: serfcompany
Name: Serf
Contact Me:
Home Page:
php,mysql,javascript,html,css. Preferable working with Zend Framework. Good know javascript. I worked with various, javascript frameworks such as(jquery, YUI3, extjs, sencha touch). [More]
Viewed Times: 2018
Add Date: 04/05/2012
In this article I will discuss how to write a script that will determine what the searcher with the visitor came, for what search phrase was found your site in search engines and the number of transitions. You can also find out what pages site visitors came for certain keywords that will pick up additional search phrases for further optimization of the site and assess the work already done.

We need to know all the data we will be on the referer (address from which the visitor came.) For example, a visitor looking for the word "potato" in the search results has also been to your site. If a visitor clicks on a link leading to the site, it will be the referer, if it came with Yandex:

In this address we have all the necessary information.
We interisuet domain and setting text =, followed by a search query in an encrypted form (our "potato").
Let's write a script that will do the processing referer, and the results we will keep in the database.

The above code will need to integrate all your web pages or you can put this code in a separate file, referer and page where the visitor is using JavaScript to define and communicate the findings PHP-script.

You can read about it in his article "How to pass a variable from JavaScript to PHP"

In entered information to connect to the database and code to communicate with MySQL.

Write install.php, which will create a table in the database.

Run the install.php script to complete the installation. Now create the admin.php, through which we view all of the data.

The administration interface - View statistics of search phrases

Our script is ready. It will only work for our selected search engines.
I gave the example of the three best-known search engines, but you can easily add any that are deemed necessary.

Post a Comment

Name: (Optional)
Email: (Optional, you can get an email if somebody replys your comments)*
Email me if somebody respons my comment below:
Enter Text
as Below:
(case insensitive, if hard to read, click the "get a new one" button)
* Your email address will not be shared with any third parties for any reason.
** Maximum 1000 charactors.