Home / search / Display search terms from google visitors
  • How to Display search terms from google visitors

    display-search-terms-from-google-visitors

    Adding this snippet to your wordpress template will let you display the google search terms visitors use to find your website.

    wordpress snippet : PHP

    <>
    <?php
    $refer = $_SERVER["HTTP_REFERER"];
              if (strpos($refer, "google")) {
                             $refer_string = parse_url($refer, PHP_URL_QUERY);
                             parse_str($refer_string, $vars);
                             $search_terms = $vars['q'];
                             echo 'Welcome Google visitor! You searched for the following terms to get here: ';
                             echo $search_terms;
                  };
    ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    query,
  • Pier

    hi, i speak spanish, this no work from new google —>¬† https¬†