23 $this->provider = $provider;
29 public function save(): void
31 $providerData = $this->provider->getData();
34 $this->savePayload($providerData);
52 $analyticsIterator = AnalyticsTable::getList([
53 'select' => [
'ID',
'PAYLOAD'],
56 '<=CREATED_AT' => $dateTo,
59 while ($analyticsData = $analyticsIterator->fetch())
62 'data' => $analyticsData[
'PAYLOAD'],
63 'hash' => self::calculateHash($analyticsData),
77 if (empty($providerCode))
82 AnalyticsTable::deleteByCodeAndDate($providerCode, $dateTo);
85 private function savePayload(array $data): void
88 'CODE' => $this->provider::getCode(),
97 private static function calculateHash(array $data): string
101 $uniqParam = BX24_HOST_NAME;
105 $uniqParam = Main\Analytics\Counter::getPrivateKey();
108 return md5(serialize($data) . $uniqParam);
114 private static function isB24(): bool
116 return Main\Loader::includeModule(
'bitrix24');
127 $dateTo->add(
'-30D');
129 AnalyticsTable::deleteByDate($dateTo);
131 return '\Bitrix\Sale\Internals\Analytics\Storage::cleanUpAgent();';