Bitrix Site Manager

CTraffic::GetPhraseList

CDBResult
CTraffic::GetPhraseList(
 string &by = "s_today",
 string &order = "desc",
 array filter = array(),
 bool &is_filtered,
 mixed limit = 10,
)

The method GetPhraseList returns the number of search phrases: for the whole time of keeping statistics, for the last 3 days, or for the specified period.

Parameters

Parameter Description
by Sorting field; possible values:
  • s_phrase - the search phrase;
  • s_today - number of today's search phrases;
  • s_yesterday - number of yesterday's search phrases;
  • s_bef_yesterday - number of search phrases for day before yesterday;
  • s_total - total number of search phrases;
  • s_period - number of search phrases for the specified period (filter[DATE1], filter[DATE2]).
order Sort order; the following values are possible:
  • asc - ascending;
  • desc - descending.
filter Array used to filter the resulting list. The following keys can be used in the array:
  • SITE_ID - the ID of the site whose information is required;
  • DATE1 - starting date;
  • DATE2 - ending date.
is_filtered If this flag contains "true" on return, the resulting list is filtered.
limit Maximum number of records to return. If set to 0, the number of returned records is not limited.

Structure of the returned record

Array
(
    [PHRASE] => search phrase
    [TOTAL_PHRASES] => total visits with this search phrase
    [TODAY_PHRASES] => today's visits
    [YESTERDAY_PHRASES] => yesterday's visits
    [B_YESTERDAY_PHRASES] => visits for day before yesterday
    [PERIOD_PHRASES] => visits for the period:
                        (filter[DATE1],  filter[DATE2])
)

See Also

Example



<?
// get data for December 2005
$arFilter = array(
    "DATE1" => "01.12.2005",
    "DATE2" => "31.12.2005"
    );

// obtain the list of phrases and the statistics
$rs = CTraffic::GetPhraseList($by="s_today", 
                              $order="desc", 
                              $arFilter, 
                              $is_filtered, 
                              false);
while ($ar = $rs->Fetch())
{
    echo "search phrase: ".$ar["PHRASE"]."<br>";
    echo "total visits with this search phrase: ".
         $ar["TOTAL_PHRASES"].
         "<br>";
    echo "today: ".$ar["TODAY_PHRASES"]."<br>";
    echo "yesterday: ".$ar["YESTERDAY_PHRASES"]."<br>";
    echo "d. before yesterday: ".$ar["B_YESTERDAY_PHRASES"]."<br>";
    echo "during December 2005: ".
         $ar["PERIOD_PHRASES"]."<br>";
}
?>