M
M
Maxim Morozov2020-02-08 16:26:41
1C-Bitrix
Maxim Morozov, 2020-02-08 16:26:41

Displaying the number of page views using the Web Analytics module, how to implement Bitrix in 1s?

Can you please tell me how to display the number of element (page) views for the last 2 months using CPage::GetDynamicList?
I'm doing something wrong.....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2020-02-08
@morozoffmaks

Here is an example

$arFilter = [
    "DATE1" => date("d.m.Y", strtotime("-2 month")),
    "DATE2" => date("d.m.Y"),
    "DIR" => "Y",
    "URL" => "http://example.com" . $arResult['DETAIL_PAGE_URL'],
    "URL_EXACT_MATCH" => "Y"
];

$rs = CPage::GetList("", ($by = "s_last_date"), ($order = "desc"), $arFilter);
if ($ar = $rs->Fetch()) {
    echo $ar["COUNTER"];
} else {
    echo "0";
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question