Keep Yandex Metrica in the code, dormant behind HM_YM_ID
- Restore analytics.js, the counter id and the consent banner. The banner renders and the "Cookie" reset button exists only when HM_YM_ID is non-zero; at 0 the node is removed and no request reaches mc.yandex.ru. - Release state stays data-free (verified headless): id 0, banner absent, 0 requests to Yandex, 0 external hosts. With an id set, the banner appears, and tag.js loads only after "Принять". - check-release now fails on a non-zero counter instead of banning the code, so the gate protects the release state, not the implementation. - privacy.html says the counter exists but is not activated; ads-readiness section 3 is the enable procedure (id + RKN notice + policy paragraph).
This commit is contained in:
1 parent
0ac596086a
commit
a013db4c5b
9 files changed
+174
-19
No files matched your search
@@ -26,17 +26,19 @@ const text = files.filter((f) => /\.(html|js|css|md)$/.test(f));
|
||||
const rel = (f) => f.slice(ROOT.length + 1).replace(/\\/g, '/');
|
||||
|
||||
// 1. Запрещённые ссылки в поставляемых файлах.
|
||||
// Третий элемент — файл, к которому правило относится (иначе правило глобальное).
|
||||
const BANNED = [
|
||||
[/Work_files/i, 'ссылка на Work_files (вне docroot)'],
|
||||
[/contact\.php/i, 'PHP-эндпоинт формы'],
|
||||
[/HM_YM_ID|mc\.yandex\.ru/i, 'Яндекс.Метрика'],
|
||||
[/<script>\s*window\.HM_YM_ID\s*=\s*(?!0\b)\d+/, 'счётчик Метрики включён (релиз идёт без сбора данных)', /index\.html$/],
|
||||
[/(fonts|ajax)\.googleapis\.com|fonts\.gstatic\.com/i, 'внешние шрифты'],
|
||||
[/localhost|127\.0\.0\.1/i, 'локальный адрес'],
|
||||
[/<form\b/i, 'поле ввода / форма'],
|
||||
];
|
||||
for (const f of text) {
|
||||
const body = readFileSync(f, 'utf8');
|
||||
for (const [re, why] of BANNED) {
|
||||
for (const [re, why, only] of BANNED) {
|
||||
if (only && !only.test(f)) continue;
|
||||
if (re.test(body)) errors.push(`${rel(f)}: ${why}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user