Π‘ΠΊΡΠΈΠΏΡ ΠΠ΅ΡΡΠΈΠΊΠΈ Π·Π°Π½ΠΈΠΌΠ°Π΅Ρ Π±ΠΎΠ»Π΅Π΅ 350 ΠΠ (90 ΠΠ Π² GZIP), Π΄Π»Ρ Π»ΡΠ³ΠΊΠΈΡ ΡΡΡΠ°Π½ΠΈΡ ΠΈ Π½Π΅Π±ΠΎΠ»ΡΡΠΈΡ ΠΏΠ°ΠΊΠ΅ΡΠΎΠ² ΠΎΠ½ Π³ΡΠΎΠΌΠΎΠ·Π΄ΠΊΠΈΠΉ.
- Π‘Π²Π΅ΡΡ ΠΌΠ°Π»ΡΠΉ ΡΠ°Π·ΠΌΠ΅Ρ ΠΊΠΎΠ΄Π°.
- ΠΠΎΠ΄ ΠΏΠΎΠ΄ΠΊΠ»ΡΡΠ°Π΅ΡΡΡ Π² ΠΎΡΠ½ΠΎΠ²Π½ΠΎΠΉ Π±Π°Π½Π΄Π» ΠΏΡΠΎΠ΅ΠΊΡΠ°, Π½Π΅Ρ Π΄ΠΎΠΏΠΎΠ»Π½ΠΈΡΠ΅Π»ΡΠ½ΠΎΠ³ΠΎ Π·Π°ΠΏΡΠΎΡΠ° Π½Π° Π·Π°Π³ΡΡΠ·ΠΊΡ ΡΠΊΡΠΈΠΏΡΠ° ΠΈ ΠΏΠ°ΡΡΠΈΠ½Π³Π° ΠΊΠΎΠ΄Π° ΠΠ΅ΡΡΠΈΠΊΠΈ.
- ΠΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ Π² serviceWorkerβΠ΅, ΡΠ»Π΅ΠΊΡΡΠΎΠ½-ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡΡ ΠΈ Ρ.Π΄.
import { hit } from 'lyam';
const counterId = '12345';
// ΠΡΠ»ΠΈ Π½Π΅ ΡΠΊΠ°Π·Π°Π½Ρ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΡ, ΡΠΎ Π°Π΄ΡΠ΅Ρ ΡΡΡΠ°Π½ΠΈΡΡ Π±Π΅ΡΡΡΡΡ ΠΈΠ· location.href,
// Π·Π°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ ΡΡΡΠ°Π½ΠΈΡΡ ΠΈΠ· document.title ΠΈ
// ΡΠ΅ΡΠ΅ΡΠ΅Ρ ΠΈΠ· document.referrer.
hit(counterId);
Π‘ΠΎ Π²ΡΠ΅ΠΌΠΈ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΠ°ΠΌΠΈ:
import { hit } from 'lyam';
const counterId = '12345';
const userVars = { myParam: 123 };
hit(counterId, {
referrer: 'https://anothersite.ru',
title: 'My document title',
url: 'https://mysite.ru'
}, userVars);
import { hit, reachGoal } from 'lyam';
const counterId = '12345';
hit(counterId);
// ...
reachGoal(counterId, 'MY_GOAL_NAME');
import { hit, reachGoal } from 'lyam';
const counterId = '12345';
hit(counterId);
// ...
const userVars = { myParam: 123 };
reachGoal(counterId, 'MY_GOAL_NAME', userVars);
import { hit, extLink } from 'lyam';
const counterId = '12345';
hit(counterId);
// ...
extLink(counterId, 'https://externalsite.ru');
import { hit, file } from 'lyam';
const counterId = '12345';
hit(counterId);
// ...
file(counterId, 'https://mysite.ru/file.zip');
import { hit, notBounce } from 'lyam';
const counterId = '12345';
hit(counterId);
// ...
setTimeout(() => {
notBounce(counterId);
}, 15000); // 15 ΡΠ΅ΠΊ.
import { hit, params } from 'lyam';
const counterId = '12345';
hit(counterId);
// ...
params(counterId, { myParam: 123 });
import { hit, userParams } from 'lyam';
const counterId = '12345';
hit(counterId);
// ...
userParams(counterId, { myParam: 1, UserID: 12345 });
Content-Security-Policy:
...
img-src https://mc.yandex.ru;
connect-src https://mc.yandex.ru;
...
MIT