Use monitoring of search tool

Asked

Viewed 42 times

1

On my client’s website, there is a kind of search tool. This search requires the user to choose which of the sections (pages) he wants to search. With the desired word and the chosen section, it redirects to the page and brings the desired search results.

For example, if I want to search something in Download Center, the page usually is: meusite.com.br/servicos/centraldownloads/

But if I use the search tool: meusite.com.br/busca/6/

What I wanted to know is how I can and if it is possible to monitor how many people are going to these pages through the search (pages that start with meusite.com.br/search).

The other thing I wonder if I could do a monitoring is through the SEARCH button of this search tool, it has the following HTML code:

<input type="submit" class="BtnBuscar replace-bt" value="">

Does anyone have any idea?

  • 2

    Use $_SERVER['HTTP_REFERER']; on pages. and make sure it contains meusite.com.br/search

  • and these how many people would you save where? BD, txt file?

2 answers

2


Monitored pages

$result = $_SERVER['HTTP_REFERER'];

$pos = strpos($result, "meusite.com.br/busca");
    if ($pos !== false) {
        // script .....  
    }

This referer log is used to allow web sites and web servers to identify where people are visiting you, i.e., by checking the referer, the new web page can see where the request originated from. (In short: know where the user came from, which page he was sent to the new page).

  • Can you tell me if this same function can be done in javascript?

  • Document.referrer

1

The best way is to use $_SERVER['HTTP_REFERER']; and store in the Database, ai Voce can use PDO normally. ex:

$sql = $pdo->prepare("INSERT INTO tabela SET val = valor");
$sql->execute();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.