Answer the question
In order to leave comments, you need to log in
How to collect link click statistics?
There is a link to the phone a href="tel:" you need to collect the number of clicks from it and display it in the admin panel.
Started infoblock, element. I'm making an ajax request to a link.
Processing request:
$ELEMENT_ID = 3668; // код элемента
$PROPERTY_CODE = "jump";
$arSelect = Array(
'ID',
'PROPERTY_jump'
);
$arFilter = Array("IBLOCK_ID" => 25, "ACTIVE"=>"Y", "ID"=>$ELEMENT_ID);
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($rs = $res->Fetch())
{
$trueCount=$rs["PROPERTY_JUMP_VALUE"]; //вытаскиваю свойство элемента, куда нужно записать
$PROPERTY_VALUE = $trueCount+1; // к текущему значению плюсую 1.
CIBlockElement::SetPropertyValuesEx($ELEMENT_ID, 25, array($PROPERTY_CODE => $PROPERTY_VALUE)); //записываю новое значение
};
Answer the question
In order to leave comments, you need to log in
As for me - so the decision with +1 in the element and ajax sending is not the best idea.
I would connect some Yandex.Metrica, set the target to click on a link, and receive reports via the API in the admin panel. If it is very important to keep it at home, then you can take information once a day.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question