← back to Tk10661 Product Seo
TK-10661: JSON-LD $4.25 price leak — ~62% of DW products advertise sample price in structured data (Wilson CI 53-70%), theme variant-selection root cause
576f31703fa4a943da459a57d0582915254bded0 · 2026-08-18 01:59:00 -0700 · steve
Files touched
A .gitignoreA data/leak-rate-result.jsonA data/seo-result.jsonA data/seo-sample.jsonA leak-rate.mjsA seo-sampler.mjs
Diff
commit 576f31703fa4a943da459a57d0582915254bded0
Author: steve <steve@designerwallcoverings.com>
Date: Tue Aug 18 01:59:00 2026 -0700
TK-10661: JSON-LD $4.25 price leak — ~62% of DW products advertise sample price in structured data (Wilson CI 53-70%), theme variant-selection root cause
---
.gitignore | 3 +
data/leak-rate-result.json | 34 +++
data/seo-result.json | 65 ++++++
data/seo-sample.json | 502 +++++++++++++++++++++++++++++++++++++++++++++
leak-rate.mjs | 27 +++
seo-sampler.mjs | 48 +++++
6 files changed, 679 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2524647
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+node_modules/
+.env*
+*.log
diff --git a/data/leak-rate-result.json b/data/leak-rate-result.json
new file mode 100644
index 0000000..389912b
--- /dev/null
+++ b/data/leak-rate-result.json
@@ -0,0 +1,34 @@
+{
+ "regular_tested": 120,
+ "price_4_25_in_schema": 74,
+ "real_price": 46,
+ "no_product_schema": 0,
+ "fetch_err": 0,
+ "leak_rate": 0.617,
+ "wilson95": [
+ 0.527,
+ 0.699
+ ],
+ "real_price_examples": [
+ {
+ "url": "/products/malibu-sisal-aquamarine-phillipe-romano",
+ "price": 35.63
+ },
+ {
+ "url": "/products/palm-beach-cork-wallcovering-rhododendron",
+ "price": 59.5
+ },
+ {
+ "url": "/products/greenfield-hybrid-hollywood-wallcoverings",
+ "price": 58.93
+ },
+ {
+ "url": "/products/dwkk-117420",
+ "price": 288.75
+ },
+ {
+ "url": "/products/ground-control-to-major-tim-black-1",
+ "price": 12
+ }
+ ]
+}
diff --git a/data/seo-result.json b/data/seo-result.json
new file mode 100644
index 0000000..b25bf87
--- /dev/null
+++ b/data/seo-result.json
@@ -0,0 +1,65 @@
+{
+ "tested": 50,
+ "regular": 25,
+ "sample": 25,
+ "flags": {
+ "no_canonical": 0,
+ "canonical_not_selfref": 0,
+ "no_product_schema": 0,
+ "SAMPLE_price_leak_in_schema": 25
+ },
+ "sample_price_examples": [
+ {
+ "url": "/products/dwhf-70172-sample-designer-wallcoverings-los-angeles",
+ "price": 4.25,
+ "avail": "InStock"
+ },
+ {
+ "url": "/products/dwhf-70189-sample-designer-wallcoverings-los-angeles",
+ "price": 4.25,
+ "avail": "InStock"
+ },
+ {
+ "url": "/products/dwhf-70081-sample-designer-wallcoverings-los-angeles",
+ "price": 4.25,
+ "avail": "InStock"
+ },
+ {
+ "url": "/products/dwhf-70251-sample-designer-wallcoverings-los-angeles",
+ "price": 4.25,
+ "avail": "InStock"
+ },
+ {
+ "url": "/products/dwhf-70286-sample-designer-wallcoverings-los-angeles",
+ "price": 4.25,
+ "avail": "InStock"
+ },
+ {
+ "url": "/products/dwhf-70253-sample-designer-wallcoverings-los-angeles",
+ "price": 4.25,
+ "avail": "InStock"
+ }
+ ],
+ "regular_ok_example": [
+ {
+ "url": "/products/feather-wallcovering-malibu-wallpaper-2",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/the-other-eden-wallpaper-bga-48132b",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ }
+ ]
+}
diff --git a/data/seo-sample.json b/data/seo-sample.json
new file mode 100644
index 0000000..ab6829a
--- /dev/null
+++ b/data/seo-sample.json
@@ -0,0 +1,502 @@
+[
+ {
+ "url": "/products/feather-wallcovering-malibu-wallpaper-2",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/the-other-eden-wallpaper-bga-48132b",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/essential-greek-key-metallic-terra-cotta-wallcovering-malibu-wallpaper",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/versace-791361-wallcovering-versace",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/stockholm-woven-fog-wallcovering-phillipe-romano",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/martinique-sea-green-and-white-wallcovering-malibu-wallpaper",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/dwtt-72037-designer-wallcoverings-los-angeles",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/amsterdam-step-up-mauve-quartz-wallcovering-phillipe-romano",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/coastal-hemp-ocean-blue-wallcovering-malibu-wallpaper",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/hydrangea-pistachio-stout-textiles",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 278.73,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/copenhagen-tensile-silk-river-haze-wallcovering-phillipe-romano",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/dwkk-128549",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 138.52,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/fabriola-textile-wallpaper-twb-73400",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/horse-trellis-acid-grey-wallpaper-bga-48084c",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/glambaca-hand-crafted-abaca-cloth-gpr-76500",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 238.73,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/dwkk-128464",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/carmela-true-blue-wallcovering-malibu-wallpaper",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/accord-quinoa-maharam",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/dwkk-128540",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/alphabet-pastel-wallcovering-malibu-wallpaper",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/tigressa-bargea-wallpaper-xb3-66522",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 37.2,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/natures-palette-recycled-paint-smooth-bedrock-ncr-107",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/jun-blanched-pine-wallcovering-malibu-wallpaper",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/ba206-placeholder-wallcovering-winfield-thybony",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 36.45,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/dwkk-129037",
+ "sample": false,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 165,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": false
+ },
+ {
+ "url": "/products/dwhf-70172-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70189-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70081-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70251-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70286-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70253-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70201-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70127-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70159-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70173-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70182-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70196-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70195-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70034-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70001-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70065-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70105-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70056-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70284-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70246-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70231-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70012-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70130-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70053-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ },
+ {
+ "url": "/products/dwhf-70161-sample-designer-wallcoverings-los-angeles",
+ "sample": true,
+ "canon_self": true,
+ "hasProduct": true,
+ "price": 4.25,
+ "avail": "InStock",
+ "cur": "USD",
+ "sampleLeak": true
+ }
+]
\ No newline at end of file
diff --git a/leak-rate.mjs b/leak-rate.mjs
new file mode 100644
index 0000000..eed2284
--- /dev/null
+++ b/leak-rate.mjs
@@ -0,0 +1,27 @@
+// TK-10661 — tighter measure: JSON-LD $4.25-in-offer rate across a larger REGULAR-product sample.
+const BASE='https://www.designerwallcoverings.com';
+const sleep=ms=>new Promise(r=>setTimeout(r,ms));
+async function get(u){for(let a=0;a<3;a++){try{const r=await fetch(u,{headers:{'User-Agent':'Mozilla/5.0 dw-audit'}});if(r.status>=500||r.status===429){await sleep(900*(a+1));continue;}return r;}catch(e){await sleep(700*(a+1));}}return null;}
+const idx=await (await get(`${BASE}/sitemap.xml`)).text();
+const subs=[...idx.matchAll(/<loc>([^<]*sitemap_products_[^<]*)<\/loc>/g)].map(m=>m[1].replace(/&/g,'&')).filter(u=>!/\/en-(ca|gb)\//.test(u));
+const pick=[]; const step=Math.max(1,Math.floor(subs.length/8)); for(let i=0;i<subs.length;i+=step) pick.push(subs[i]);
+let urls=[]; for(const s of pick){ const xml=await (await get(s)).text(); urls.push(...[...xml.matchAll(/<loc>([^<]*\/products\/[^<]+)<\/loc>/g)].map(m=>m[1])); }
+urls=[...new Set(urls)].filter(u=>!/-sample-|memo-sample/i.test(u)); // regular only
+for(let i=urls.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[urls[i],urls[j]]=[urls[j],urls[i]];}
+const set=urls.slice(0,120);
+let leak=0, real=0, noprod=0, err=0; const realEx=[];
+for(const u of set){ const r=await get(u); if(!r||r.status!==200){err++;continue;}
+ const html=await r.text();
+ const blocks=[...html.matchAll(/<script[^>]*application\/ld\+json[^>]*>([\s\S]*?)<\/script>/gi)].map(m=>m[1]);
+ let price=null,found=false;
+ for(const b of blocks){try{const j=JSON.parse(b.trim());const arr=Array.isArray(j)?j:(j['@graph']||[j]);
+ for(const n of arr){if(/product/i.test(n['@type']||'')){found=true;const o=Array.isArray(n.offers)?n.offers[0]:n.offers;if(o&&o.price!=null)price=Number(o.price);}}}catch{}}
+ if(!found){noprod++;continue;}
+ if(price!=null&&price<=5) leak++; else { real++; if(realEx.length<5)realEx.push({url:u.replace(BASE,''),price}); }
+ await sleep(70);
+}
+const n=leak+real;
+// Wilson 95% CI on leak rate
+const p=leak/n, z=1.96, denom=1+z*z/n, lo=(p+z*z/(2*n)-z*Math.sqrt((p*(1-p)+z*z/(4*n))/n))/denom, hi=(p+z*z/(2*n)+z*Math.sqrt((p*(1-p)+z*z/(4*n))/n))/denom;
+console.log(JSON.stringify({regular_tested:n, price_4_25_in_schema:leak, real_price:real, no_product_schema:noprod, fetch_err:err,
+ leak_rate:+p.toFixed(3), wilson95:[+lo.toFixed(3),+hi.toFixed(3)], real_price_examples:realEx},null,2));
diff --git a/seo-sampler.mjs b/seo-sampler.mjs
new file mode 100644
index 0000000..3e25162
--- /dev/null
+++ b/seo-sampler.mjs
@@ -0,0 +1,48 @@
+// TK-10661 — READ-ONLY product-page SEO sampler. Fetch a mix of regular + sample product
+// pages; extract canonical + JSON-LD Product offer (price/availability/currency). Flag:
+// - canonical missing or not self-referencing
+// - JSON-LD Product missing
+// - SAMPLE product advertising $4.25 as its schema offer price (leak in structured data)
+// - availability=InStock while price looks like a $4.25 sample
+const BASE='https://www.designerwallcoverings.com';
+const sleep=ms=>new Promise(r=>setTimeout(r,ms));
+async function get(u){for(let a=0;a<3;a++){try{const r=await fetch(u,{headers:{'User-Agent':'Mozilla/5.0 dw-audit'}});if(r.status>=500||r.status===429){await sleep(900*(a+1));continue;}return r;}catch(e){await sleep(700*(a+1));}}return null;}
+// gather product URLs from sitemap (default locale), split regular vs sample
+const idx=await (await get(`${BASE}/sitemap.xml`)).text();
+const subs=[...idx.matchAll(/<loc>([^<]*sitemap_products_[^<]*)<\/loc>/g)].map(m=>m[1].replace(/&/g,'&')).filter(u=>!/\/en-(ca|gb)\//.test(u));
+const pick=[subs[2],subs[20],subs[40],subs[60],subs[80]].filter(Boolean);
+let urls=[]; for(const s of pick){ const xml=await (await get(s)).text(); urls.push(...[...xml.matchAll(/<loc>([^<]*\/products\/[^<]+)<\/loc>/g)].map(m=>m[1])); }
+urls=[...new Set(urls)];
+const isSample=u=>/-sample-|memo-sample/i.test(u);
+const samples=urls.filter(isSample), regular=urls.filter(u=>!isSample(u));
+const shuf=a=>{for(let i=a.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[a[i],a[j]]=[a[j],a[i]];}return a;};
+const testSet=[...shuf(regular).slice(0,25), ...shuf(samples).slice(0,25)];
+function extract(html,url){
+ const canon=(html.match(/<link[^>]*rel="canonical"[^>]*>/i)||[''])[0].match(/href="([^"]+)"/i)?.[1]||null;
+ const blocks=[...html.matchAll(/<script[^>]*application\/ld\+json[^>]*>([\s\S]*?)<\/script>/gi)].map(m=>m[1]);
+ let product=null;
+ for(const b of blocks){ try{ const j=JSON.parse(b.trim());
+ const arr=Array.isArray(j)?j:(j['@graph']||[j]);
+ for(const n of arr){ if(n && /product/i.test(n['@type']||'')) product=n; } }catch{} }
+ const offer=product?.offers ? (Array.isArray(product.offers)?product.offers[0]:product.offers) : null;
+ return { canon, self:canon===url, hasProduct:!!product,
+ price: offer?.price ?? null, avail:(offer?.availability||'').replace('http://schema.org/','').replace('https://schema.org/',''),
+ cur: offer?.priceCurrency ?? null };
+}
+const rows=[]; let flagSampleLeak=0, flagNoCanon=0, flagNotSelf=0, flagNoProduct=0;
+for(const u of testSet){ const r=await get(u); if(!r||r.status!==200){ rows.push({url:u.replace(BASE,''),http:r?.status||0}); continue; }
+ const html=await r.text(); const e=extract(html,u); const samp=isSample(u);
+ const priceNum=e.price!=null?Number(e.price):null;
+ const sampleLeak = samp && priceNum!=null && priceNum<=5; // $4.25-ish advertised as offer
+ if(sampleLeak) flagSampleLeak++;
+ if(!e.canon) flagNoCanon++; else if(!e.self) flagNotSelf++;
+ if(!e.hasProduct) flagNoProduct++;
+ rows.push({url:u.replace(BASE,''),sample:samp,canon_self:e.self,hasProduct:e.hasProduct,price:e.price,avail:e.avail,cur:e.cur,sampleLeak});
+ await sleep(80);
+}
+const fs=await import('node:fs'); fs.writeFileSync('data/seo-sample.json',JSON.stringify(rows,null,2));
+const regRows=rows.filter(r=>r.sample===false&&r.http!==0), sampRows=rows.filter(r=>r.sample===true&&r.http!==0);
+console.log(JSON.stringify({tested:rows.length, regular:regRows.length, sample:sampRows.length,
+ flags:{no_canonical:flagNoCanon, canonical_not_selfref:flagNotSelf, no_product_schema:flagNoProduct, SAMPLE_price_leak_in_schema:flagSampleLeak},
+ sample_price_examples: sampRows.filter(r=>r.sampleLeak).slice(0,6).map(r=>({url:r.url,price:r.price,avail:r.avail})),
+ regular_ok_example: regRows.slice(0,2)},null,2));
(oldest)
·
back to Tk10661 Product Seo
·
TK-10661 Cody fixes: confirmed variants[0]-drives-offer mech 2eef0cf →