Integrate existing Metrika counter with private behavioral goals
Build and deploy / deploy (push) Successful in 38s
Build and deploy / deploy (push) Successful in 38s
This commit is contained in:
1 parent
8c58a54f5b
commit
0458a99d3a
19 files changed
+355
-3
No files matched your search
@@ -0,0 +1,26 @@
|
||||
# Existing Yandex Metrika counter 109268613
|
||||
|
||||
Analytics-only successor. The counter and six exact JavaScript goal definitions are owned by the coordinating task; this integration creates no counters or UI settings.
|
||||
|
||||
`web/lib/metrika.mjs` loads the official external SDK asynchronously only on HTTPS `progcode.ru` and its subdomains. `defer:true` and one explicit `hit` per mounted pathname implement Next.js navigation. Hash changes produce no pageview. Standard referrer/UTM attribution remains SDK-owned. `accurateTrackBounce:true` retains the default 15-second calculation; no forced `notBounce`. Webvisor is off, clickmap and external-link tracking on. There is no unconditional noscript tracking pixel that could bypass the host guard.
|
||||
|
||||
- `engaged_read`: actual `main.article-shell .article-content`, 60 seconds accumulated while visible and focused, at least 75% of the body reached, once per mounted article. About/contact/resources/tool pages are excluded.
|
||||
- `search_used`: explicit selection of a result while the local search is nonempty. Existing UI has no submit form. No keystroke conversion or query payload.
|
||||
- `search_zero_results`: actual displayed zero state after nonempty user input, debounced 500ms. No initial-empty conversion.
|
||||
- `related_content_click`: trusted clicks inside the actual related-content block, observed before Next.js consumes the link. Ordinary navigation stays silent.
|
||||
- `download_click`: enabled download anchors only. Current corpus contains none: this goal is inapplicable, not fabricated; no download-success claim.
|
||||
- `content_problem`: confirmed branded404, failed real article image, missing nonempty fragment after mount/hash change. Payload is only one enum reason. Unknown404 paths are replaced with `/404/` in custom pageviews. No raw search, fragment, exception text or invented contacts are sent in custom event parameters.
|
||||
|
||||
`browser-contract.json` records nine intercepted browser cases, including all four negative service-page cases, real UI clicks, real failed image, missing fragment, ordinary-navigation/hash silence and host guards. Time is advanced by Playwright clock; hidden/unfocused state is explicitly modelled because this automated Chrome reports both tabs focused. This verifies the state machine, not OS background timer behaviour. `browser-real-sdk.json` uses the actual downloaded SDK (SHA-256 recorded), verifies asynchronous loading and serialized search/zero goal requests. All statistical requests receive local empty responses; none are delivered to Yandex. This proves client serialization, not server-side reception or report appearance.
|
||||
|
||||
`csp.json` records the absent baseline CSP in source/live headers and zero browser policy violations. No CSP is added or relaxed. The exact new SDK purpose and bundled occurrences are in `analytics-outbound.json`; earlier editorial-link evidence keeps its historical source scope.
|
||||
|
||||
`preservation.json` compares every one of 81 exported HTML bodies after removing scripts, the identical route set, CSS and all11media against accepted source53f217. They are byte-identical. Raw captures, bodies, dates, sanitizer, anchors and historical binaries are unchanged. The source/build and persistent frozen-preview address are in `candidate.json`. Full historical restoration and the Semrush174/100 reconciliation remain OPEN.
|
||||
|
||||
Official references checked 2026-10-27:
|
||||
|
||||
- https://yandex.ru/support/metrica/ru/code/counter-spa-setup
|
||||
- https://yandex.ru/support/metrica/ru/code/counter-initialize
|
||||
- https://yandex.ru/support/metrica/ru/code/install-counter-csp
|
||||
|
||||
Replay the browser scripts in an isolated `playwright-cli` Chrome session; their local origin points at the frozen candidate. Do not remove interception or execute these actions against a live counter. Preserve exact exported output bytes and raw provenance.
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"sourceURL": "https://mc.yandex.ru/metrika/tag.js",
|
||||
"sourceFile": "web/lib/metrika.mjs",
|
||||
"counterId": 109268613,
|
||||
"purpose": "Explicitly requested existing-site audience analytics; external async official SDK only on HTTPS own domain/subdomains. No restored advertising link or historical dependency reinstated.",
|
||||
"bundles": [
|
||||
{
|
||||
"file": "web/out/_next/static/chunks/16ycc1h_d7jq6.js",
|
||||
"sha256": "7b705f06dad2c0d62979f72f3ea6f06fcfe17a0962a305fdeef05a3aa5a8cddf"
|
||||
}
|
||||
],
|
||||
"observedSDKEndpoints": [
|
||||
"https://mc.yandex.ru/clmap/109268613",
|
||||
"https://mc.yandex.ru/metrika/advert.gif",
|
||||
"https://mc.yandex.ru/watch/109268613"
|
||||
],
|
||||
"contentLinkPreservation": "All81HTML bodies byte-identical excluding scripts, so published content outbound anchors retain exact accepted baseline purposes. Historical archive captures untouched.",
|
||||
"historicalLedger": "docs/rebuild-v2/outbound-links.json records previous53f217 source scope; analytics URLs are inventoried separately here, not silently allowlisted.",
|
||||
"sourceHash": "527ea7bf774eca2b18d9dcd2f1ab0ac0341fa87e50a160ad75aefb3e30ad31a2"
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
async page => {
|
||||
const context=page.context();const calls=[],external=[],violations=[],errors=[];
|
||||
await context.route('**/*',async route=>{const url=route.request().url();if(['https://progcode.ru/','https://www.progcode.ru/','http://progcode.ru/','https://progcode.ru.evil.test/'].some(origin=>url.startsWith(origin))){const r=await context.request.get(url.replace(/^https?:\/\/[^/]+/,'http://127.0.0.1:51555'));await route.fulfill({response:r});}else if(url==='https://mc.yandex.ru/metrika/tag.js'){external.push({url,action:'stub SDK'});await route.fulfill({contentType:'application/javascript',body:'const queued=window.ym.a||[];window.__ymCalls=[];window.ym=function(){window.__ymCalls.push(Array.from(arguments));};for(const args of queued)window.ym(...args);'});}else if(url.startsWith('http://127.0.0.1:51555/')) await route.continue();else{external.push({url,action:'aborted'});await route.abort();}});
|
||||
await context.addInitScript(()=>document.addEventListener('securitypolicyviolation',e=>(window.__cspViolations??=[]).push(e.violatedDirective)));
|
||||
page.on('pageerror',e=>errors.push(e.message));
|
||||
const read=()=>page.evaluate(()=>window.__ymCalls||[]);
|
||||
const count=(list,event)=>list.filter(x=>x[1]==='reachGoal'&&x[2]===event).length;
|
||||
const check=(condition,message)=>{if(!condition)throw Error(message);};
|
||||
await page.clock.install();await page.goto('http://127.0.0.1:51555/');await page.waitForTimeout(700);
|
||||
check(await page.evaluate(()=>!window.ym&&!document.querySelector('script[src*="mc.yandex"]')),'localhost loaded counter');
|
||||
calls.push({case:'localhost guard',passed:true});
|
||||
for(const host of ['http://progcode.ru/','https://progcode.ru.evil.test/']){await page.goto(host);await page.waitForTimeout(300);check(await page.evaluate(()=>!window.ym),'guard failure '+host);}
|
||||
await page.goto('https://www.progcode.ru/');await page.waitForFunction(()=>window.__ymCalls?.length>=2);calls.push({case:'HTTP and hostname suffix denied; www allowed',passed:true});
|
||||
for(const path of ['/about/','/контакты/','/resources/','/tools/']){await page.goto('https://progcode.ru'+path);await page.waitForFunction(()=>window.__ymCalls?.length>=2);await page.evaluate(()=>scrollTo({top:document.body.scrollHeight,behavior:'instant'}));await page.clock.fastForward(61000);check(!count(await read(),'engaged_read'),'nonarticle read '+path);check(!count(await read(),'content_problem'),'inapplicable content problem '+path);}
|
||||
calls.push({case:'61s at bottom on about, legacycontacts, resources and tools: no article event or inapplicable diagnostic',passed:true});
|
||||
await page.goto('https://progcode.ru/');await page.waitForFunction(()=>window.__ymCalls?.length>=2);
|
||||
let list=await read();check(list.filter(x=>x[1]==='init').length===1,'duplicate init');check(list.filter(x=>x[1]==='hit').length===1,'initial hit');check(!count(list,'engaged_read')&&!count(list,'search_zero_results'),'initial goals');
|
||||
await page.locator('#search').fill('private@example.test');await page.waitForTimeout(650);list=await read();check(count(list,'search_zero_results')===1,'zero result event missing');check(!JSON.stringify(list).includes('private@example.test'),'query leaked');
|
||||
await page.locator('#search').fill('мусорщика');await page.locator('.journal-list a').first().click();await page.waitForSelector('.article-content');await page.waitForTimeout(300);list=await read();check(count(list,'search_used')===1,'selection search event missing');check(list.filter(x=>x[1]==='hit').length===2,'SPA hit missing/duplicate');check(list.filter(x=>x[1]==='init').length===1,'SPA reinit');
|
||||
calls.push({case:'initial / search privacy / client navigation',passed:true,calls:list});
|
||||
await page.bringToFront();await page.evaluate(()=>scrollTo({top:0,behavior:'instant'}));await page.clock.fastForward(61000);check(!count(await read(),'engaged_read'),'read without depth');
|
||||
await page.evaluate(()=>document.querySelector('.article-content').scrollIntoView({block:'end',behavior:'instant'}));await page.clock.fastForward(1000);check(count(await read(),'engaged_read')===1,'qualified read missing');await page.clock.fastForward(61000);check(count(await read(),'engaged_read')===1,'read repeated');
|
||||
calls.push({case:'61 seconds without depth; depth then once',passed:true});
|
||||
const related=page.locator('.related a').first();await related.waitFor({timeout:5000});await related.click();await page.waitForTimeout(300);check(count(await read(),'related_content_click')===1,'related event missing');
|
||||
await page.evaluate(()=>document.querySelector('.article-content').scrollIntoView({block:'end',behavior:'instant'}));await page.clock.fastForward(30000);
|
||||
await page.evaluate(()=>{Object.defineProperty(document,'hasFocus',{value:()=>false,configurable:true});Object.defineProperty(document,'visibilityState',{value:'hidden',configurable:true});dispatchEvent(new Event('blur'));document.dispatchEvent(new Event('visibilitychange'));});await page.clock.fastForward(61000);check(count(await read(),'engaged_read')===1,'unfocused time counted');await page.evaluate(()=>{delete document.hasFocus;delete document.visibilityState;dispatchEvent(new Event('focus'));document.dispatchEvent(new Event('visibilitychange'));});await page.clock.fastForward(28000);check(count(await read(),'engaged_read')===1,'focus resumed too early');await page.clock.fastForward(3000);check(count(await read(),'engaged_read')===2,'focused total not counted');
|
||||
calls.push({case:'related navigation and excluded 61s simulated hidden/unfocused state',passed:true});
|
||||
const beforeHash=await read();await page.evaluate(()=>{location.hash='main';});await page.clock.fastForward(1000);check((await read()).filter(x=>x[1]==='hit').length===beforeHash.filter(x=>x[1]==='hit').length,'hash fabricated hit');
|
||||
await page.evaluate(()=>{location.hash='nonexistent-private-fragment';});await page.clock.fastForward(1000);check((await read()).some(x=>x[2]==='content_problem'&&x[3]?.reason==='fragment_missing'),'missing fragment missing');
|
||||
const img=page.locator('.article-content img').first();if(await img.count()){await img.evaluate(el=>{el.src='/broken-test-image.jpg';el.loading='eager';});await page.waitForTimeout(300);check((await read()).some(x=>x[2]==='content_problem'&&x[3]?.reason==='image_failed'),'failed image event missing');}
|
||||
calls.push({case:'fragment / failed real content image',passed:true,imagePresent:!!(await img.count()),calls:await read()});
|
||||
const beforeNav=await read();await page.locator('.masthead a[href="/resources/"]').click();await page.waitForTimeout(300);const afterNav=await read();check(afterNav.filter(x=>x[1]==='hit').length===beforeNav.filter(x=>x[1]==='hit').length+1,'ordinary navigation hit');check(afterNav.filter(x=>x[1]==='reachGoal').length===beforeNav.filter(x=>x[1]==='reachGoal').length,'ordinary navigation goal');check(!count(afterNav,'download_click'),'download fabricated');calls.push({case:'existing hash no extra hit; ordinary navigation no recommendation/download goal',passed:true});
|
||||
await page.goto('https://progcode.ru/unknown-private-path/');await page.waitForFunction(()=>window.__ymCalls?.some(x=>x[2]==='content_problem'&&x[3]?.reason==='not_found'));list=await read();check(!JSON.stringify(list).includes('unknown-private-path'),'unknown URL leaked in calls');check(!list.some(x=>x[1]==='notBounce'),'forced bounce');
|
||||
calls.push({case:'confirmed 404 and missing fragment; unavailable downloads stay silent',passed:true,calls:list});
|
||||
return {cases:calls,external,errors,cspViolations:await page.evaluate(()=>window.__cspViolations||[]),statisticsSent:0};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"cases":[{"case":"localhost guard","passed":true},{"case":"HTTP and hostname suffix denied; www allowed","passed":true},{"case":"61s at bottom on about, legacycontacts, resources and tools: no article event or inapplicable diagnostic","passed":true},{"case":"initial / search privacy / client navigation","passed":true,"calls":[[109268613,"init",{"defer":true,"clickmap":true,"trackLinks":true,"accurateTrackBounce":true,"webvisor":false,"trackHash":false}],[109268613,"hit","https://progcode.ru/",{"title":"ProgCode — записки о программировании","referer":""}],[109268613,"reachGoal","search_zero_results"],[109268613,"reachGoal","search_used"],[109268613,"hit","https://progcode.ru/articles/dconf-2017-%D0%BF%D0%BE%D0%B4-%D0%BA%D0%B0%D0%BF%D0%BE%D1%82%D0%BE%D0%BC-%D0%BC%D1%83%D1%81%D0%BE%D1%80%D1%89%D0%B8%D0%BA%D0%B0-%D0%B4%D0%B8-%D0%B4%D0%BC%D0%B8%D1%82%D1%80%D0%B8%D0%B9-%D0%BE%D0%BB/",{"title":"DConf-2017. Под капотом мусорщика D (Дмитрий Ольшанский) — ProgCode","referer":"https://progcode.ru/"}]]},{"case":"61 seconds without depth; depth then once","passed":true},{"case":"related navigation and excluded 61s simulated hidden/unfocused state","passed":true},{"case":"fragment / failed real content image","passed":true,"imagePresent":true,"calls":[[109268613,"init",{"defer":true,"clickmap":true,"trackLinks":true,"accurateTrackBounce":true,"webvisor":false,"trackHash":false}],[109268613,"hit","https://progcode.ru/",{"title":"ProgCode — записки о программировании","referer":""}],[109268613,"reachGoal","search_zero_results"],[109268613,"reachGoal","search_used"],[109268613,"hit","https://progcode.ru/articles/dconf-2017-%D0%BF%D0%BE%D0%B4-%D0%BA%D0%B0%D0%BF%D0%BE%D1%82%D0%BE%D0%BC-%D0%BC%D1%83%D1%81%D0%BE%D1%80%D1%89%D0%B8%D0%BA%D0%B0-%D0%B4%D0%B8-%D0%B4%D0%BC%D0%B8%D1%82%D1%80%D0%B8%D0%B9-%D0%BE%D0%BB/",{"title":"DConf-2017. Под капотом мусорщика D (Дмитрий Ольшанский) — ProgCode","referer":"https://progcode.ru/"}],[109268613,"reachGoal","engaged_read"],[109268613,"reachGoal","related_content_click"],[109268613,"hit","https://progcode.ru/articles/%D0%BE-tilix-%D0%B8-d-%D0%B8%D0%BD%D1%82%D0%B5%D1%80%D0%B2%D1%8C%D1%8E-%D1%81-%D0%B3%D0%B5%D1%80%D0%B0%D0%BB%D1%8C%D0%B4%D0%BE%D0%BC-%D0%BD%D0%B0%D0%BD%D0%BD%D0%BE%D0%BC/",{"title":"О Tilix и D: интервью с Геральдом Нанном — ProgCode","referer":"https://progcode.ru/articles/dconf-2017-%D0%BF%D0%BE%D0%B4-%D0%BA%D0%B0%D0%BF%D0%BE%D1%82%D0%BE%D0%BC-%D0%BC%D1%83%D1%81%D0%BE%D1%80%D1%89%D0%B8%D0%BA%D0%B0-%D0%B4%D0%B8-%D0%B4%D0%BC%D0%B8%D1%82%D1%80%D0%B8%D0%B9-%D0%BE%D0%BB/"}],[109268613,"reachGoal","engaged_read"],[109268613,"reachGoal","content_problem",{"reason":"fragment_missing"}],[109268613,"reachGoal","content_problem",{"reason":"image_failed"}]]},{"case":"existing hash no extra hit; ordinary navigation no recommendation/download goal","passed":true},{"case":"confirmed 404 and missing fragment; unavailable downloads stay silent","passed":true,"calls":[[109268613,"init",{"defer":true,"clickmap":true,"trackLinks":true,"accurateTrackBounce":true,"webvisor":false,"trackHash":false}],[109268613,"hit","https://progcode.ru/404/",{"title":"ProgCode — записки о программировании","referer":""}],[109268613,"reachGoal","content_problem",{"reason":"not_found"}]]}],"external":[{"url":"https://mc.yandex.ru/metrika/tag.js","action":"stub SDK"},{"url":"https://mc.yandex.ru/metrika/tag.js","action":"stub SDK"},{"url":"https://mc.yandex.ru/metrika/tag.js","action":"stub SDK"},{"url":"https://mc.yandex.ru/metrika/tag.js","action":"stub SDK"},{"url":"https://mc.yandex.ru/metrika/tag.js","action":"stub SDK"},{"url":"https://mc.yandex.ru/metrika/tag.js","action":"stub SDK"},{"url":"https://mc.yandex.ru/metrika/tag.js","action":"stub SDK"}],"errors":[],"cspViolations":[],"statisticsSent":0}
|
||||
@@ -0,0 +1,19 @@
|
||||
async page => {
|
||||
const context=page.context(),requests=[],errors=[],violations=[];
|
||||
const sdkResponse=await context.request.get('https://mc.yandex.ru/metrika/tag.js');
|
||||
if(sdkResponse.status()!==200)throw Error('SDK HTTP '+sdkResponse.status());
|
||||
const sdk=await sdkResponse.text();
|
||||
await context.route('**/*',async route=>{const url=route.request().url();if(url.startsWith('https://progcode.ru/')){const r=await context.request.get(url.replace('https://progcode.ru','http://127.0.0.1:51555'));await route.fulfill({response:r});}else if(url==='https://mc.yandex.ru/metrika/tag.js'){await route.fulfill({body:sdk,contentType:'application/javascript'});}else{const data=url+' '+(route.request().postData()||'');requests.push({endpoint:url.split('?')[0],method:route.request().method(),goalSearch:data.includes('search_used'),goalZero:data.includes('search_zero_results'),containsTestQuery:data.includes('private%40example')||data.includes('private@example')});await route.fulfill({status:200,contentType:'application/json',body:'{}'});}});
|
||||
page.on('pageerror',e=>errors.push(e.message));
|
||||
await context.addInitScript(()=>document.addEventListener('securitypolicyviolation',e=>(window.__cspViolations??=[]).push(e.violatedDirective)));
|
||||
await page.goto('https://progcode.ru/');await page.waitForTimeout(2000);
|
||||
await page.locator('#search').fill('private@example.test');await page.waitForTimeout(1000);
|
||||
await page.locator('#search').fill('jquery');await page.locator('.journal-list a').first().click();await page.waitForTimeout(1500);
|
||||
if(!requests.some(x=>x.endpoint.includes('/watch/109268613')))throw Error('No real SDK watch request');
|
||||
const goalsSerialized=requests.some(x=>x.goalZero)&&requests.some(x=>x.goalSearch);if(!goalsSerialized)throw Error('Real SDK goals not serialized');
|
||||
if(requests.some(x=>x.containsTestQuery))throw Error('Raw search leaked');
|
||||
if(errors.length)throw Error('SDK error '+errors.join(';'));
|
||||
const csp=await page.evaluate(()=>window.__cspViolations||[]);if(csp.length)throw Error('CSP violations');
|
||||
const sdkSHA256=await page.evaluate(async source=>[...new Uint8Array(await crypto.subtle.digest('SHA-256',new TextEncoder().encode(source)))].map(v=>v.toString(16).padStart(2,'0')).join(''),sdk);
|
||||
return {goalsSerialized,sdkSHA256,sdkHTTP:sdkResponse.status(),sdkBytes:sdk.length,sdkServedAsExternalAsyncScript:await page.locator('script[src="https://mc.yandex.ru/metrika/tag.js"]').evaluate(el=>el.async),requests,errors,cspViolations:csp,allStatisticsRequestsLocallyFulfilled:true,statisticsDelivered:0};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"goalsSerialized":true,"sdkSHA256":"c960d3e7f2e954d977f05c0771980813d49697f5b2c4add76da7ea9b7285fe50","sdkHTTP":200,"sdkBytes":223352,"sdkServedAsExternalAsyncScript":true,"requests":[{"endpoint":"https://mc.yandex.ru/metrika/advert.gif","method":"GET","goalSearch":false,"goalZero":false,"containsTestQuery":false},{"endpoint":"https://mc.yandex.ru/watch/109268613","method":"GET","goalSearch":false,"goalZero":false,"containsTestQuery":false},{"endpoint":"https://mc.yandex.ru/watch/109268613","method":"GET","goalSearch":false,"goalZero":false,"containsTestQuery":false},{"endpoint":"https://mc.yandex.ru/watch/109268613","method":"POST","goalSearch":false,"goalZero":true,"containsTestQuery":false},{"endpoint":"https://mc.yandex.ru/clmap/109268613","method":"GET","goalSearch":false,"goalZero":false,"containsTestQuery":false},{"endpoint":"https://mc.yandex.ru/watch/109268613","method":"POST","goalSearch":true,"goalZero":false,"containsTestQuery":false},{"endpoint":"https://mc.yandex.ru/watch/109268613","method":"GET","goalSearch":false,"goalZero":false,"containsTestQuery":false}],"errors":[],"cspViolations":[],"allStatisticsRequestsLocallyFulfilled":true,"statisticsDelivered":0}
|
||||
@@ -0,0 +1,46 @@
|
||||
npm warn Unknown user config "store-dir". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
|
||||
npm warn Unknown user config "cache-dir". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
|
||||
npm warn Unknown user config "public-hoist-pattern". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
|
||||
|
||||
> progcode@1.0.0 build
|
||||
> node scripts/check-dates.mjs && node scripts/prepare-publication.mjs && next build
|
||||
|
||||
{"historicalCalendar":"UTC","fixtures":3,"hostTimezones":["UTC","Europe/Moscow"],"passed":true}
|
||||
{"sourceHash":"527ea7bf774eca2b18d9dcd2f1ab0ac0341fa87e50a160ad75aefb3e30ad31a2","articles":14,"hostileFixturePassed":true}
|
||||
▲ Next.js 16.2.6 (Turbopack)
|
||||
- Experiments (use with caution):
|
||||
· cpus: 2
|
||||
|
||||
Creating an optimized production build ...
|
||||
✓ Compiled successfully in 1034ms
|
||||
Running TypeScript ...
|
||||
Finished TypeScript in 48ms ...
|
||||
Collecting page data using 2 workers ...
|
||||
Generating static pages using 2 workers (0/80) ...
|
||||
Generating static pages using 2 workers (20/80)
|
||||
Generating static pages using 2 workers (40/80)
|
||||
Generating static pages using 2 workers (60/80)
|
||||
✓ Generating static pages using 2 workers (80/80) in 197ms
|
||||
Finalizing page optimization ...
|
||||
|
||||
Route (app)
|
||||
┌ ○ /
|
||||
├ ○ /_not-found
|
||||
├ ● /[...path]
|
||||
│ ├ /2019/01/12/использование-jquery-в-webpack
|
||||
│ ├ /2018/10/19/bitrix-api-add-foto-editor
|
||||
│ ├ /2017/08/25/о-tilix-и-d-интервью-с-геральдом-нанном
|
||||
│ └ [+57 more paths]
|
||||
├ ○ /about
|
||||
├ ● /articles/[slug]
|
||||
│ ├ /articles/использование-jquery-в-webpack
|
||||
│ ├ /articles/bitrix-api-add-foto-editor
|
||||
│ ├ /articles/о-tilix-и-d-интервью-с-геральдом-нанном
|
||||
│ └ [+11 more paths]
|
||||
├ ○ /resources
|
||||
└ ○ /tools
|
||||
|
||||
|
||||
○ (Static) prerendered as static content
|
||||
● (SSG) prerendered as static HTML (uses generateStaticParams)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"recordedAtUTC": "2026-10-27T00:58:29.956518+00:00",
|
||||
"counterId": 109268613,
|
||||
"beads": "webprogcode-v2.9",
|
||||
"sourceHash": "527ea7bf774eca2b18d9dcd2f1ab0ac0341fa87e50a160ad75aefb3e30ad31a2",
|
||||
"buildHash": "6b075dc0d017a122dbc842726882266da62932f6e30059428d99b1cf2c3c375b",
|
||||
"buildFiles": 680,
|
||||
"local": {
|
||||
"pid": 67671,
|
||||
"port": 51555,
|
||||
"url": "http://127.0.0.1:51555",
|
||||
"staticRoot": "/private/tmp/progcode-metrika-frozen-527ea7bf774e"
|
||||
},
|
||||
"previousProductionCommit": "148028943f1d95ef560134981501c8264ba3839f",
|
||||
"previousLocal": {
|
||||
"url": "http://127.0.0.1:56636",
|
||||
"pid": 28304
|
||||
},
|
||||
"delivery": "pending exact source commit and CI",
|
||||
"historicalRestoration": "OPEN; analytics success does not close Semrush/full historical gates"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"checkedAtUTC": "2026-10-27T00:58:29.956518+00:00",
|
||||
"deploymentSource": "Dockerfile and deploy/stack.example.yml",
|
||||
"existingPolicy": null,
|
||||
"liveResponseStatusLine": "HTTP/2 200 ",
|
||||
"liveCSPHeaders": [],
|
||||
"policyChanges": null,
|
||||
"SDKRequestedOrigins": [
|
||||
"https://mc.yandex.ru"
|
||||
],
|
||||
"browserViolations": [],
|
||||
"scope": "No CSP existed in source or observed live headers. No policy added or relaxed; intercepted real SDK had zero violations. This is not a test of a newly enforced policy."
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"htmlBodiesCompared": 81,
|
||||
"htmlBodiesByteIdenticalExcludingScripts": true,
|
||||
"routeSetIdentical": true,
|
||||
"cssAndMediaByteIdentical": 12,
|
||||
"sourceHash": "527ea7bf774eca2b18d9dcd2f1ab0ac0341fa87e50a160ad75aefb3e30ad31a2",
|
||||
"buildFiles": 680,
|
||||
"buildHash": "6b075dc0d017a122dbc842726882266da62932f6e30059428d99b1cf2c3c375b",
|
||||
"baselineSource": "53f217e5370ecafe41a0afcfe51fe80f2e443f04637adbe0d4f7476babe9beeb"
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
# Programmer review — analytics-only integration
|
||||
|
||||
Reviewer `/root/programmer_expert`, 2026-10-27. Scope: current `web/lib/metrika.mjs`, `web/app/Metrika.jsx`, Catalog/layout diff and counter/event contract at `/Users/gavrilovdev/tmp/pupline/site-restoration-status/metrika/counters-and-contract.json`. No product edits, browser launch or statistics submission performed by this reviewer.
|
||||
|
||||
**Source verdict: ACCEPTED with the identified article-scope defect corrected in source. Final fixed-build and release acceptance remain pending.** Earlier intercepted results are useful, but do not by themselves prove behavior of the final rebuilt candidate. No full restoration PASS.
|
||||
|
||||
## Actual finding and correction
|
||||
|
||||
Initial blocking finding M-1: `.article-content` was also present on `/about/` and its legacy `/контакты/` equivalent (`web/app/about/page.jsx`), so the original observer could award engaged_read there after60 visible/focused seconds and75% depth. This violated the contract's actual-article-only condition.
|
||||
|
||||
Re-read corrected source: `metrika.mjs:41-43` now scopes both reading body and content-image failure detection to `main.article-shell .article-content`. Canonical and legacy articles use that actual template; about/resources/tools do not. This is the appropriate small compromise: retain the generic content styling class, bind analytics to the real article template. Source defect resolved. Required final behavioral evidence: intercepted61-second/depth negative cases on `/about/`, `/контакты/`, `/resources/`, `/tools/`, alongside positive article timing/depth and hidden/unfocused exclusions.
|
||||
|
||||
## Code and contract inspection
|
||||
|
||||
- `metrika.mjs:2-12`: existing counter109268613; HTTPS plus exact apex or dot-bounded subdomain guard. Localhost, HTTP and suffix-spoof domains fail. Custom event names are allowlisted; content_problem adds only one fixed reason enum. No raw query, URL, fragment, personal metadata or error text is placed in custom goal parameters.
|
||||
- `:19-34`: one SDK/init setup per module lifecycle, `defer:true` plus one explicit initial hit and subsequent pathname-change hits. `Metrika.jsx` effect depends on `usePathname`, so ordinary hash changes do not create synthetic hits. No explicit notBounce, forced bounce manipulation or scroll/timer-generated hit exists. `accurateTrackBounce:true`, trackHash:false and webvisor:false match the contract. Route effects clean up listeners/timers.
|
||||
- `:36-56`: confirmed branded404 template marker; actual content-image error/cache-failure checks; nonempty ordinary fragment decoded and checked against id/name. Reasons are deduplicated per observed route lifecycle. Absence of an image on an inapplicable page is not itself an event. Missing404 URL is normalized in the explicit hit to `/404/` rather than custom diagnostic payload carrying the bad path.
|
||||
- `:57-64`: trusted primary-button clicks, current aria-disabled exclusion; related_content_click only within `.related`, not every internal link. download_click requires an actual `download` anchor and is a click event, not claimed completion. Current site has no invented download flow. Capture-phase listening lets actual Next Link clicks be observed before Next's client routing interception; the event measures the click, not successful navigation.
|
||||
- `:65-91`: elapsed time accrues only while the previous visibility/focus state is active; focus/blur/visibility events update accounting. Threshold requires actual article body, active current state, elapsed>=60000ms and viewport reaching75% of article height; once-per-observed-page boolean. Timers and all registered listeners are cleaned up on route change. About-scope fix above is essential to this logic.
|
||||
- Catalog: search_zero_results is debounced only for actual nonempty query with displayed zero results; initial blank state does not fire. search_used fires on explicit trusted result selection when the query is nonempty. This site does not have a submit-search UX, so the selected contractual branch is explicit selection. Typing alone is not mislabeled as submit; query text is never passed to trackGoal.
|
||||
- Layout only mounts the client observer; content, body data, route map, CSS and visual assets are outside this analytics change. The precise preservation result must be tied to the final new build before release.
|
||||
|
||||
## Evidence inspected and limits
|
||||
|
||||
Read `docs/metrika/browser-contract.js`, `browser-real-sdk.js`, existing JSON results, CSP record and preservation verifier. Contract harness routes all requests before navigation, serves local site under guarded production host and stubs the SDK; the separate real-SDK harness serves actual downloaded SDK bytes while locally fulfilling all statistics requests. Neither harness is a live-statistics delivery test. Recorded real SDK result shows both search/zero goals serialized, no raw test query in captured request payload, no runtime/CSP errors, locally fulfilled requests and statisticsDelivered0. No existing CSP relaxation is claimed or needed by the current record.
|
||||
|
||||
Read current preservation record:81 HTML body regions equal baseline excluding scripts, route set identical,12 CSS/media bytes unchanged. This is appropriate bounded analytics evidence, but the record was being regenerated during review. **No final fixed-build PASS is claimed here until updated exact candidate identity, negative nonarticle cases and relevant intercepted results are pinned together.** This reviewer did not run the browser or actual SDK and sent no statistics.
|
||||
|
||||
Source file SHA256 at this review:
|
||||
|
||||
- metrika.mjs: fd2a25b321bb530887076dd574e95cf9946e8aac72cf659a08da3b74172b1d54
|
||||
- Metrika.jsx: ae4d7a4e17919f1c7c1ce0b89c40f2e19c73d851ba17c56a772def1090fe771f
|
||||
- Catalog.jsx: 6510a71e0b49a92fdc464260408b26d5f7fe187cb04c570875bdccee57fd759f
|
||||
- layout.jsx: 6f26f3645ca50604f86e09d8f0a08d51d67e0bb8ce8e2b58176c2cb8ee4d6986
|
||||
|
||||
Final analytics release gate: exact-source rebuild/preservation; intercepted negative/positive event and SPA-hit checks after final selector fix; actual SDK serialization with no external statistics delivery; successful authorized site-specific CI/deploy; healthy exact OCI/source identity and public HTTPS for apex/www. Existing restoration/content gates remain independent and are not waived by analytics acceptance.
|
||||
@@ -0,0 +1,15 @@
|
||||
import re,json,hashlib
|
||||
from pathlib import Path
|
||||
old=Path('/tmp/progcode-v2-frozen-53f217e5370e');new=Path('/Users/gavrilovdev/tmp/progcode.ru/web/out')
|
||||
pages=sorted(p.relative_to(old) for p in old.rglob('*.html'))
|
||||
assert set(pages)==set(p.relative_to(new) for p in new.rglob('*.html'))
|
||||
def body(path):
|
||||
s=path.read_text();s=re.search(r'<body[^>]*>([\s\S]*)</body>',s).group(1)
|
||||
return re.sub(r'<script\b[^>]*>[\s\S]*?</script>','',s)
|
||||
for p in pages:assert body(old/p)==body(new/p),str(p)
|
||||
assets=[p.relative_to(old) for p in old.rglob('*') if p.is_file() and (p.suffix=='.css' or 'visuals' in p.parts)]
|
||||
for p in assets:assert (old/p).read_bytes()==(new/p).read_bytes(),str(p)
|
||||
h=hashlib.sha256();files=sorted(p.relative_to(new) for p in new.rglob('*') if p.is_file())
|
||||
for p in files:h.update(str(p).encode());h.update((new/p).read_bytes())
|
||||
report=dict(htmlBodiesCompared=len(pages),htmlBodiesByteIdenticalExcludingScripts=True,routeSetIdentical=True,cssAndMediaByteIdentical=len(assets),sourceHash=json.loads((new/'build-identity.json').read_text())['sourceHash'],buildFiles=len(files),buildHash=h.hexdigest(),baselineSource='53f217e5370ecafe41a0afcfe51fe80f2e443f04637adbe0d4f7476babe9beeb')
|
||||
print(json.dumps(report,indent=2))
|
||||
Reference in new issue
Block a user