seo 0.17.7 → 0.17.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PRIVACY.md +12 -3
- package/README.md +2 -2
- package/TERMS.md +1 -1
- package/dist/cli.js +90 -89
- package/dist/cli.js.map +1 -1
- package/dist/{dist--XpKpLek.js → dist-DiyyBCYL.js} +106 -106
- package/dist/dist-DiyyBCYL.js.map +1 -0
- package/dist/{dist-CeZ3yzNP.js → dist-DzcRsuc4.js} +1 -1
- package/dist/{esm-D2vwEHEA.js → esm-BByR3SEY.js} +2 -2
- package/dist/{esm-D2vwEHEA.js.map → esm-BByR3SEY.js.map} +1 -1
- package/dist/index.d.ts +69 -42
- package/dist/index.js +900 -296
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +895 -297
- package/dist/mcp.js.map +1 -1
- package/package.json +3 -3
- package/skills/seo/SKILL.md +5 -5
- package/dist/dist--XpKpLek.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __seoCreateRequire } from 'node:module'; const require = __seoCreateRequire(import.meta.url);
|
|
2
|
-
import { n as version, t as load } from "./esm-
|
|
2
|
+
import { n as version, t as load } from "./esm-BByR3SEY.js";
|
|
3
3
|
import { SEO_PROVIDER_API_VERSION } from "./provider-sdk.js";
|
|
4
4
|
import crypto$1, { createHash, randomUUID, sign } from "node:crypto";
|
|
5
5
|
import { z } from "zod";
|
|
@@ -1727,7 +1727,7 @@ function bearerFetch(token) {
|
|
|
1727
1727
|
}
|
|
1728
1728
|
});
|
|
1729
1729
|
}
|
|
1730
|
-
async function failure(response, label, subject, options) {
|
|
1730
|
+
async function failure$1(response, label, subject, options) {
|
|
1731
1731
|
const detail = (await response.text().catch(() => "")).slice(0, 300);
|
|
1732
1732
|
const status = response.status;
|
|
1733
1733
|
const what = subject ? `${label} for ${subject}` : label;
|
|
@@ -1751,7 +1751,7 @@ async function googleJson(gfetch, url, input) {
|
|
|
1751
1751
|
body: input.body === void 0 ? void 0 : JSON.stringify(input.body),
|
|
1752
1752
|
signal
|
|
1753
1753
|
});
|
|
1754
|
-
if (!response.ok) throw await failure(response, input.label, input.subject, input);
|
|
1754
|
+
if (!response.ok) throw await failure$1(response, input.label, input.subject, input);
|
|
1755
1755
|
return readJson(response, input.label, { maxBytes: input.maxBytes });
|
|
1756
1756
|
});
|
|
1757
1757
|
}
|
|
@@ -1844,7 +1844,7 @@ async function runAnalyticsReport(gfetch, propertyId, body, options) {
|
|
|
1844
1844
|
}
|
|
1845
1845
|
// packages/core/src/bing/api.ts
|
|
1846
1846
|
const BASE = "https://ssl.bing.com/webmaster/api.svc/json";
|
|
1847
|
-
const MAX_BYTES$
|
|
1847
|
+
const MAX_BYTES$6 = 8e6;
|
|
1848
1848
|
function bingCall(auth, options) {
|
|
1849
1849
|
return async (method, params = {}) => {
|
|
1850
1850
|
const url = new URL(`${BASE}/${method}`);
|
|
@@ -1869,7 +1869,7 @@ function bingCall(auth, options) {
|
|
|
1869
1869
|
if (response.status === 429 || /throttle/i.test(detail)) throw new SeoError("RATE_LIMITED", "Bing Webmaster is limiting requests. Try again in a few minutes.");
|
|
1870
1870
|
throw new SeoError("OPTIONAL_PROVIDER_UNAVAILABLE", `Bing Webmaster answered ${response.status}. ${detail}`.trim());
|
|
1871
1871
|
}
|
|
1872
|
-
return (await readJson(response, "Bing Webmaster", { maxBytes: MAX_BYTES$
|
|
1872
|
+
return (await readJson(response, "Bing Webmaster", { maxBytes: MAX_BYTES$6 })).d;
|
|
1873
1873
|
};
|
|
1874
1874
|
}
|
|
1875
1875
|
function day$3(value) {
|
|
@@ -2572,6 +2572,7 @@ const ID_COLUMNS = [
|
|
|
2572
2572
|
"changeDate",
|
|
2573
2573
|
"query",
|
|
2574
2574
|
"queryFlags",
|
|
2575
|
+
"shape",
|
|
2575
2576
|
"keyword",
|
|
2576
2577
|
"url",
|
|
2577
2578
|
"page",
|
|
@@ -2864,6 +2865,7 @@ async function runSites(input) {
|
|
|
2864
2865
|
input.bing === void 0 ? null : bing === null ? "Bing Webmaster: not connected." : bing instanceof Error ? `Bing Webmaster: could not list sites. ${bing.message}` : bingOnly.length ? `Bing Webmaster sites with no Search Console property here (${bingOnly.length}): ${bingOnly.map((site) => site.url).join(", ")}.` : `Bing Webmaster: ${bingSites.length} verified sites; the bing column shows each one.`,
|
|
2865
2866
|
`Research keys: ${research.length ? research.join(", ") : "none"}.`,
|
|
2866
2867
|
input.clicky?.length ? `Clicky sites (seo_data with source "clicky"): ${input.clicky.join(", ")}.` : null,
|
|
2868
|
+
input.simpleAnalytics ? "Simple Analytics: API key saved; seo_data with source \"simple_analytics\" and the site's domain." : null,
|
|
2867
2869
|
`Add a Google account${input.bing === void 0 ? "" : ", Bing"} or a key: ${input.connect}`,
|
|
2868
2870
|
"Next: seo_report with a site."
|
|
2869
2871
|
].filter(Boolean).join("\n\n"),
|
|
@@ -2872,7 +2874,8 @@ async function runSites(input) {
|
|
|
2872
2874
|
googleAnalytics: analytics,
|
|
2873
2875
|
bing: Array.isArray(bing) ? bingSites : null,
|
|
2874
2876
|
research,
|
|
2875
|
-
clicky: input.clicky ?? []
|
|
2877
|
+
clicky: input.clicky ?? [],
|
|
2878
|
+
simpleAnalytics: Boolean(input.simpleAnalytics)
|
|
2876
2879
|
}
|
|
2877
2880
|
};
|
|
2878
2881
|
}
|
|
@@ -11338,10 +11341,251 @@ async function pageOpportunitiesReport(input, dependencies = defaultDependencies
|
|
|
11338
11341
|
recommendations: pageOpportunityRecommendations(analysis)
|
|
11339
11342
|
};
|
|
11340
11343
|
}
|
|
11344
|
+
// packages/core/src/analyze/ai-queries.ts
|
|
11345
|
+
const RULES = [
|
|
11346
|
+
["agent_prompt", "^(search the web for|browse the web|find sources)|do not invent|return the [0-9]+ most relevant|include source urls|context: location|do not include location|question: |reply only with|the model you are using"],
|
|
11347
|
+
["tracker", "\\. ?my location is |\\?\\. ?my( |$)|^evaluate the .+ on "],
|
|
11348
|
+
["reply", "^(yes|yeah|yep|ok|okay|sure|yes please|go on|continue|keep going|tell me more|why not|how so|really|exactly|show me|and then|thanks|thank you|got it|what else|anything else)[?!.,]*$"],
|
|
11349
|
+
["follow_up", "^(what|how) about .{1,40}$|^(and|so|ok so|okay so|but) (what|which|how|why) "],
|
|
11350
|
+
["operator", "(^|\\s)-?(site|before|after|intitle|inurl|intext|filetype):|\"[^\"]*\" or \""],
|
|
11351
|
+
["chat", "\\b(please|can you|could you|give me|show me|tell me|i want|i need|i have|i am|should i|do i need|is it worth|help me|walk me through)\\b|^(what|how|why|is|does|can|will|would) (it|that|this|they)\\b"],
|
|
11352
|
+
["long", "^(\\S+\\s+){9,}\\S+$"]
|
|
11353
|
+
];
|
|
11354
|
+
const AI_QUERY_KINDS = {
|
|
11355
|
+
agent_prompt: "text from an agent prompt, such as \"search the web for\"",
|
|
11356
|
+
tracker: "a visibility-tool probe, such as \"my location is\"",
|
|
11357
|
+
reply: "a bare reply, such as \"yes\" or \"tell me more\"",
|
|
11358
|
+
follow_up: "a follow-up, such as \"what about …\"",
|
|
11359
|
+
operator: "search operators, such as site:, before: or \"a\" or \"b\"",
|
|
11360
|
+
chat: "chat phrasing, such as \"can you\" or \"should i\"",
|
|
11361
|
+
long: "ten or more words with no other sign"
|
|
11362
|
+
};
|
|
11363
|
+
const MATCHERS = RULES.map(([kind, pattern]) => [kind, new RegExp(pattern)]);
|
|
11364
|
+
const AI_QUERY_PATTERN = RULES.map(([, pattern]) => `(?:${pattern})`).join("|");
|
|
11365
|
+
const NOISE = [
|
|
11366
|
+
["spaced_letters", /(^|\s)(\S\s){3,}\S(\s|$)/u],
|
|
11367
|
+
["broken_encoding", /^(яю|ÿþ|þÿ)|&#[0-9]+;?|&[a-z]+;|[âÃÂ][\u0080-\u00bf€™œ“”]|\ufffd/u],
|
|
11368
|
+
["pasted_text", /^(p [a-z]{3,} |here (are|is) (all )?the |here's the |done[,.!]? (you|here) |current state: )/u]
|
|
11369
|
+
];
|
|
11370
|
+
function aiQueryNoise(query) {
|
|
11371
|
+
const text = query.trim().toLowerCase();
|
|
11372
|
+
return NOISE.find(([, pattern]) => pattern.test(text))?.[0] ?? null;
|
|
11373
|
+
}
|
|
11374
|
+
const QUESTION = /^(how|what|what's|whats|which|why|when|where|who|is|are|can|could|does|do|should|would|will|i need|i want|i have|i'm looking|we need|we want)\b|\?$/u;
|
|
11375
|
+
const ASKABLE_KINDS = /* @__PURE__ */ new Set(["chat", "long"]);
|
|
11376
|
+
const PROMPT_CHARACTERS = 500;
|
|
11377
|
+
function askable(query, kind) {
|
|
11378
|
+
const text = query.trim().toLowerCase().replace(/^["'“]+/u, "");
|
|
11379
|
+
return Boolean(kind && ASKABLE_KINDS.has(kind)) && text.length <= PROMPT_CHARACTERS && QUESTION.test(text);
|
|
11380
|
+
}
|
|
11381
|
+
function aiQueryKind(query) {
|
|
11382
|
+
const text = query.trim().toLowerCase();
|
|
11383
|
+
return MATCHERS.find(([, pattern]) => pattern.test(text))?.[0] ?? null;
|
|
11384
|
+
}
|
|
11385
|
+
const STOP = new Set("the and for with that this what which who how why when where are is was can does do did you your our from about into than then them they their there have has had will would should could not but its it’s me my i am of to in on at by or an as be if so".split(" "));
|
|
11386
|
+
function words$3(query) {
|
|
11387
|
+
return new Set(query.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter((word) => word.length >= 3 && !STOP.has(word)).map((word) => word.length > 4 && word.endsWith("s") ? word.slice(0, -1) : word));
|
|
11388
|
+
}
|
|
11389
|
+
const SAME_QUESTION = .6;
|
|
11390
|
+
const MAX_ROWS = 25e3;
|
|
11391
|
+
const EXAMPLES = 3;
|
|
11392
|
+
const CANDIDATES = 200;
|
|
11393
|
+
const overlap = (a, b, weight) => {
|
|
11394
|
+
let shared = 0;
|
|
11395
|
+
let union = 0;
|
|
11396
|
+
for (const word of a) {
|
|
11397
|
+
union += weight(word);
|
|
11398
|
+
if (b.has(word)) shared += weight(word);
|
|
11399
|
+
}
|
|
11400
|
+
for (const word of b) if (!a.has(word)) union += weight(word);
|
|
11401
|
+
return union ? shared / union : 0;
|
|
11402
|
+
};
|
|
11403
|
+
const round$2 = (value, places) => Math.round(value * 10 ** places) / 10 ** places;
|
|
11404
|
+
async function aiQueriesReport(input, searchAnalytics) {
|
|
11405
|
+
const range = {
|
|
11406
|
+
startDate: input.startDate,
|
|
11407
|
+
endDate: input.endDate
|
|
11408
|
+
};
|
|
11409
|
+
const [matched, site] = await Promise.all([searchAnalytics(input.site, {
|
|
11410
|
+
...range,
|
|
11411
|
+
dimensions: ["query", "page"],
|
|
11412
|
+
type: "web",
|
|
11413
|
+
dataState: "final",
|
|
11414
|
+
maxRows: MAX_ROWS,
|
|
11415
|
+
dimensionFilterGroups: [{ filters: [{
|
|
11416
|
+
dimension: "query",
|
|
11417
|
+
operator: "includingRegex",
|
|
11418
|
+
expression: AI_QUERY_PATTERN
|
|
11419
|
+
}] }]
|
|
11420
|
+
}), searchAnalytics(input.site, {
|
|
11421
|
+
...range,
|
|
11422
|
+
dimensions: [],
|
|
11423
|
+
type: "web",
|
|
11424
|
+
dataState: "final"
|
|
11425
|
+
})]);
|
|
11426
|
+
const rows = [...matched.rows].sort((a, b) => b.impressions - a.impressions || String(a.keys[0]).localeCompare(String(b.keys[0])) || String(a.keys[1]).localeCompare(String(b.keys[1])));
|
|
11427
|
+
const usage = /* @__PURE__ */ new Map();
|
|
11428
|
+
const unique = new Set(rows.map((row) => String(row.keys[0] ?? "")));
|
|
11429
|
+
for (const query of unique) for (const word of words$3(query)) usage.set(word, (usage.get(word) ?? 0) + 1);
|
|
11430
|
+
const weight = (word) => Math.log((unique.size + 1) / (usage.get(word) ?? 1));
|
|
11431
|
+
const groups = [];
|
|
11432
|
+
const byWord = /* @__PURE__ */ new Map();
|
|
11433
|
+
const byText = /* @__PURE__ */ new Map();
|
|
11434
|
+
const kindOf = /* @__PURE__ */ new Map();
|
|
11435
|
+
const noise = /* @__PURE__ */ new Map();
|
|
11436
|
+
for (const row of rows) {
|
|
11437
|
+
const query = String(row.keys[0] ?? "");
|
|
11438
|
+
const page = String(row.keys[1] ?? "");
|
|
11439
|
+
const kind = aiQueryKind(query);
|
|
11440
|
+
if (!kind) continue;
|
|
11441
|
+
const junk = aiQueryNoise(query);
|
|
11442
|
+
if (junk) {
|
|
11443
|
+
const seen = noise.get(junk) ?? /* @__PURE__ */ new Set();
|
|
11444
|
+
seen.add(query.trim().toLowerCase());
|
|
11445
|
+
noise.set(junk, seen);
|
|
11446
|
+
continue;
|
|
11447
|
+
}
|
|
11448
|
+
const text = query.trim().toLowerCase();
|
|
11449
|
+
const own = words$3(query);
|
|
11450
|
+
let group = byText.get(text);
|
|
11451
|
+
if (!group) {
|
|
11452
|
+
let checked = 0;
|
|
11453
|
+
for (const word of own) {
|
|
11454
|
+
for (const candidate of byWord.get(word) ?? []) {
|
|
11455
|
+
if (++checked > CANDIDATES) break;
|
|
11456
|
+
if (overlap(own, candidate.words, weight) >= SAME_QUESTION) {
|
|
11457
|
+
group = candidate;
|
|
11458
|
+
break;
|
|
11459
|
+
}
|
|
11460
|
+
}
|
|
11461
|
+
if (group || checked > CANDIDATES) break;
|
|
11462
|
+
}
|
|
11463
|
+
}
|
|
11464
|
+
if (!group) {
|
|
11465
|
+
group = {
|
|
11466
|
+
words: own,
|
|
11467
|
+
queries: /* @__PURE__ */ new Map(),
|
|
11468
|
+
pages: /* @__PURE__ */ new Map(),
|
|
11469
|
+
kinds: /* @__PURE__ */ new Map(),
|
|
11470
|
+
clicks: 0,
|
|
11471
|
+
impressions: 0,
|
|
11472
|
+
positionWeight: 0
|
|
11473
|
+
};
|
|
11474
|
+
groups.push(group);
|
|
11475
|
+
for (const word of own) {
|
|
11476
|
+
const list = byWord.get(word) ?? [];
|
|
11477
|
+
list.push(group);
|
|
11478
|
+
byWord.set(word, list);
|
|
11479
|
+
}
|
|
11480
|
+
}
|
|
11481
|
+
byText.set(text, group);
|
|
11482
|
+
if (!kindOf.has(text)) {
|
|
11483
|
+
kindOf.set(text, kind);
|
|
11484
|
+
group.kinds.set(kind, (group.kinds.get(kind) ?? 0) + 1);
|
|
11485
|
+
}
|
|
11486
|
+
group.queries.set(query, (group.queries.get(query) ?? 0) + row.impressions);
|
|
11487
|
+
group.pages.set(page, (group.pages.get(page) ?? 0) + row.impressions);
|
|
11488
|
+
group.clicks += row.clicks;
|
|
11489
|
+
group.impressions += row.impressions;
|
|
11490
|
+
group.positionWeight += row.position * row.impressions;
|
|
11491
|
+
}
|
|
11492
|
+
const byKind = /* @__PURE__ */ new Map();
|
|
11493
|
+
for (const kind of kindOf.values()) {
|
|
11494
|
+
const entry = byKind.get(kind) ?? {
|
|
11495
|
+
queries: 0,
|
|
11496
|
+
impressions: 0
|
|
11497
|
+
};
|
|
11498
|
+
entry.queries += 1;
|
|
11499
|
+
byKind.set(kind, entry);
|
|
11500
|
+
}
|
|
11501
|
+
for (const row of rows) {
|
|
11502
|
+
const kind = kindOf.get(String(row.keys[0] ?? "").trim().toLowerCase());
|
|
11503
|
+
const entry = kind && byKind.get(kind);
|
|
11504
|
+
if (entry) entry.impressions += row.impressions;
|
|
11505
|
+
}
|
|
11506
|
+
const queries = kindOf.size;
|
|
11507
|
+
const impressions = groups.reduce((sum, g) => sum + g.impressions, 0);
|
|
11508
|
+
const clicks = groups.reduce((sum, g) => sum + g.clicks, 0);
|
|
11509
|
+
const total = site.rows[0] ?? {
|
|
11510
|
+
clicks: 0,
|
|
11511
|
+
impressions: 0
|
|
11512
|
+
};
|
|
11513
|
+
const items = groups.map((group) => {
|
|
11514
|
+
const most = (map) => [...map].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([name]) => name);
|
|
11515
|
+
const [first, ...rest] = most(group.queries);
|
|
11516
|
+
const kind = [...group.kinds].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))[0]?.[0];
|
|
11517
|
+
return {
|
|
11518
|
+
query: first ?? "",
|
|
11519
|
+
page: most(group.pages)[0] ?? "",
|
|
11520
|
+
askable: askable(first ?? "", kind),
|
|
11521
|
+
pages: group.pages.size,
|
|
11522
|
+
kind,
|
|
11523
|
+
wordings: group.queries.size,
|
|
11524
|
+
impressions: group.impressions,
|
|
11525
|
+
clicks: group.clicks,
|
|
11526
|
+
ctr: group.impressions ? round$2(group.clicks / group.impressions, 4) : 0,
|
|
11527
|
+
position: group.impressions ? round$2(group.positionWeight / group.impressions, 1) : 0,
|
|
11528
|
+
otherWordings: rest.slice(0, EXAMPLES)
|
|
11529
|
+
};
|
|
11530
|
+
}).sort((a, b) => b.impressions - a.impressions || b.wordings - a.wordings || a.query.localeCompare(b.query) || a.page.localeCompare(b.page));
|
|
11531
|
+
const pct = (part, whole) => whole ? round$2(part / whole * 100, 1) : null;
|
|
11532
|
+
const kinds = [...byKind].sort((a, b) => b[1].impressions - a[1].impressions || a[0].localeCompare(b[0])).map(([kind, entry]) => `${kind} ${entry.queries}`).join(", ");
|
|
11533
|
+
const leftOut = [...noise].sort((a, b) => a[0].localeCompare(b[0])).map(([reason, seen]) => `${reason.replace("_", " ")} ${seen.size}`).join(", ");
|
|
11534
|
+
const asked = items.filter((item) => item.askable).length;
|
|
11535
|
+
const capped = matched.rowsFetched >= MAX_ROWS;
|
|
11536
|
+
return {
|
|
11537
|
+
range,
|
|
11538
|
+
verdict: queries ? `${queries} queries in ${groups.length} questions have the shape of AI conversations or agent searches.` : "No queries with the shape of AI conversations or agent searches.",
|
|
11539
|
+
summary: {
|
|
11540
|
+
queries,
|
|
11541
|
+
questions: groups.length,
|
|
11542
|
+
askable: asked,
|
|
11543
|
+
leftOut: leftOut || "none",
|
|
11544
|
+
impressions,
|
|
11545
|
+
clicks,
|
|
11546
|
+
shareOfImpressionsPct: pct(impressions, total.impressions),
|
|
11547
|
+
byKind: kinds || "none",
|
|
11548
|
+
ctr: impressions ? round$2(clicks / impressions, 4) : 0,
|
|
11549
|
+
siteCtr: total.impressions ? round$2(total.clicks / total.impressions, 4) : 0
|
|
11550
|
+
},
|
|
11551
|
+
kinds: AI_QUERY_KINDS,
|
|
11552
|
+
items,
|
|
11553
|
+
caveats: [
|
|
11554
|
+
"A heuristic: these queries match the patterns of AI conversations and agent searches. Search Console does not mark AI Mode or AI Overviews, and people type some of these too.",
|
|
11555
|
+
"A minimum: Search Console leaves out rare queries, and these are rare by nature.",
|
|
11556
|
+
"Rewordings of one question are grouped by their shared words; page is the page with the most impressions for it.",
|
|
11557
|
+
"Left out and counted, not shown: letters split by spaces, text broken by a wrong encoding, and text pasted from a tool or an agent’s output.",
|
|
11558
|
+
"askable: a chat or long question that opens with a question word or a request such as \"i need\", or ends with a question mark, so an AI engine can be asked it as it is. ai_answers checks the top askable questions only.",
|
|
11559
|
+
"Search Console’s Generative AI report is not in its API, so it is not here.",
|
|
11560
|
+
...capped ? [`Capped at the first ${MAX_ROWS} matching query and page rows.`] : []
|
|
11561
|
+
]
|
|
11562
|
+
};
|
|
11563
|
+
}
|
|
11564
|
+
// packages/core/src/analyze/query-shape.ts
|
|
11565
|
+
const COMPARISON = /\b(vs|versus|alternative|alternatives|compare|comparison|best)\b/;
|
|
11566
|
+
function queryShape(query) {
|
|
11567
|
+
const text = query.trim().toLowerCase();
|
|
11568
|
+
if (COMPARISON.test(text)) return "comparison";
|
|
11569
|
+
const kind = aiQueryKind(text);
|
|
11570
|
+
if (kind && kind !== "chat" && kind !== "long") return kind;
|
|
11571
|
+
if (QUESTION.test(text)) return "question";
|
|
11572
|
+
return kind;
|
|
11573
|
+
}
|
|
11574
|
+
function queryShapeLine(queries) {
|
|
11575
|
+
const counts = /* @__PURE__ */ new Map();
|
|
11576
|
+
for (const query of queries) {
|
|
11577
|
+
const shape = queryShape(query);
|
|
11578
|
+
if (shape) counts.set(shape, (counts.get(shape) ?? 0) + 1);
|
|
11579
|
+
}
|
|
11580
|
+
if (!counts.size) return null;
|
|
11581
|
+
const shaped = [...counts.values()].reduce((sum, n) => sum + n, 0);
|
|
11582
|
+
const parts = [...counts].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([shape, n]) => `${shape} ${n}`);
|
|
11583
|
+
return `Query shapes, ${shaped} of ${queries.length} queries: ${parts.join(", ")}.`;
|
|
11584
|
+
}
|
|
11341
11585
|
// packages/core/src/analyze/content-optimization.ts
|
|
11342
11586
|
function intentFor(query) {
|
|
11343
11587
|
const value = query.toLowerCase();
|
|
11344
|
-
if (
|
|
11588
|
+
if (COMPARISON.test(value)) return "comparison";
|
|
11345
11589
|
if (/\b(price|pricing|cost|buy|deal|coupon|review|reviews)\b/.test(value)) return "commercial";
|
|
11346
11590
|
if (/\b(how|steps|guide|tutorial|setup|fix|create|make)\b/.test(value)) return "how-to";
|
|
11347
11591
|
if (/\b(what is|meaning|definition|explained|why)\b/.test(value)) return "definition";
|
|
@@ -16960,7 +17204,8 @@ const PROVIDER_SECRET_NAMES = {
|
|
|
16960
17204
|
bingApiKey: "bing-api-key",
|
|
16961
17205
|
clickySiteKeys: "clicky-sitekeys",
|
|
16962
17206
|
dataForSeoCredentials: "dataforseo-credentials",
|
|
16963
|
-
providerExtensionCredentials: "provider-extension-credentials"
|
|
17207
|
+
providerExtensionCredentials: "provider-extension-credentials",
|
|
17208
|
+
simpleAnalyticsKey: "simple-analytics-key"
|
|
16964
17209
|
};
|
|
16965
17210
|
const REMOVED_PROVIDER_SECRET_NAMES = [
|
|
16966
17211
|
"indexnow-keys",
|
|
@@ -17648,7 +17893,7 @@ async function loadInstalledProviderExtensions(options = {}) {
|
|
|
17648
17893
|
const DEFAULT_MAX_REQUESTS = 8;
|
|
17649
17894
|
const MAX_RESPONSE_BYTES$1 = 10485760;
|
|
17650
17895
|
const MAX_REQUEST_BODY_BYTES = 65536;
|
|
17651
|
-
const TIMEOUT_MS$
|
|
17896
|
+
const TIMEOUT_MS$4 = 15e3;
|
|
17652
17897
|
function normalizeProviderExtensionAccount(provider, account) {
|
|
17653
17898
|
const fields = provider.connection.fields.filter((field) => field.kind === "account");
|
|
17654
17899
|
const allowed = new Set(fields.map((field) => field.id));
|
|
@@ -17695,7 +17940,7 @@ function runtimeForProvider(provider, options = {}) {
|
|
|
17695
17940
|
},
|
|
17696
17941
|
fetch: providerFetch,
|
|
17697
17942
|
maxResponseBytes: MAX_RESPONSE_BYTES$1,
|
|
17698
|
-
timeoutMs: TIMEOUT_MS$
|
|
17943
|
+
timeoutMs: TIMEOUT_MS$4,
|
|
17699
17944
|
retry: (input.method ?? "GET") === "GET" ? "safe" : "never",
|
|
17700
17945
|
schema: z.unknown()
|
|
17701
17946
|
});
|
|
@@ -19259,7 +19504,7 @@ const NAVIGATIONAL_STEM_THRESHOLDS = {
|
|
|
19259
19504
|
function compact(value) {
|
|
19260
19505
|
return normalizeBrandText(value).replace(/\s+/g, "");
|
|
19261
19506
|
}
|
|
19262
|
-
function round$
|
|
19507
|
+
function round$1(value, digits) {
|
|
19263
19508
|
return Number(value.toFixed(digits));
|
|
19264
19509
|
}
|
|
19265
19510
|
function stemQueryEvidence(rows, stem) {
|
|
@@ -19286,8 +19531,8 @@ function stemQueryEvidence(rows, stem) {
|
|
|
19286
19531
|
query,
|
|
19287
19532
|
clicks,
|
|
19288
19533
|
impressions,
|
|
19289
|
-
ctr: round$
|
|
19290
|
-
position: round$
|
|
19534
|
+
ctr: round$1(clicks / impressions, 4),
|
|
19535
|
+
position: round$1(weightedPosition / impressions, 2),
|
|
19291
19536
|
sourceRows
|
|
19292
19537
|
};
|
|
19293
19538
|
}
|
|
@@ -25077,7 +25322,7 @@ const GENERIC_ANCHORS = /^(click here|here|read more|learn more|more|this|this p
|
|
|
25077
25322
|
function normalise$1(value) {
|
|
25078
25323
|
return value.normalize("NFKD").replace(/\p{Diacritic}/gu, "").normalize("NFC").replace(/([\p{L}\p{N}])[’'`]([\p{L}\p{N}])/gu, "$1$2").toLowerCase().replace(/&/g, " and ").replace(/[^\p{L}\p{N}]+/gu, " ").replace(/\s+/g, " ").trim();
|
|
25079
25324
|
}
|
|
25080
|
-
const words$
|
|
25325
|
+
const words$2 = (value) => normalise$1(value).split(" ").filter(Boolean);
|
|
25081
25326
|
const FUNCTION_WORDS = new Set("a an and are as at be but by for from has have how if in into is it its of on or that the their then there these they this to was we were what when where which who why will with you your our can do does not just more most also than too very about after before over under again all any each other some such no nor only own same so up out off one two both every few several many much should would could because while since although though until unless whether however".split(" "));
|
|
25082
25327
|
const NOT_PLURAL = /* @__PURE__ */ new Set([
|
|
25083
25328
|
"always",
|
|
@@ -25138,7 +25383,7 @@ function stem(word) {
|
|
|
25138
25383
|
if (one.length > 6 && one.endsWith("ing")) return one.slice(0, -3);
|
|
25139
25384
|
return one;
|
|
25140
25385
|
}
|
|
25141
|
-
const terms = (text) => words$
|
|
25386
|
+
const terms = (text) => words$2(text).filter((word) => word.length > 1 && !FUNCTION_WORDS.has(word) && !/^\d+$/.test(word)).map(stem);
|
|
25142
25387
|
const slugWords = (url) => {
|
|
25143
25388
|
try {
|
|
25144
25389
|
return new URL(url).pathname.split(/[/._-]+/).filter(Boolean).join(" ");
|
|
@@ -25425,7 +25670,7 @@ function placementPage(input) {
|
|
|
25425
25670
|
};
|
|
25426
25671
|
}
|
|
25427
25672
|
// packages/core/src/analyze/internal-links-report.ts
|
|
25428
|
-
const DAY$
|
|
25673
|
+
const DAY$2 = 864e5;
|
|
25429
25674
|
const ISO_DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
25430
25675
|
function internalLinksReportRange(input, fallbackDays, now) {
|
|
25431
25676
|
if (!input.startDate && !input.endDate) return {
|
|
@@ -25437,7 +25682,7 @@ function internalLinksReportRange(input, fallbackDays, now) {
|
|
|
25437
25682
|
return {
|
|
25438
25683
|
startDate,
|
|
25439
25684
|
endDate,
|
|
25440
|
-
days: Math.round((Date.parse(`${endDate}T00:00:00Z`) - Date.parse(`${startDate}T00:00:00Z`)) / DAY$
|
|
25685
|
+
days: Math.round((Date.parse(`${endDate}T00:00:00Z`) - Date.parse(`${startDate}T00:00:00Z`)) / DAY$2) + 1
|
|
25441
25686
|
};
|
|
25442
25687
|
}
|
|
25443
25688
|
const plural$6 = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
@@ -25472,7 +25717,7 @@ function siteStartUrl(site) {
|
|
|
25472
25717
|
if (value.startsWith("sc-domain:")) return `https://${value.slice(10)}/`;
|
|
25473
25718
|
return `${new URL(/^https?:\/\//i.test(value) ? value : `https://${value}`).origin}/`;
|
|
25474
25719
|
}
|
|
25475
|
-
function round
|
|
25720
|
+
function round(value, places = 3) {
|
|
25476
25721
|
const factor = 10 ** places;
|
|
25477
25722
|
return Math.round(value * factor) / factor;
|
|
25478
25723
|
}
|
|
@@ -25828,7 +26073,7 @@ async function analyse(input, deps, crawl, context) {
|
|
|
25828
26073
|
sentence: decision.sentence?.text ?? null,
|
|
25829
26074
|
section: decision.sentence?.section || null,
|
|
25830
26075
|
sentenceMatch: decision.sentence?.match ?? null,
|
|
25831
|
-
similarity: round
|
|
26076
|
+
similarity: round(candidate.similarity),
|
|
25832
26077
|
sharedQueries: candidate.sharedQueries,
|
|
25833
26078
|
targetInboundLinks: inbound[candidate.target] ?? 0,
|
|
25834
26079
|
sourceType: types[candidate.source] ?? null,
|
|
@@ -30154,7 +30399,7 @@ async function detectBrandTerms(input) {
|
|
|
30154
30399
|
}
|
|
30155
30400
|
// packages/core/src/clicky/api.ts
|
|
30156
30401
|
const ENDPOINT$1 = "https://api.clicky.com/api/stats/4";
|
|
30157
|
-
const MAX_BYTES$
|
|
30402
|
+
const MAX_BYTES$5 = 5e6;
|
|
30158
30403
|
var ClickyError = class extends Error {
|
|
30159
30404
|
code;
|
|
30160
30405
|
constructor(code, message) {
|
|
@@ -30181,7 +30426,7 @@ async function clickyStats(site, types, options = {}) {
|
|
|
30181
30426
|
throw new ClickyError("remote", "Could not reach Clicky. Try again.");
|
|
30182
30427
|
});
|
|
30183
30428
|
if (!response.ok) throw new ClickyError("remote", `Clicky returned ${response.status}.`);
|
|
30184
|
-
const groups = await readJson(response, "Clicky", { maxBytes: MAX_BYTES$
|
|
30429
|
+
const groups = await readJson(response, "Clicky", { maxBytes: MAX_BYTES$5 });
|
|
30185
30430
|
if (!Array.isArray(groups)) throw new ClickyError("remote", "Clicky returned invalid data.");
|
|
30186
30431
|
const failed = groups.find((group) => typeof group?.error === "string");
|
|
30187
30432
|
if (failed?.error) throw /sitekey|site id|authenticat|permission/iu.test(failed.error) ? new ClickyError("auth", `Clicky rejected site ID ${site.siteId} or its sitekey.`) : new ClickyError("remote", `Clicky: ${failed.error.slice(0, 200)}`);
|
|
@@ -31208,7 +31453,7 @@ function push(result, text, from, to) {
|
|
|
31208
31453
|
text: text.slice(start, end)
|
|
31209
31454
|
});
|
|
31210
31455
|
}
|
|
31211
|
-
function words$
|
|
31456
|
+
function words$1(text) {
|
|
31212
31457
|
return text.match(/[A-Za-z0-9][A-Za-z0-9'\u2019-]*/g) ?? [];
|
|
31213
31458
|
}
|
|
31214
31459
|
const FINITE = new Set(`am is are was were be been being has have had do does did can could will would shall should may might must
|
|
@@ -31225,7 +31470,7 @@ const FINITE = new Set(`am is are was were be been being has have had do does di
|
|
|
31225
31470
|
happen happens happened leave leaves left bring brings brought live lives lived set sets love loves loved
|
|
31226
31471
|
like likes liked hate hates`.split(/\s+/));
|
|
31227
31472
|
function verbless(sentence) {
|
|
31228
|
-
for (const raw of words$
|
|
31473
|
+
for (const raw of words$1(sentence)) {
|
|
31229
31474
|
const word = raw.toLowerCase().replace(/\u2019/g, "'");
|
|
31230
31475
|
if (FINITE.has(word)) return false;
|
|
31231
31476
|
if (/(?:n't|'s|'re|'ve|'ll|'d|'m)$/.test(word)) return false;
|
|
@@ -31317,7 +31562,7 @@ var Context = class {
|
|
|
31317
31562
|
let total = 0;
|
|
31318
31563
|
let prose = 0;
|
|
31319
31564
|
for (const block of doc.blocks) {
|
|
31320
|
-
const count = words$
|
|
31565
|
+
const count = words$1(block.text).length;
|
|
31321
31566
|
total += count;
|
|
31322
31567
|
if (PROSE.includes(block.kind)) prose += count;
|
|
31323
31568
|
}
|
|
@@ -32292,7 +32537,7 @@ function heroLength(ctx) {
|
|
|
32292
32537
|
if (ctx.level(rule) === "off") return;
|
|
32293
32538
|
for (const block of ctx.blocks(["heading"])) {
|
|
32294
32539
|
if (block.level !== 1) continue;
|
|
32295
|
-
const count = words$
|
|
32540
|
+
const count = words$1(block.text).length;
|
|
32296
32541
|
if (count <= 12 && block.text.length <= 70) continue;
|
|
32297
32542
|
ctx.hit(rule, block, 0, block.text.length, `The H1 is ${count} words. A headline that long is hard to take in at a glance.`, "Keep the main promise in the H1 and move the rest to the line below it.");
|
|
32298
32543
|
}
|
|
@@ -32317,7 +32562,7 @@ function reviews(ctx) {
|
|
|
32317
32562
|
PROOF.lastIndex = 0;
|
|
32318
32563
|
for (const found of block.norm.matchAll(PROOF)) ctx.review("proof", block, found.index ?? 0, (found.index ?? 0) + found[0].length, `Is there a source for "${found[0]}" on the page? Link it or say where the number comes from.`);
|
|
32319
32564
|
}
|
|
32320
|
-
if (block.kind === "paragraph" && block.endsSection && sentences.length === 1 && words$
|
|
32565
|
+
if (block.kind === "paragraph" && block.endsSection && sentences.length === 1 && words$1(block.text).length <= 10 && words$1(block.text).filter((word) => /[a-z]/i.test(word)).length >= 3 && /[.!?]["')]?$/.test(block.text)) ctx.review("mic-drop", block, 0, block.text.length, "Does this closing line add a fact? If it only restates the paragraph above, cut it.");
|
|
32321
32566
|
}
|
|
32322
32567
|
if (ctx.preset === "landing" || ctx.preset === "meta") for (const block of ctx.blocks([
|
|
32323
32568
|
"title",
|
|
@@ -32326,7 +32571,7 @@ function reviews(ctx) {
|
|
|
32326
32571
|
])) {
|
|
32327
32572
|
if (block.kind === "heading" && block.level !== 1) continue;
|
|
32328
32573
|
if (!block.text) continue;
|
|
32329
|
-
const later = words$
|
|
32574
|
+
const later = words$1(block.text).slice(1);
|
|
32330
32575
|
if (/\d/.test(block.text) || later.some((word) => /^[A-Z]/.test(word))) continue;
|
|
32331
32576
|
ctx.review("swap-test", block, 0, block.text.length, "Would this line work unchanged on a competitor's page? If so, add the product, number or result only you can claim.");
|
|
32332
32577
|
}
|
|
@@ -32486,7 +32731,7 @@ function negativeParallelism(ctx) {
|
|
|
32486
32731
|
const sentence = sentenceAt(sentences, start);
|
|
32487
32732
|
const subject = block.norm.slice(sentence.start, start).trim();
|
|
32488
32733
|
const pronoun = /^(?:but |and |so )?(?:it|this|that|they)?$/i.test(subject.replace(/(?:'s|'re)$/, ""));
|
|
32489
|
-
const firstWords = words$
|
|
32734
|
+
const firstWords = words$1(block.norm.slice(sentence.start, end)).length;
|
|
32490
32735
|
let level = "warning";
|
|
32491
32736
|
if (kind === "reveal" || kind === "about" || kind === "repeated") level = "error";
|
|
32492
32737
|
else if (FRAMING.test(subject)) level = "error";
|
|
@@ -32540,7 +32785,7 @@ function contrastReframe(ctx) {
|
|
|
32540
32785
|
for (const block of ctx.blocks([...SENTENCE_KINDS, "heading"])) for (const sentence of ctx.sentences(block)) {
|
|
32541
32786
|
const text = sentence.text;
|
|
32542
32787
|
const just = NOT_JUST.exec(text);
|
|
32543
|
-
if (just && (just[0].startsWith(",") || words$
|
|
32788
|
+
if (just && (just[0].startsWith(",") || words$1(text).length <= 16) && !insideQuotes(block.norm, sentence.start + just.index, sentence.start + just.index + just[0].length)) {
|
|
32544
32789
|
ctx.hit(rule, block, sentence.start, sentence.end, "A \"not just X\" contrast inflates the claim instead of stating it.", "Say what it is or does in one plain clause, and drop the \"not just\" half.");
|
|
32545
32790
|
continue;
|
|
32546
32791
|
}
|
|
@@ -32553,8 +32798,8 @@ function contrastReframe(ctx) {
|
|
|
32553
32798
|
const right = rightAll.split(/[,;:.!?(]/)[0] ?? "";
|
|
32554
32799
|
if (!rather && SKIP_AFTER_NOT.test(right)) continue;
|
|
32555
32800
|
if (/\bor$/i.test(left.trim()) || /\bwhether\b/i.test(left)) continue;
|
|
32556
|
-
const leftWords = words$
|
|
32557
|
-
const rightWords = words$
|
|
32801
|
+
const leftWords = words$1(left);
|
|
32802
|
+
const rightWords = words$1(right);
|
|
32558
32803
|
if (leftWords.length < 3 || !rightWords.length) continue;
|
|
32559
32804
|
if (leftWords.length + rightWords.length <= 5 && verbless(text)) continue;
|
|
32560
32805
|
const lastLeft = leftWords[leftWords.length - 1];
|
|
@@ -32652,12 +32897,12 @@ const ABSTRACT_TRIAD = /\b[a-z]+(?:tion|sion|ity|ness|ment|ence|ance|ism), (?:an
|
|
|
32652
32897
|
const ECHO = new Set("to our your their my his her its every each more less no it they we you".split(" "));
|
|
32653
32898
|
const COPULA = /\b(?:is|are|was|were|'s|feels?|felt|looks?|stays?|remains?|seems?)\s+$/i;
|
|
32654
32899
|
function formulaTriad(items, before) {
|
|
32655
|
-
const firsts = items.map((item) => words$
|
|
32900
|
+
const firsts = items.map((item) => words$1(item)[0]?.toLowerCase() ?? "");
|
|
32656
32901
|
const echo = firsts[0] ?? "";
|
|
32657
32902
|
if (ECHO.has(echo) && firsts.every((first) => first === echo)) return `Each item opens with "${echo}".`;
|
|
32658
|
-
if (items.every((item) => /^(?:the|their|our|your|its|it|they|we|you|he|she)\b/i.test(item) && words$
|
|
32659
|
-
if (items.every((item) => /^[a-z]/.test(item) && words$
|
|
32660
|
-
if (items.every((item) => /^\w+ed\b/i.test(item) && words$
|
|
32903
|
+
if (items.every((item) => /^(?:the|their|our|your|its|it|they|we|you|he|she)\b/i.test(item) && words$1(item).length >= 3 && words$1(item).length <= 7 && !verbless(item))) return "Three parallel clauses in a row.";
|
|
32904
|
+
if (items.every((item) => /^[a-z]/.test(item) && words$1(item).length <= 2 && !PREPOSITIONS.has(words$1(item)[0] ?? "")) && COPULA.test(before)) return "A string of adjectives after \"is\".";
|
|
32905
|
+
if (items.every((item) => /^\w+ed\b/i.test(item) && words$1(item).length <= 3)) return "A string of past participles.";
|
|
32661
32906
|
return null;
|
|
32662
32907
|
}
|
|
32663
32908
|
function triads(ctx) {
|
|
@@ -32685,13 +32930,13 @@ function triads(ctx) {
|
|
|
32685
32930
|
const items = [...raw];
|
|
32686
32931
|
const head = raw[0] ?? "";
|
|
32687
32932
|
const lead = /^.*\b(?:is|are|was|were|'s|feels?|looks?|stays?|remains?|seems?|of|for|to|with|by|from|on|in|like|including|as)\s+/i.exec(head);
|
|
32688
|
-
if (lead && words$
|
|
32933
|
+
if (lead && words$1(head.slice(lead[0].length)).length) {
|
|
32689
32934
|
items[0] = head.slice(lead[0].length);
|
|
32690
32935
|
from += lead[0].length;
|
|
32691
32936
|
}
|
|
32692
32937
|
const end = sentence.start + (match.index ?? 0) + match[0].length;
|
|
32693
32938
|
const before = block.norm.slice(sentence.start, sentence.start + from);
|
|
32694
|
-
const echo = words$
|
|
32939
|
+
const echo = words$1(raw[1] ?? "")[0]?.toLowerCase() ?? "";
|
|
32695
32940
|
const inFirst = new RegExp(`\\b${echo}\\b(?!.*\\b${echo}\\b)`, "i").exec(head);
|
|
32696
32941
|
if (ECHO.has(echo) && inFirst && inFirst.index > 0) {
|
|
32697
32942
|
items[0] = head.slice(inFirst.index);
|
|
@@ -32742,7 +32987,7 @@ function colonDensity(ctx) {
|
|
|
32742
32987
|
const after = block.norm.slice(at + match[0].length);
|
|
32743
32988
|
if (/^["'(]/.test(after)) continue;
|
|
32744
32989
|
const lead = block.norm.slice(sentenceAt(sentences, at).start, at);
|
|
32745
|
-
if (words$
|
|
32990
|
+
if (words$1(lead).length <= 4 && verbless(lead)) continue;
|
|
32746
32991
|
const source = block.map[at] ?? -1;
|
|
32747
32992
|
if (/^(?:\*\*|__)/.test(ctx.doc.source.slice(source + 1, source + 3)) || /(?:\*\*|__)$/.test(ctx.doc.source.slice(source - 2, source))) continue;
|
|
32748
32993
|
if (block.links.some((link) => link.start <= at && link.end > at)) continue;
|
|
@@ -32808,7 +33053,7 @@ function heresAnnouncement(ctx) {
|
|
|
32808
33053
|
])) for (const sentence of ctx.sentences(block)) {
|
|
32809
33054
|
const text = sentence.text;
|
|
32810
33055
|
if (!/^(?:And |So |But )?Here(?:'s| is| are) (?:the|what|why|how|who|where|when|a|an|my|our|some|two|three|four|five)\b/i.test(text) || /^(?:And |So |But )?Here's the (?:thing|deal|kicker|catch|twist|truth|secret|reality)\b/i.test(text)) continue;
|
|
32811
|
-
const count = words$
|
|
33056
|
+
const count = words$1(text).length;
|
|
32812
33057
|
const colon = text.endsWith(":");
|
|
32813
33058
|
const sentences = ctx.sentences(block);
|
|
32814
33059
|
if (sentence === sentences[sentences.length - 1]) {
|
|
@@ -32836,7 +33081,7 @@ const LEADING_CLAUSE = /^(?:without|with|for|in|on|at|after|before|if|when|once|
|
|
|
32836
33081
|
const MONTH = /\b(?:january|february|march|april|may|june|july|august|september|october|november|december|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i;
|
|
32837
33082
|
const KICKER = /^(?:That's it|That's all|No exceptions|No catch|No strings attached|No surprises|No asterisks|Period|Full stop|Simple as that|It's that simple|That simple|Nothing more|Nothing else)[.!]$/i;
|
|
32838
33083
|
function slogan(text) {
|
|
32839
|
-
const list = words$
|
|
33084
|
+
const list = words$1(text);
|
|
32840
33085
|
return /[.!]$/.test(text) && !/^Not\b/.test(text) && list.length >= 1 && list.length <= 4 && !GREETING.test(text) && !MONTH.test(text) && !list.every((word) => /^[A-Z0-9]/.test(word)) && verbless(text);
|
|
32841
33086
|
}
|
|
32842
33087
|
function fragmentRuns(ctx, rule) {
|
|
@@ -32845,7 +33090,7 @@ function fragmentRuns(ctx, rule) {
|
|
|
32845
33090
|
for (let i = 1; i < sentences.length; i++) {
|
|
32846
33091
|
const before = sentences[i - 1];
|
|
32847
33092
|
const sentence = sentences[i];
|
|
32848
|
-
const kicker = KICKER.test(sentence.text) && words$
|
|
33093
|
+
const kicker = KICKER.test(sentence.text) && words$1(before.text).length <= 8;
|
|
32849
33094
|
const pair = slogan(before.text) && slogan(sentence.text);
|
|
32850
33095
|
if (!kicker && !pair) continue;
|
|
32851
33096
|
ctx.hit(rule, block, before.start, sentence.end, kicker ? `"${sentence.text}" is a kicker added for rhythm after a short line.` : "Two verbless fragments in a row read as a slogan, not a sentence.", "Join them into one plain sentence with a verb, such as \"Books close within 48 hours of month end, every month,\" or cut the kicker.");
|
|
@@ -32860,14 +33105,14 @@ function pithyFragment(ctx) {
|
|
|
32860
33105
|
for (const block of ctx.blocks(RHYTHM_KINDS)) for (const sentence of ctx.sentences(block)) {
|
|
32861
33106
|
const text = sentence.text;
|
|
32862
33107
|
if (!/[.!]$/.test(text)) continue;
|
|
32863
|
-
const list = words$
|
|
33108
|
+
const list = words$1(text);
|
|
32864
33109
|
if (list.length < 2 || list.length > 6) continue;
|
|
32865
33110
|
if (GREETING.test(text) || MONTH.test(text)) continue;
|
|
32866
33111
|
if (list.every((word) => /^[A-Z0-9]/.test(word))) continue;
|
|
32867
33112
|
if (!verbless(text)) continue;
|
|
32868
33113
|
const strong = TWO_BEAT.some((re) => re.test(text));
|
|
32869
33114
|
const [left = "", right = ""] = text.split(",");
|
|
32870
|
-
const twoBeat = text.split(",").length === 2 && words$
|
|
33115
|
+
const twoBeat = text.split(",").length === 2 && words$1(left).length <= 3 && words$1(right).length <= 3 && !LEADING_CLAUSE.test(left.trim()) && !LEADING_CLAUSE.test(right.trim());
|
|
32871
33116
|
if (!strong && !twoBeat) continue;
|
|
32872
33117
|
ctx.hit(rule, block, sentence.start, sentence.end, "A verbless two-beat fragment reads as a slogan, not a sentence.", "Write a full sentence with a subject and a verb that says what happened, or join it to the sentence before.", strong ? void 0 : "warning");
|
|
32873
33118
|
}
|
|
@@ -32889,7 +33134,7 @@ function stockCloser(ctx) {
|
|
|
32889
33134
|
ctx.hit(rule, block, sentence.start, sentence.end, "A stock kicker that tells the reader how to feel about the last point.", "Cut it. If the text already has the number or fact that makes the point, end on that.");
|
|
32890
33135
|
continue;
|
|
32891
33136
|
}
|
|
32892
|
-
if (/^(?:but |and )?(?:that|this)(?:'s| is) not (?:how|what|why|where|a|an|the)\b/i.test(text) && words$
|
|
33137
|
+
if (/^(?:but |and )?(?:that|this)(?:'s| is) not (?:how|what|why|where|a|an|the)\b/i.test(text) && words$1(text).length <= 10) ctx.hit(reframe, block, sentence.start, sentence.end, "A short \"That's not ...\" line dismisses a view instead of stating one.", "Cut it, or say what is true with a fact the text already gives.");
|
|
32893
33138
|
}
|
|
32894
33139
|
}
|
|
32895
33140
|
const FIGURATIVE_NOUNS = "fights?|battles?|hills?|wars?|bets?|gambles?|races?|risks?|horses?|roads?|bridges?|doors?|games?|ships?|cards?";
|
|
@@ -32933,7 +33178,7 @@ function staccato(ctx) {
|
|
|
32933
33178
|
}
|
|
32934
33179
|
run = [];
|
|
32935
33180
|
};
|
|
32936
|
-
for (const sentence of sentences) if (words$
|
|
33181
|
+
for (const sentence of sentences) if (words$1(sentence.text).length <= 4) run.push(sentence);
|
|
32937
33182
|
else report();
|
|
32938
33183
|
report();
|
|
32939
33184
|
}
|
|
@@ -32986,11 +33231,11 @@ function anaphora(ctx) {
|
|
|
32986
33231
|
const sentences = ctx.sentences(block);
|
|
32987
33232
|
let i = 0;
|
|
32988
33233
|
while (i < sentences.length) {
|
|
32989
|
-
const first = words$
|
|
33234
|
+
const first = words$1(sentences[i].text)[0]?.toLowerCase();
|
|
32990
33235
|
let j = i + 1;
|
|
32991
|
-
while (j < sentences.length && first && words$
|
|
33236
|
+
while (j < sentences.length && first && words$1(sentences[j].text)[0]?.toLowerCase() === first) j++;
|
|
32992
33237
|
const run = sentences.slice(i, j);
|
|
32993
|
-
if (first === "no" && j - i >= 2 && run.every((sentence) => /^No (?!one\b|matter\b|doubt\b|longer\b|way\b|wonder\b)[a-z$\d]/.test(sentence.text) && words$
|
|
33238
|
+
if (first === "no" && j - i >= 2 && run.every((sentence) => /^No (?!one\b|matter\b|doubt\b|longer\b|way\b|wonder\b)[a-z$\d]/.test(sentence.text) && words$1(sentence.text).length <= 12)) ctx.hit(rule, block, sentences[i].start, sentences[j - 1].end, `${j - i} sentences in a row start with "No", a drumbeat of things the product is not.`, "Say what it is in one sentence, and keep only the one \"no\" a reader needs, such as \"One flat monthly fee with no tiers.\"");
|
|
32994
33239
|
else if (j - i >= 3 && first && ![
|
|
32995
33240
|
"the",
|
|
32996
33241
|
"a",
|
|
@@ -33002,7 +33247,7 @@ function anaphora(ctx) {
|
|
|
33002
33247
|
"it",
|
|
33003
33248
|
"this"
|
|
33004
33249
|
].includes(first)) {
|
|
33005
|
-
if (run.every((sentence) => words$
|
|
33250
|
+
if (run.every((sentence) => words$1(sentence.text).length <= 7) && /^(?:it's|they|we|you)$/.test(first)) ctx.hit(rule, block, sentences[i].start, sentences[j - 1].end, `${j - i} short sentences in a row start with "${first}".`, "Merge them into one sentence or a short list.");
|
|
33006
33251
|
else ctx.review("anaphora", block, sentences[i].start, sentences[j - 1].end, `${j - i} sentences in a row start with "${first}". Does the repeat help the reader follow a real list, or is it there for rhythm?`);
|
|
33007
33252
|
}
|
|
33008
33253
|
i = j;
|
|
@@ -33273,224 +33518,64 @@ function lintReportText(files) {
|
|
|
33273
33518
|
if (reviews) lines.push("Errors and warnings each come with a fix. Review items are judgement calls: change a line only when it fails the question.");
|
|
33274
33519
|
return lines.join("\n").trimEnd();
|
|
33275
33520
|
}
|
|
33276
|
-
// packages/core/src/
|
|
33277
|
-
const
|
|
33278
|
-
|
|
33279
|
-
|
|
33280
|
-
|
|
33281
|
-
|
|
33282
|
-
|
|
33283
|
-
|
|
33284
|
-
|
|
33285
|
-
|
|
33286
|
-
const AI_QUERY_KINDS = {
|
|
33287
|
-
agent_prompt: "text from an agent prompt, such as \"search the web for\"",
|
|
33288
|
-
tracker: "a visibility-tool probe, such as \"my location is\"",
|
|
33289
|
-
reply: "a bare reply, such as \"yes\" or \"tell me more\"",
|
|
33290
|
-
follow_up: "a follow-up, such as \"what about …\"",
|
|
33291
|
-
operator: "search operators, such as site:, before: or \"a\" or \"b\"",
|
|
33292
|
-
chat: "chat phrasing, such as \"can you\" or \"should i\"",
|
|
33293
|
-
long: "ten or more words with no other sign"
|
|
33294
|
-
};
|
|
33295
|
-
const MATCHERS = RULES.map(([kind, pattern]) => [kind, new RegExp(pattern)]);
|
|
33296
|
-
const AI_QUERY_PATTERN = RULES.map(([, pattern]) => `(?:${pattern})`).join("|");
|
|
33297
|
-
const NOISE = [
|
|
33298
|
-
["spaced_letters", /(^|\s)(\S\s){3,}\S(\s|$)/u],
|
|
33299
|
-
["broken_encoding", /^(яю|ÿþ|þÿ)|&#[0-9]+;?|&[a-z]+;|[âÃÂ][\u0080-\u00bf€™œ“”]|\ufffd/u],
|
|
33300
|
-
["pasted_text", /^(p [a-z]{3,} |here (are|is) (all )?the |here's the |done[,.!]? (you|here) |current state: )/u]
|
|
33301
|
-
];
|
|
33302
|
-
function aiQueryNoise(query) {
|
|
33303
|
-
const text = query.trim().toLowerCase();
|
|
33304
|
-
return NOISE.find(([, pattern]) => pattern.test(text))?.[0] ?? null;
|
|
33305
|
-
}
|
|
33306
|
-
const QUESTION = /^(how|what|what's|whats|which|why|when|where|who|is|are|can|could|does|do|should|would|will|i need|i want|i have|i'm looking|we need|we want)\b|\?$/u;
|
|
33307
|
-
const ASKABLE_KINDS = /* @__PURE__ */ new Set(["chat", "long"]);
|
|
33308
|
-
const PROMPT_CHARACTERS = 500;
|
|
33309
|
-
function askable(query, kind) {
|
|
33310
|
-
const text = query.trim().toLowerCase().replace(/^["'“]+/u, "");
|
|
33311
|
-
return Boolean(kind && ASKABLE_KINDS.has(kind)) && text.length <= PROMPT_CHARACTERS && QUESTION.test(text);
|
|
33312
|
-
}
|
|
33313
|
-
function aiQueryKind(query) {
|
|
33314
|
-
const text = query.trim().toLowerCase();
|
|
33315
|
-
return MATCHERS.find(([, pattern]) => pattern.test(text))?.[0] ?? null;
|
|
33316
|
-
}
|
|
33317
|
-
const STOP = new Set("the and for with that this what which who how why when where are is was can does do did you your our from about into than then them they their there have has had will would should could not but its it’s me my i am of to in on at by or an as be if so".split(" "));
|
|
33318
|
-
function words$1(query) {
|
|
33319
|
-
return new Set(query.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter((word) => word.length >= 3 && !STOP.has(word)).map((word) => word.length > 4 && word.endsWith("s") ? word.slice(0, -1) : word));
|
|
33320
|
-
}
|
|
33321
|
-
const SAME_QUESTION = .6;
|
|
33322
|
-
const MAX_ROWS = 25e3;
|
|
33323
|
-
const EXAMPLES = 3;
|
|
33324
|
-
const CANDIDATES = 200;
|
|
33325
|
-
const overlap = (a, b, weight) => {
|
|
33326
|
-
let shared = 0;
|
|
33327
|
-
let union = 0;
|
|
33328
|
-
for (const word of a) {
|
|
33329
|
-
union += weight(word);
|
|
33330
|
-
if (b.has(word)) shared += weight(word);
|
|
33521
|
+
// packages/core/src/simple-analytics/api.ts
|
|
33522
|
+
const ORIGIN = "https://simpleanalytics.com";
|
|
33523
|
+
const MAX_BYTES$4 = 5e6;
|
|
33524
|
+
const TIMEOUT_MS$3 = 2e4;
|
|
33525
|
+
const SIMPLE_ANALYTICS_LIMIT = 1e3;
|
|
33526
|
+
var SimpleAnalyticsError = class extends Error {
|
|
33527
|
+
code;
|
|
33528
|
+
constructor(code, message) {
|
|
33529
|
+
super(message);
|
|
33530
|
+
this.code = code;
|
|
33331
33531
|
}
|
|
33332
|
-
for (const word of b) if (!a.has(word)) union += weight(word);
|
|
33333
|
-
return union ? shared / union : 0;
|
|
33334
33532
|
};
|
|
33335
|
-
|
|
33336
|
-
|
|
33337
|
-
|
|
33338
|
-
|
|
33339
|
-
|
|
33340
|
-
|
|
33341
|
-
|
|
33342
|
-
|
|
33343
|
-
|
|
33344
|
-
|
|
33345
|
-
|
|
33346
|
-
|
|
33347
|
-
|
|
33348
|
-
|
|
33349
|
-
|
|
33350
|
-
|
|
33351
|
-
|
|
33352
|
-
|
|
33353
|
-
|
|
33354
|
-
|
|
33355
|
-
|
|
33356
|
-
|
|
33357
|
-
|
|
33358
|
-
|
|
33359
|
-
|
|
33360
|
-
|
|
33361
|
-
|
|
33362
|
-
|
|
33363
|
-
|
|
33364
|
-
|
|
33365
|
-
|
|
33366
|
-
|
|
33367
|
-
|
|
33368
|
-
|
|
33369
|
-
const query = String(row.keys[0] ?? "");
|
|
33370
|
-
const page = String(row.keys[1] ?? "");
|
|
33371
|
-
const kind = aiQueryKind(query);
|
|
33372
|
-
if (!kind) continue;
|
|
33373
|
-
const junk = aiQueryNoise(query);
|
|
33374
|
-
if (junk) {
|
|
33375
|
-
const seen = noise.get(junk) ?? /* @__PURE__ */ new Set();
|
|
33376
|
-
seen.add(query.trim().toLowerCase());
|
|
33377
|
-
noise.set(junk, seen);
|
|
33378
|
-
continue;
|
|
33379
|
-
}
|
|
33380
|
-
const text = query.trim().toLowerCase();
|
|
33381
|
-
const own = words$1(query);
|
|
33382
|
-
let group = byText.get(text);
|
|
33383
|
-
if (!group) {
|
|
33384
|
-
let checked = 0;
|
|
33385
|
-
for (const word of own) {
|
|
33386
|
-
for (const candidate of byWord.get(word) ?? []) {
|
|
33387
|
-
if (++checked > CANDIDATES) break;
|
|
33388
|
-
if (overlap(own, candidate.words, weight) >= SAME_QUESTION) {
|
|
33389
|
-
group = candidate;
|
|
33390
|
-
break;
|
|
33391
|
-
}
|
|
33392
|
-
}
|
|
33393
|
-
if (group || checked > CANDIDATES) break;
|
|
33394
|
-
}
|
|
33395
|
-
}
|
|
33396
|
-
if (!group) {
|
|
33397
|
-
group = {
|
|
33398
|
-
words: own,
|
|
33399
|
-
queries: /* @__PURE__ */ new Map(),
|
|
33400
|
-
pages: /* @__PURE__ */ new Map(),
|
|
33401
|
-
kinds: /* @__PURE__ */ new Map(),
|
|
33402
|
-
clicks: 0,
|
|
33403
|
-
impressions: 0,
|
|
33404
|
-
positionWeight: 0
|
|
33405
|
-
};
|
|
33406
|
-
groups.push(group);
|
|
33407
|
-
for (const word of own) {
|
|
33408
|
-
const list = byWord.get(word) ?? [];
|
|
33409
|
-
list.push(group);
|
|
33410
|
-
byWord.set(word, list);
|
|
33411
|
-
}
|
|
33412
|
-
}
|
|
33413
|
-
byText.set(text, group);
|
|
33414
|
-
if (!kindOf.has(text)) {
|
|
33415
|
-
kindOf.set(text, kind);
|
|
33416
|
-
group.kinds.set(kind, (group.kinds.get(kind) ?? 0) + 1);
|
|
33417
|
-
}
|
|
33418
|
-
group.queries.set(query, (group.queries.get(query) ?? 0) + row.impressions);
|
|
33419
|
-
group.pages.set(page, (group.pages.get(page) ?? 0) + row.impressions);
|
|
33420
|
-
group.clicks += row.clicks;
|
|
33421
|
-
group.impressions += row.impressions;
|
|
33422
|
-
group.positionWeight += row.position * row.impressions;
|
|
33423
|
-
}
|
|
33424
|
-
const byKind = /* @__PURE__ */ new Map();
|
|
33425
|
-
for (const kind of kindOf.values()) {
|
|
33426
|
-
const entry = byKind.get(kind) ?? {
|
|
33427
|
-
queries: 0,
|
|
33428
|
-
impressions: 0
|
|
33429
|
-
};
|
|
33430
|
-
entry.queries += 1;
|
|
33431
|
-
byKind.set(kind, entry);
|
|
33432
|
-
}
|
|
33433
|
-
for (const row of rows) {
|
|
33434
|
-
const kind = kindOf.get(String(row.keys[0] ?? "").trim().toLowerCase());
|
|
33435
|
-
const entry = kind && byKind.get(kind);
|
|
33436
|
-
if (entry) entry.impressions += row.impressions;
|
|
33533
|
+
function isSimpleAnalyticsKey(value) {
|
|
33534
|
+
return /^sa_api_key_[A-Za-z0-9_-]{8,120}$/u.test(value.trim());
|
|
33535
|
+
}
|
|
33536
|
+
const number = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
|
|
33537
|
+
const rows = (value) => Array.isArray(value) ? value.flatMap((row) => row && typeof row.value === "string" ? [{
|
|
33538
|
+
value: row.value,
|
|
33539
|
+
pageviews: number(row.pageviews) ?? 0,
|
|
33540
|
+
visitors: number(row.visitors) ?? 0
|
|
33541
|
+
}] : []) : [];
|
|
33542
|
+
async function simpleAnalyticsStats(key, hostname, range, fields, filters = {}) {
|
|
33543
|
+
const url = new URL(`${ORIGIN}/${encodeURIComponent(hostname)}.json`);
|
|
33544
|
+
url.searchParams.set("version", "6");
|
|
33545
|
+
url.searchParams.set("info", "false");
|
|
33546
|
+
url.searchParams.set("start", range.startDate);
|
|
33547
|
+
url.searchParams.set("end", range.endDate);
|
|
33548
|
+
url.searchParams.set("fields", fields.join(","));
|
|
33549
|
+
url.searchParams.set("limit", String(SIMPLE_ANALYTICS_LIMIT));
|
|
33550
|
+
for (const [name, value] of Object.entries(filters)) url.searchParams.set(name, value);
|
|
33551
|
+
const response = await fetch(url, {
|
|
33552
|
+
headers: {
|
|
33553
|
+
"Api-Key": key,
|
|
33554
|
+
accept: "application/json"
|
|
33555
|
+
},
|
|
33556
|
+
signal: AbortSignal.timeout(TIMEOUT_MS$3)
|
|
33557
|
+
}).catch(() => {
|
|
33558
|
+
throw new SimpleAnalyticsError("remote", "Could not reach Simple Analytics. Try again.");
|
|
33559
|
+
});
|
|
33560
|
+
if (response.status === 404) throw new SimpleAnalyticsError("not_found", `Simple Analytics has no website ${hostname} for this key.`);
|
|
33561
|
+
if (response.status === 401 || response.status === 403) throw new SimpleAnalyticsError("auth", `Simple Analytics rejected the API key for ${hostname}.`);
|
|
33562
|
+
if (response.status === 423) throw new SimpleAnalyticsError("auth", `Simple Analytics has no API access for ${hostname} on its plan.`);
|
|
33563
|
+
if (response.status === 400) {
|
|
33564
|
+
const reason = await readJson(response, "Simple Analytics", { maxBytes: 1e4 }).catch(() => null);
|
|
33565
|
+
const error = String(reason?.error ?? "");
|
|
33566
|
+
throw /api-key|authori[sz]/iu.test(error) ? new SimpleAnalyticsError("auth", `Simple Analytics rejected the API key for ${hostname}.`) : new SimpleAnalyticsError("remote", `Simple Analytics: ${error.slice(0, 200) || "returned 400"}.`);
|
|
33437
33567
|
}
|
|
33438
|
-
|
|
33439
|
-
const
|
|
33440
|
-
|
|
33441
|
-
const total = site.rows[0] ?? {
|
|
33442
|
-
clicks: 0,
|
|
33443
|
-
impressions: 0
|
|
33444
|
-
};
|
|
33445
|
-
const items = groups.map((group) => {
|
|
33446
|
-
const most = (map) => [...map].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([name]) => name);
|
|
33447
|
-
const [first, ...rest] = most(group.queries);
|
|
33448
|
-
const kind = [...group.kinds].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))[0]?.[0];
|
|
33449
|
-
return {
|
|
33450
|
-
query: first ?? "",
|
|
33451
|
-
page: most(group.pages)[0] ?? "",
|
|
33452
|
-
askable: askable(first ?? "", kind),
|
|
33453
|
-
pages: group.pages.size,
|
|
33454
|
-
kind,
|
|
33455
|
-
wordings: group.queries.size,
|
|
33456
|
-
impressions: group.impressions,
|
|
33457
|
-
clicks: group.clicks,
|
|
33458
|
-
ctr: group.impressions ? round(group.clicks / group.impressions, 4) : 0,
|
|
33459
|
-
position: group.impressions ? round(group.positionWeight / group.impressions, 1) : 0,
|
|
33460
|
-
otherWordings: rest.slice(0, EXAMPLES)
|
|
33461
|
-
};
|
|
33462
|
-
}).sort((a, b) => b.impressions - a.impressions || b.wordings - a.wordings || a.query.localeCompare(b.query) || a.page.localeCompare(b.page));
|
|
33463
|
-
const pct = (part, whole) => whole ? round(part / whole * 100, 1) : null;
|
|
33464
|
-
const kinds = [...byKind].sort((a, b) => b[1].impressions - a[1].impressions || a[0].localeCompare(b[0])).map(([kind, entry]) => `${kind} ${entry.queries}`).join(", ");
|
|
33465
|
-
const leftOut = [...noise].sort((a, b) => a[0].localeCompare(b[0])).map(([reason, seen]) => `${reason.replace("_", " ")} ${seen.size}`).join(", ");
|
|
33466
|
-
const asked = items.filter((item) => item.askable).length;
|
|
33467
|
-
const capped = matched.rowsFetched >= MAX_ROWS;
|
|
33568
|
+
if (!response.ok) throw new SimpleAnalyticsError("remote", `Simple Analytics returned ${response.status}.`);
|
|
33569
|
+
const body = await readJson(response, "Simple Analytics", { maxBytes: MAX_BYTES$4 });
|
|
33570
|
+
if (body?.ok !== true) throw new SimpleAnalyticsError("remote", `Simple Analytics: ${String(body?.error ?? "invalid data").slice(0, 200)}`);
|
|
33468
33571
|
return {
|
|
33469
|
-
|
|
33470
|
-
|
|
33471
|
-
|
|
33472
|
-
|
|
33473
|
-
|
|
33474
|
-
|
|
33475
|
-
|
|
33476
|
-
impressions,
|
|
33477
|
-
clicks,
|
|
33478
|
-
shareOfImpressionsPct: pct(impressions, total.impressions),
|
|
33479
|
-
byKind: kinds || "none",
|
|
33480
|
-
ctr: impressions ? round(clicks / impressions, 4) : 0,
|
|
33481
|
-
siteCtr: total.impressions ? round(total.clicks / total.impressions, 4) : 0
|
|
33482
|
-
},
|
|
33483
|
-
kinds: AI_QUERY_KINDS,
|
|
33484
|
-
items,
|
|
33485
|
-
caveats: [
|
|
33486
|
-
"A heuristic: these queries match the patterns of AI conversations and agent searches. Search Console does not mark AI Mode or AI Overviews, and people type some of these too.",
|
|
33487
|
-
"A minimum: Search Console leaves out rare queries, and these are rare by nature.",
|
|
33488
|
-
"Rewordings of one question are grouped by their shared words; page is the page with the most impressions for it.",
|
|
33489
|
-
"Left out and counted, not shown: letters split by spaces, text broken by a wrong encoding, and text pasted from a tool or an agent’s output.",
|
|
33490
|
-
"askable: a chat or long question that opens with a question word or a request such as \"i need\", or ends with a question mark, so an AI engine can be asked it as it is. ai_answers checks the top askable questions only.",
|
|
33491
|
-
"Search Console’s Generative AI report is not in its API, so it is not here.",
|
|
33492
|
-
...capped ? [`Capped at the first ${MAX_ROWS} matching query and page rows.`] : []
|
|
33493
|
-
]
|
|
33572
|
+
hostname: typeof body.hostname === "string" ? body.hostname : hostname,
|
|
33573
|
+
timezone: typeof body.timezone === "string" ? body.timezone : null,
|
|
33574
|
+
pageviews: number(body.pageviews),
|
|
33575
|
+
visitors: number(body.visitors),
|
|
33576
|
+
pages: rows(body.pages),
|
|
33577
|
+
referrers: rows(body.referrers),
|
|
33578
|
+
utm_sources: rows(body.utm_sources)
|
|
33494
33579
|
};
|
|
33495
33580
|
}
|
|
33496
33581
|
// packages/core/src/commands/research-ahrefs.ts
|
|
@@ -34284,12 +34369,6 @@ const DIMENSIONS = [
|
|
|
34284
34369
|
"searchAppearance"
|
|
34285
34370
|
];
|
|
34286
34371
|
const REGEX_MAX_CHARS = 4096;
|
|
34287
|
-
const QUERY_PRESETS = {
|
|
34288
|
-
questions: "^(who|what|where|when|why|how|is|are|can|does|do|should)\\b",
|
|
34289
|
-
long_tail: "^(\\S+\\s+){7,}\\S+$",
|
|
34290
|
-
comparisons: "\\b(vs|versus|alternatives?)\\b"
|
|
34291
|
-
};
|
|
34292
|
-
const QUERY_PRESET_NAMES = Object.keys(QUERY_PRESETS);
|
|
34293
34372
|
function rowTextFilters(input) {
|
|
34294
34373
|
return [
|
|
34295
34374
|
[
|
|
@@ -34312,11 +34391,6 @@ function rowTextFilters(input) {
|
|
|
34312
34391
|
"includingRegex",
|
|
34313
34392
|
input.queryRegex
|
|
34314
34393
|
],
|
|
34315
|
-
[
|
|
34316
|
-
"query",
|
|
34317
|
-
"includingRegex",
|
|
34318
|
-
input.queryPreset && QUERY_PRESETS[input.queryPreset]
|
|
34319
|
-
],
|
|
34320
34394
|
[
|
|
34321
34395
|
"query",
|
|
34322
34396
|
"excludingRegex",
|
|
@@ -34764,6 +34838,7 @@ async function runAiAnswers(input, headers, deps, more) {
|
|
|
34764
34838
|
] : []];
|
|
34765
34839
|
const shown = rows.map((row) => ({
|
|
34766
34840
|
question: row.question,
|
|
34841
|
+
shape: queryShape(row.question),
|
|
34767
34842
|
impressions: row.impressions,
|
|
34768
34843
|
engine: row.engine,
|
|
34769
34844
|
result: row.result,
|
|
@@ -36017,20 +36092,20 @@ async function pickClickySite(saved, target, connect, refresh) {
|
|
|
36017
36092
|
}
|
|
36018
36093
|
throw new CommandError("NO_ACCESS", `No saved Clicky site matches ${target}. Saved Clicky sites: ${sites.map(clickyLabel).join(", ")}. Pass one of these site IDs, or add the site: ${connect}`);
|
|
36019
36094
|
}
|
|
36020
|
-
const DAY = 864e5;
|
|
36021
|
-
const isoDay = (time) => new Date(time).toISOString().slice(0, 10);
|
|
36095
|
+
const DAY$1 = 864e5;
|
|
36096
|
+
const isoDay$1 = (time) => new Date(time).toISOString().slice(0, 10);
|
|
36022
36097
|
function clickyRange(input) {
|
|
36023
36098
|
if (!input.startDate && !input.endDate) {
|
|
36024
|
-
const end = Date.now() - DAY;
|
|
36099
|
+
const end = Date.now() - DAY$1;
|
|
36025
36100
|
return {
|
|
36026
|
-
startDate: isoDay(end - 27 * DAY),
|
|
36027
|
-
endDate: isoDay(end)
|
|
36101
|
+
startDate: isoDay$1(end - 27 * DAY$1),
|
|
36102
|
+
endDate: isoDay$1(end)
|
|
36028
36103
|
};
|
|
36029
36104
|
}
|
|
36030
36105
|
const start = Date.parse(`${input.startDate}T00:00:00Z`);
|
|
36031
36106
|
const end = Date.parse(`${input.endDate}T00:00:00Z`);
|
|
36032
36107
|
if (!input.startDate || !input.endDate || !(start <= end)) throw new CommandError("INVALID_INPUT", "Send a start date and an end date together, in order.");
|
|
36033
|
-
if ((end - start) / DAY + 1 > 31) throw new CommandError("INVALID_INPUT", "Clicky reads at most 31 days at a time. Send a shorter range.");
|
|
36108
|
+
if ((end - start) / DAY$1 + 1 > 31) throw new CommandError("INVALID_INPUT", "Clicky reads at most 31 days at a time. Send a shorter range.");
|
|
36034
36109
|
return {
|
|
36035
36110
|
startDate: input.startDate,
|
|
36036
36111
|
endDate: input.endDate
|
|
@@ -36119,6 +36194,143 @@ async function runClickyRows(input, keys, options) {
|
|
|
36119
36194
|
}
|
|
36120
36195
|
};
|
|
36121
36196
|
}
|
|
36197
|
+
const FREE_LIMIT = 100;
|
|
36198
|
+
const FREE_HISTORY_DAYS = 30;
|
|
36199
|
+
function compared(now, before) {
|
|
36200
|
+
const rows = /* @__PURE__ */ new Map();
|
|
36201
|
+
const add = (name, visits, key) => {
|
|
36202
|
+
const row = rows.get(name) ?? {
|
|
36203
|
+
visits: 0,
|
|
36204
|
+
previousVisits: 0
|
|
36205
|
+
};
|
|
36206
|
+
row[key] += visits;
|
|
36207
|
+
rows.set(name, row);
|
|
36208
|
+
};
|
|
36209
|
+
for (const item of now) add(item.name, item.visits, "visits");
|
|
36210
|
+
for (const item of before) add(item.name, item.visits, "previousVisits");
|
|
36211
|
+
return [...rows].map(([name, row]) => ({
|
|
36212
|
+
name,
|
|
36213
|
+
...row
|
|
36214
|
+
})).sort((left, right) => right.visits - left.visits || right.previousVisits - left.previousVisits || (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));
|
|
36215
|
+
}
|
|
36216
|
+
const sum$1 = (rows) => ({
|
|
36217
|
+
visits: rows.reduce((total, row) => total + row.visits, 0),
|
|
36218
|
+
previousVisits: rows.reduce((total, row) => total + row.previousVisits, 0)
|
|
36219
|
+
});
|
|
36220
|
+
const was = (rows) => rows.slice(0, 10).map((row) => `${row.name} ${row.visits} (was ${row.previousVisits})`).join(", ");
|
|
36221
|
+
async function clickyBeside(keys, site, range, before, pages) {
|
|
36222
|
+
const saved = keys ? clickySites(keys) : [];
|
|
36223
|
+
if (!saved.length) return null;
|
|
36224
|
+
let found;
|
|
36225
|
+
try {
|
|
36226
|
+
found = await pickClickySite(saved, site, "");
|
|
36227
|
+
} catch {
|
|
36228
|
+
return null;
|
|
36229
|
+
}
|
|
36230
|
+
const types = [
|
|
36231
|
+
"visitors",
|
|
36232
|
+
"traffic-sources",
|
|
36233
|
+
"links-domains",
|
|
36234
|
+
...pages ? ["pages-entrance"] : []
|
|
36235
|
+
];
|
|
36236
|
+
try {
|
|
36237
|
+
const read = (dates) => clickyStats(found, types, {
|
|
36238
|
+
date: `${dates.startDate},${dates.endDate}`,
|
|
36239
|
+
limit: LIMIT
|
|
36240
|
+
});
|
|
36241
|
+
const now = await read(range);
|
|
36242
|
+
const then = await read(before);
|
|
36243
|
+
const tally = (items) => items.reduce((total, item) => total + (count$2(item) ?? 0), 0);
|
|
36244
|
+
const visits = {
|
|
36245
|
+
visits: tally(now.visitors ?? []),
|
|
36246
|
+
previousVisits: tally(then.visitors ?? [])
|
|
36247
|
+
};
|
|
36248
|
+
const sources = compared(totals(now["traffic-sources"] ?? []), totals(then["traffic-sources"] ?? []));
|
|
36249
|
+
const fromAi = (items) => totals(items).flatMap((item) => {
|
|
36250
|
+
const source = aiReferralSourceForValue(item.name);
|
|
36251
|
+
return source ? [{
|
|
36252
|
+
name: source.label,
|
|
36253
|
+
visits: item.visits
|
|
36254
|
+
}] : [];
|
|
36255
|
+
});
|
|
36256
|
+
const ai = compared(fromAi(now["links-domains"] ?? []), fromAi(then["links-domains"] ?? []));
|
|
36257
|
+
const aiTotal = sum$1(ai);
|
|
36258
|
+
const landed = (items) => {
|
|
36259
|
+
let total = 0;
|
|
36260
|
+
for (const item of items) {
|
|
36261
|
+
const value = count$2(item);
|
|
36262
|
+
if (value === null || !item.url) continue;
|
|
36263
|
+
try {
|
|
36264
|
+
if (new URL(item.url).pathname.includes(pages ?? "")) total += value;
|
|
36265
|
+
} catch {}
|
|
36266
|
+
}
|
|
36267
|
+
return total;
|
|
36268
|
+
};
|
|
36269
|
+
const onPages = pages ? {
|
|
36270
|
+
contains: pages,
|
|
36271
|
+
visits: landed(now["pages-entrance"] ?? []),
|
|
36272
|
+
previousVisits: landed(then["pages-entrance"] ?? [])
|
|
36273
|
+
} : null;
|
|
36274
|
+
const cut = (type) => [now, then].some((stats) => {
|
|
36275
|
+
const length = stats[type]?.length ?? 0;
|
|
36276
|
+
return length >= LIMIT || length === FREE_LIMIT;
|
|
36277
|
+
});
|
|
36278
|
+
const linksCut = cut("links-domains");
|
|
36279
|
+
const pagesCut = Boolean(pages) && cut("pages-entrance");
|
|
36280
|
+
const daysBack = Math.round((Date.now() - Date.parse(`${before.startDate}T00:00:00Z`)) / DAY$1);
|
|
36281
|
+
const notes = [
|
|
36282
|
+
"Visits are Clicky’s own count, in the Clicky site’s time zone; they are not Google Analytics sessions or Search Console clicks.",
|
|
36283
|
+
pagesCut ? "Clicky’s list of landing pages reached its row limit (100 on a free account, 1,000 otherwise), so the landing-page total can be higher than shown." : "",
|
|
36284
|
+
daysBack > FREE_HISTORY_DAYS ? `The earlier period starts ${daysBack} days ago; a free Clicky account keeps 30 days, so on one it can read as zero.` : ""
|
|
36285
|
+
].filter(Boolean);
|
|
36286
|
+
const total = `${visits.visits} (was ${visits.previousVisits}, ${change$2(pct(visits.visits, visits.previousVisits))})`;
|
|
36287
|
+
const text = [
|
|
36288
|
+
`Clicky site ${clickyLabel(found)}: visits ${total}${pages ? " on the whole site" : ""}.`,
|
|
36289
|
+
sources.length ? `Traffic sources (visits): ${was(sources)}.` : "",
|
|
36290
|
+
onPages ? `Visits that landed on pages whose path contains "${pages}", from every source: ${onPages.visits} (was ${onPages.previousVisits}, ${change$2(pct(onPages.visits, onPages.previousVisits))}). Clicky does not split landing pages by source.` : "",
|
|
36291
|
+
...notes
|
|
36292
|
+
].filter(Boolean).join(" ");
|
|
36293
|
+
const limit = "Clicky’s list of incoming link domains reached its row limit (100 on a free account, 1,000 otherwise)";
|
|
36294
|
+
return {
|
|
36295
|
+
text: `${text}\n\n${[
|
|
36296
|
+
aiTotal.visits || aiTotal.previousVisits ? `Visits from AI assistants in Clicky’s incoming links (whole site): ${aiTotal.visits} (was ${aiTotal.previousVisits}, ${change$2(pct(aiTotal.visits, aiTotal.previousVisits))}). By source: ${was(ai)}.` : linksCut ? `Visits from AI assistants in Clicky’s incoming links (whole site): none among the domains Clicky listed. ${limit}, so this is unknown, not zero.` : "Visits from AI assistants in Clicky’s incoming links (whole site): none in either period.",
|
|
36297
|
+
linksCut && (aiTotal.visits || aiTotal.previousVisits) ? `${limit}, so these can be higher.` : "",
|
|
36298
|
+
"Only visits that pass a referrer count; AI apps that send none show as direct."
|
|
36299
|
+
].filter(Boolean).join(" ")}`,
|
|
36300
|
+
data: {
|
|
36301
|
+
siteId: found.siteId,
|
|
36302
|
+
domain: found.domain,
|
|
36303
|
+
metric: "visits",
|
|
36304
|
+
...visits,
|
|
36305
|
+
visitsChangePct: pct(visits.visits, visits.previousVisits),
|
|
36306
|
+
trafficSources: sources.map(({ name, ...row }) => ({
|
|
36307
|
+
source: name,
|
|
36308
|
+
...row
|
|
36309
|
+
})),
|
|
36310
|
+
...onPages ? { landingPages: {
|
|
36311
|
+
...onPages,
|
|
36312
|
+
capped: pagesCut
|
|
36313
|
+
} } : {},
|
|
36314
|
+
aiAssistants: {
|
|
36315
|
+
...aiTotal,
|
|
36316
|
+
visitsChangePct: pct(aiTotal.visits, aiTotal.previousVisits),
|
|
36317
|
+
bySource: ai.map(({ name, ...row }) => ({
|
|
36318
|
+
source: name,
|
|
36319
|
+
...row
|
|
36320
|
+
})),
|
|
36321
|
+
capped: linksCut
|
|
36322
|
+
},
|
|
36323
|
+
notes
|
|
36324
|
+
}
|
|
36325
|
+
};
|
|
36326
|
+
} catch (error) {
|
|
36327
|
+
const message = error instanceof ClickyError ? error.message : error instanceof Error ? error.message : String(error);
|
|
36328
|
+
return {
|
|
36329
|
+
text: `Clicky: could not be read. ${message}`,
|
|
36330
|
+
data: { error: message }
|
|
36331
|
+
};
|
|
36332
|
+
}
|
|
36333
|
+
}
|
|
36122
36334
|
// packages/core/src/commands/domain-rating.ts
|
|
36123
36335
|
const DR_ATTRIBUTION = "domain_rating: Domain Rating by Ahrefs (https://ahrefs.com/).";
|
|
36124
36336
|
const ENDPOINT = "https://api.ahrefs.com/v3/public/domain-rating-free";
|
|
@@ -37920,6 +38132,33 @@ async function bingLead(overview, bing, origin, rowsPerList) {
|
|
|
37920
38132
|
return null;
|
|
37921
38133
|
}
|
|
37922
38134
|
}
|
|
38135
|
+
const SHAPED = /* @__PURE__ */ new Set([
|
|
38136
|
+
"quick-wins",
|
|
38137
|
+
"low-ctr",
|
|
38138
|
+
"striking-distance",
|
|
38139
|
+
"second-page",
|
|
38140
|
+
"ai-queries"
|
|
38141
|
+
]);
|
|
38142
|
+
function labelShapes(report, count) {
|
|
38143
|
+
const queries = [];
|
|
38144
|
+
const visit = (value, depth) => {
|
|
38145
|
+
if (depth > 3 || !value || typeof value !== "object") return;
|
|
38146
|
+
if (Array.isArray(value)) {
|
|
38147
|
+
for (const item of value) visit(item, depth + 1);
|
|
38148
|
+
return;
|
|
38149
|
+
}
|
|
38150
|
+
const row = value;
|
|
38151
|
+
if (typeof row.query === "string") {
|
|
38152
|
+
queries.push(row.query);
|
|
38153
|
+
const shape = queryShape(row.query);
|
|
38154
|
+
if (shape) row.shape = shape;
|
|
38155
|
+
}
|
|
38156
|
+
for (const [key, child] of Object.entries(row)) if (Array.isArray(child) && key !== "caveats") visit(child, depth + 1);
|
|
38157
|
+
};
|
|
38158
|
+
visit(report.items, 0);
|
|
38159
|
+
const line = count && queryShapeLine(queries);
|
|
38160
|
+
if (line) report.queryShapes = line;
|
|
38161
|
+
}
|
|
37923
38162
|
async function build(read, site, section, range, now, bing) {
|
|
37924
38163
|
const dependencies = {
|
|
37925
38164
|
searchAnalytics: read,
|
|
@@ -37987,7 +38226,9 @@ async function build(read, site, section, range, now, bing) {
|
|
|
37987
38226
|
}, read),
|
|
37988
38227
|
bing: async () => bingSection(await bing(), read, site, range)
|
|
37989
38228
|
}[section];
|
|
37990
|
-
|
|
38229
|
+
const report = factsOnly(await run());
|
|
38230
|
+
if (SHAPED.has(section)) labelShapes(report, section !== "ai-queries");
|
|
38231
|
+
return report;
|
|
37991
38232
|
}
|
|
37992
38233
|
function brandNote(report) {
|
|
37993
38234
|
const brand = report.brand;
|
|
@@ -38072,6 +38313,7 @@ async function allSections(input, deps) {
|
|
|
38072
38313
|
parts.push([
|
|
38073
38314
|
`## ${id}: ${shown.total} ${shown.total === 1 ? "row" : "rows"}`,
|
|
38074
38315
|
SECTIONS[id],
|
|
38316
|
+
typeof run.queryShapes === "string" ? run.queryShapes : null,
|
|
38075
38317
|
shown.text,
|
|
38076
38318
|
id === "traffic-drop" ? listOfUpdates(run.googleUpdates, run.updateWindow) : null
|
|
38077
38319
|
].filter(Boolean).join("\n"));
|
|
@@ -38164,6 +38406,7 @@ async function oneSection(input, deps) {
|
|
|
38164
38406
|
report.pageChecks = checked;
|
|
38165
38407
|
}
|
|
38166
38408
|
const notes = money ? [money] : [];
|
|
38409
|
+
if (typeof report.queryShapes === "string") notes.push(report.queryShapes);
|
|
38167
38410
|
const brand = brandNote(report);
|
|
38168
38411
|
if (brand) notes.push(brand);
|
|
38169
38412
|
const updates = listOfUpdates(report.googleUpdates, report.updateWindow);
|
|
@@ -38710,6 +38953,288 @@ async function sortedByDomainRating(rows, key) {
|
|
|
38710
38953
|
added: true
|
|
38711
38954
|
};
|
|
38712
38955
|
}
|
|
38956
|
+
// packages/core/src/commands/simple-analytics.ts
|
|
38957
|
+
const SIMPLE_ANALYTICS_KEY = "x-simpleanalytics-key";
|
|
38958
|
+
const simpleAnalyticsKey = (keys) => keys.get("x-simpleanalytics-key")?.trim() || null;
|
|
38959
|
+
const MAX_AI_TOOLS = 5;
|
|
38960
|
+
const MAX_AI_PAIRS = 4;
|
|
38961
|
+
const TOP = 10;
|
|
38962
|
+
const DAY = 864e5;
|
|
38963
|
+
const isoDay = (time) => new Date(time).toISOString().slice(0, 10);
|
|
38964
|
+
const BARE_AI = {
|
|
38965
|
+
chatgpt: "chatgpt",
|
|
38966
|
+
openai: "chatgpt",
|
|
38967
|
+
perplexity: "perplexity",
|
|
38968
|
+
claude: "claude",
|
|
38969
|
+
gemini: "gemini",
|
|
38970
|
+
copilot: "copilot",
|
|
38971
|
+
grok: "grok",
|
|
38972
|
+
deepseek: "deepseek"
|
|
38973
|
+
};
|
|
38974
|
+
const aiTool = (value) => aiReferralSourceForValue(value) ?? AI_REFERRAL_SOURCES.find((source) => source.id === BARE_AI[value.trim().toLowerCase()]);
|
|
38975
|
+
function hostsOf(site) {
|
|
38976
|
+
const text = site.trim().toLowerCase().replace(/^sc-domain:/u, "");
|
|
38977
|
+
let host;
|
|
38978
|
+
try {
|
|
38979
|
+
host = new URL(text.includes("://") ? text : `https://${text}`).hostname;
|
|
38980
|
+
} catch {
|
|
38981
|
+
host = text;
|
|
38982
|
+
}
|
|
38983
|
+
const bare = host.replace(/^www\./u, "");
|
|
38984
|
+
return [bare, `www.${bare}`];
|
|
38985
|
+
}
|
|
38986
|
+
const byVisitors = (a, b) => b.visitors - a.visitors || b.pageviews - a.pageviews || (a.value < b.value ? -1 : a.value > b.value ? 1 : 0);
|
|
38987
|
+
async function readPeriod(key, hostname, range, filters, withPages) {
|
|
38988
|
+
const stats = await simpleAnalyticsStats(key, hostname, range, [
|
|
38989
|
+
"pageviews",
|
|
38990
|
+
"visitors",
|
|
38991
|
+
...withPages ? ["pages"] : [],
|
|
38992
|
+
"referrers",
|
|
38993
|
+
"utm_sources"
|
|
38994
|
+
], filters);
|
|
38995
|
+
const referrers = [...stats.referrers].sort(byVisitors);
|
|
38996
|
+
const utmSources = [...stats.utm_sources].sort(byVisitors);
|
|
38997
|
+
const tools = /* @__PURE__ */ new Map();
|
|
38998
|
+
const add = (rows, side) => {
|
|
38999
|
+
for (const row of rows) {
|
|
39000
|
+
const tool = aiTool(row.value);
|
|
39001
|
+
if (!tool || !row.visitors) continue;
|
|
39002
|
+
const entry = tools.get(tool.id) ?? {
|
|
39003
|
+
label: tool.label,
|
|
39004
|
+
refs: [],
|
|
39005
|
+
utms: []
|
|
39006
|
+
};
|
|
39007
|
+
entry[side].push(row);
|
|
39008
|
+
tools.set(tool.id, entry);
|
|
39009
|
+
}
|
|
39010
|
+
};
|
|
39011
|
+
add(referrers, "refs");
|
|
39012
|
+
add(utmSources, "utms");
|
|
39013
|
+
const sum = (rows) => rows.reduce((total, row) => total + row.visitors, 0);
|
|
39014
|
+
const ranked = [...tools.values()].map((tool) => ({
|
|
39015
|
+
...tool,
|
|
39016
|
+
total: sum(tool.refs) + sum(tool.utms)
|
|
39017
|
+
})).sort((a, b) => b.total - a.total || (a.label < b.label ? -1 : a.label > b.label ? 1 : 0));
|
|
39018
|
+
const counted = await Promise.all(ranked.slice(0, MAX_AI_TOOLS).map(async (tool) => {
|
|
39019
|
+
const pairs = tool.refs.flatMap((ref) => tool.utms.map((utm) => ({
|
|
39020
|
+
ref,
|
|
39021
|
+
utm
|
|
39022
|
+
}))).sort((a, b) => Math.min(b.ref.visitors, b.utm.visitors) - Math.min(a.ref.visitors, a.utm.visitors) || (a.ref.value + a.utm.value < b.ref.value + b.utm.value ? -1 : 1));
|
|
39023
|
+
const checked = pairs.slice(0, MAX_AI_PAIRS);
|
|
39024
|
+
const overlaps = await Promise.all(checked.map(async ({ ref, utm }) => (await simpleAnalyticsStats(key, hostname, range, ["visitors"], {
|
|
39025
|
+
...filters,
|
|
39026
|
+
referrer: ref.value,
|
|
39027
|
+
utm_source: utm.value
|
|
39028
|
+
})).visitors ?? 0));
|
|
39029
|
+
return {
|
|
39030
|
+
tool: tool.label,
|
|
39031
|
+
visitors: tool.total - overlaps.reduce((sum, n) => sum + n, 0),
|
|
39032
|
+
referrers: tool.refs.map((row) => row.value),
|
|
39033
|
+
utmSources: tool.utms.map((row) => row.value),
|
|
39034
|
+
exact: pairs.length <= MAX_AI_PAIRS
|
|
39035
|
+
};
|
|
39036
|
+
}));
|
|
39037
|
+
const full = (rows) => rows.length >= SIMPLE_ANALYTICS_LIMIT;
|
|
39038
|
+
return {
|
|
39039
|
+
hostname: stats.hostname,
|
|
39040
|
+
timezone: stats.timezone,
|
|
39041
|
+
range,
|
|
39042
|
+
visitors: stats.visitors ?? 0,
|
|
39043
|
+
pageviews: stats.pageviews ?? 0,
|
|
39044
|
+
pages: [...stats.pages].sort(byVisitors),
|
|
39045
|
+
referrers,
|
|
39046
|
+
utmSources,
|
|
39047
|
+
ai: {
|
|
39048
|
+
visitors: counted.reduce((total, tool) => total + tool.visitors, 0),
|
|
39049
|
+
tools: counted,
|
|
39050
|
+
notCounted: Math.max(0, ranked.length - MAX_AI_TOOLS)
|
|
39051
|
+
},
|
|
39052
|
+
capped: {
|
|
39053
|
+
pages: full(stats.pages),
|
|
39054
|
+
referrers: full(stats.referrers),
|
|
39055
|
+
utmSources: full(stats.utm_sources)
|
|
39056
|
+
}
|
|
39057
|
+
};
|
|
39058
|
+
}
|
|
39059
|
+
async function firstPeriod(site, read) {
|
|
39060
|
+
for (const hostname of hostsOf(site)) try {
|
|
39061
|
+
return await read(hostname);
|
|
39062
|
+
} catch (error) {
|
|
39063
|
+
if (error instanceof SimpleAnalyticsError && error.code === "not_found") continue;
|
|
39064
|
+
throw error;
|
|
39065
|
+
}
|
|
39066
|
+
return null;
|
|
39067
|
+
}
|
|
39068
|
+
function pageFilter(pages) {
|
|
39069
|
+
return pages?.startsWith("/") ? { pages: `${pages.replace(/\*+$/u, "")}*` } : {};
|
|
39070
|
+
}
|
|
39071
|
+
const top = (rows) => rows.slice(0, TOP).map((row) => `${row.value} ${row.visitors}`).join("; ");
|
|
39072
|
+
const aiNotes = (period) => [
|
|
39073
|
+
period.ai.tools.some((tool) => !tool.exact) ? `${period.ai.tools.filter((tool) => !tool.exact).map((tool) => tool.tool).join(", ")} came in more referrer and utm_source pairs than were checked, so a visitor with both can count twice there.` : "",
|
|
39074
|
+
period.ai.notCounted ? `${period.ai.notCounted} more AI ${period.ai.notCounted === 1 ? "tool is" : "tools are"} left out of this count.` : "",
|
|
39075
|
+
period.capped.referrers || period.capped.utmSources ? `A referrer or utm_source list reached Simple Analytics' ${SIMPLE_ANALYTICS_LIMIT}-row limit, so AI tools past it are missing, not zero.` : ""
|
|
39076
|
+
].filter(Boolean);
|
|
39077
|
+
const VISITORS_NOTE = "Visitors are Simple Analytics’ own count: a pageview with no referrer or one from another site, which it also counts as a visit. They are not Google Analytics sessions or users, or Search Console clicks.";
|
|
39078
|
+
const zoneNote = (period) => period.timezone ? `Days are in the website’s time zone, ${period.timezone}.` : "";
|
|
39079
|
+
const failure = (error) => error instanceof Error ? error.message : String(error);
|
|
39080
|
+
async function simpleAnalyticsBeside(keys, site, range, before, pages) {
|
|
39081
|
+
const key = keys ? simpleAnalyticsKey(keys) : null;
|
|
39082
|
+
if (!key) return null;
|
|
39083
|
+
const filters = pageFilter(pages);
|
|
39084
|
+
try {
|
|
39085
|
+
const now = await firstPeriod(site, (hostname) => readPeriod(key, hostname, range, filters, false));
|
|
39086
|
+
if (!now) return null;
|
|
39087
|
+
const then = await readPeriod(key, now.hostname, before, filters, false);
|
|
39088
|
+
const merged = (a, b, name) => {
|
|
39089
|
+
const rows = /* @__PURE__ */ new Map();
|
|
39090
|
+
for (const row of a) {
|
|
39091
|
+
const entry = rows.get(name(row)) ?? {
|
|
39092
|
+
visitors: 0,
|
|
39093
|
+
previousVisitors: 0
|
|
39094
|
+
};
|
|
39095
|
+
entry.visitors += row.visitors;
|
|
39096
|
+
rows.set(name(row), entry);
|
|
39097
|
+
}
|
|
39098
|
+
for (const row of b) {
|
|
39099
|
+
const entry = rows.get(name(row)) ?? {
|
|
39100
|
+
visitors: 0,
|
|
39101
|
+
previousVisitors: 0
|
|
39102
|
+
};
|
|
39103
|
+
entry.previousVisitors += row.visitors;
|
|
39104
|
+
rows.set(name(row), entry);
|
|
39105
|
+
}
|
|
39106
|
+
return [...rows].map(([key, entry]) => ({
|
|
39107
|
+
name: key,
|
|
39108
|
+
...entry
|
|
39109
|
+
})).sort((x, y) => y.visitors - x.visitors || y.previousVisitors - x.previousVisitors || (x.name < y.name ? -1 : x.name > y.name ? 1 : 0));
|
|
39110
|
+
};
|
|
39111
|
+
const was = (rows) => rows.slice(0, TOP).map((row) => `${row.name} ${row.visitors} (was ${row.previousVisitors})`).join(", ");
|
|
39112
|
+
const referrers = merged(now.referrers, then.referrers, (row) => row.value);
|
|
39113
|
+
const tools = merged(now.ai.tools, then.ai.tools, (row) => row.tool);
|
|
39114
|
+
const scope = filters.pages ? `, pages whose path starts with "${pages}"` : "";
|
|
39115
|
+
const notes = [
|
|
39116
|
+
VISITORS_NOTE,
|
|
39117
|
+
zoneNote(now),
|
|
39118
|
+
pages && !filters.pages ? `Simple Analytics narrows only to paths that start with some text, so these numbers cover the whole site, not pages containing "${pages}".` : "",
|
|
39119
|
+
now.capped.referrers || then.capped.referrers ? `The referrer list reached Simple Analytics' ${SIMPLE_ANALYTICS_LIMIT}-row limit, so referrers past it are missing, not zero.` : ""
|
|
39120
|
+
].filter(Boolean);
|
|
39121
|
+
return {
|
|
39122
|
+
text: `${[
|
|
39123
|
+
`Simple Analytics, website ${now.hostname}${scope}: visitors ${now.visitors} (was ${then.visitors}, ${change$2(pct(now.visitors, then.visitors))}), pageviews ${now.pageviews} (was ${then.pageviews}, ${change$2(pct(now.pageviews, then.pageviews))}).`,
|
|
39124
|
+
referrers.length ? `Top referrers (visitors): ${was(referrers)}.` : "",
|
|
39125
|
+
...notes
|
|
39126
|
+
].filter(Boolean).join(" ")}\n\n${[
|
|
39127
|
+
now.ai.visitors || then.ai.visitors ? `Visitors from AI assistants in Simple Analytics (referrers and utm_source tags, a visitor with both counted once): ${now.ai.visitors} (was ${then.ai.visitors}, ${change$2(pct(now.ai.visitors, then.ai.visitors))}). By tool: ${was(tools)}.` : now.capped.referrers || now.capped.utmSources ? "Visitors from AI assistants in Simple Analytics: none among the referrers and utm_source tags it listed, but a list reached its row limit, so this is unknown, not zero." : "Visitors from AI assistants in Simple Analytics: none in either period.",
|
|
39128
|
+
.../* @__PURE__ */ new Set([...aiNotes(now), ...aiNotes(then)]),
|
|
39129
|
+
"Only visits that pass a referrer or utm_source count; AI apps that send neither show as direct."
|
|
39130
|
+
].join(" ")}`,
|
|
39131
|
+
data: {
|
|
39132
|
+
hostname: now.hostname,
|
|
39133
|
+
timezone: now.timezone,
|
|
39134
|
+
...filters.pages ? { pathStartsWith: pages } : {},
|
|
39135
|
+
metric: "visitors",
|
|
39136
|
+
visitors: now.visitors,
|
|
39137
|
+
previousVisitors: then.visitors,
|
|
39138
|
+
visitorsChangePct: pct(now.visitors, then.visitors),
|
|
39139
|
+
pageviews: now.pageviews,
|
|
39140
|
+
previousPageviews: then.pageviews,
|
|
39141
|
+
referrers: referrers.map(({ name, ...row }) => ({
|
|
39142
|
+
referrer: name,
|
|
39143
|
+
...row
|
|
39144
|
+
})),
|
|
39145
|
+
aiAssistants: {
|
|
39146
|
+
visitors: now.ai.visitors,
|
|
39147
|
+
previousVisitors: then.ai.visitors,
|
|
39148
|
+
visitorsChangePct: pct(now.ai.visitors, then.ai.visitors),
|
|
39149
|
+
byTool: tools.map(({ name, ...row }) => ({
|
|
39150
|
+
tool: name,
|
|
39151
|
+
...row
|
|
39152
|
+
})),
|
|
39153
|
+
tools: now.ai.tools,
|
|
39154
|
+
previousTools: then.ai.tools
|
|
39155
|
+
},
|
|
39156
|
+
capped: {
|
|
39157
|
+
now: now.capped,
|
|
39158
|
+
before: then.capped
|
|
39159
|
+
},
|
|
39160
|
+
notes
|
|
39161
|
+
}
|
|
39162
|
+
};
|
|
39163
|
+
} catch (error) {
|
|
39164
|
+
return {
|
|
39165
|
+
text: `Simple Analytics: could not be read. ${failure(error)}`,
|
|
39166
|
+
data: { error: failure(error) }
|
|
39167
|
+
};
|
|
39168
|
+
}
|
|
39169
|
+
}
|
|
39170
|
+
async function runSimpleAnalyticsRows(input, keys, options) {
|
|
39171
|
+
const key = simpleAnalyticsKey(keys);
|
|
39172
|
+
if (!key) throw new CommandError("NO_KEY", `No Simple Analytics API key is saved. Add one: ${options.connect}`);
|
|
39173
|
+
let range;
|
|
39174
|
+
if (!input.startDate && !input.endDate) {
|
|
39175
|
+
const end = Date.now() - DAY;
|
|
39176
|
+
range = {
|
|
39177
|
+
startDate: isoDay(end - 27 * DAY),
|
|
39178
|
+
endDate: isoDay(end)
|
|
39179
|
+
};
|
|
39180
|
+
} else if (!input.startDate || !input.endDate || !(Date.parse(input.startDate) <= Date.parse(input.endDate))) throw new CommandError("INVALID_INPUT", "Send a start date and an end date together, in order.");
|
|
39181
|
+
else range = {
|
|
39182
|
+
startDate: input.startDate,
|
|
39183
|
+
endDate: input.endDate
|
|
39184
|
+
};
|
|
39185
|
+
let period;
|
|
39186
|
+
try {
|
|
39187
|
+
period = await firstPeriod(input.site, (hostname) => readPeriod(key, hostname, range, {}, true));
|
|
39188
|
+
} catch (error) {
|
|
39189
|
+
throw new CommandError(error instanceof SimpleAnalyticsError && error.code === "auth" ? "NO_ACCESS" : "PROVIDER_ERROR", error instanceof SimpleAnalyticsError && error.code === "auth" ? `${error.message} Save it again: ${options.connect}` : failure(error));
|
|
39190
|
+
}
|
|
39191
|
+
if (!period) throw new CommandError("NO_ACCESS", `Simple Analytics has no website ${hostsOf(input.site).join(" or ")} for this API key.`);
|
|
39192
|
+
const offset = input.offset ?? 0;
|
|
39193
|
+
const rows = period.pages.filter((row) => row.visitors > 0).map((row) => ({
|
|
39194
|
+
page: row.value,
|
|
39195
|
+
visitors: row.visitors,
|
|
39196
|
+
pageviews: row.pageviews
|
|
39197
|
+
}));
|
|
39198
|
+
const notes = [
|
|
39199
|
+
`Visitors ${period.visitors}, pageviews ${period.pageviews} in all. A page’s visitors are the visits that started on it; pages with pageviews but no visitors are left out.`,
|
|
39200
|
+
VISITORS_NOTE,
|
|
39201
|
+
zoneNote(period),
|
|
39202
|
+
period.referrers.length ? `Referrers (visitors): ${top(period.referrers)}.` : "Referrers: none in this range.",
|
|
39203
|
+
period.utmSources.length ? `utm_source tags (visitors): ${top(period.utmSources)}.` : "",
|
|
39204
|
+
period.ai.visitors ? `Visitors from AI assistants (referrers and utm_source tags, a visitor with both counted once): ${period.ai.visitors}. By tool: ${period.ai.tools.map((tool) => `${tool.tool} ${tool.visitors}`).join(", ")}.` : "Visitors from AI assistants: none among the referrers and utm_source tags listed.",
|
|
39205
|
+
...aiNotes(period),
|
|
39206
|
+
period.capped.pages ? `Simple Analytics returned its ${SIMPLE_ANALYTICS_LIMIT}-row limit of pages; pages past it are missing, not zero.` : ""
|
|
39207
|
+
].filter(Boolean);
|
|
39208
|
+
return {
|
|
39209
|
+
text: rowsText({
|
|
39210
|
+
title: `Simple Analytics website ${period.hostname}: landing pages, ${range.startDate} to ${range.endDate}.`,
|
|
39211
|
+
rows,
|
|
39212
|
+
offset,
|
|
39213
|
+
limit: 50,
|
|
39214
|
+
detail: input.detail ?? "summary",
|
|
39215
|
+
notes,
|
|
39216
|
+
more: options.call
|
|
39217
|
+
}),
|
|
39218
|
+
data: {
|
|
39219
|
+
hostname: period.hostname,
|
|
39220
|
+
timezone: period.timezone,
|
|
39221
|
+
range,
|
|
39222
|
+
metric: "visitors",
|
|
39223
|
+
visitors: period.visitors,
|
|
39224
|
+
pageviews: period.pageviews,
|
|
39225
|
+
referrers: period.referrers.slice(0, 50),
|
|
39226
|
+
utmSources: period.utmSources.slice(0, 50),
|
|
39227
|
+
aiAssistants: {
|
|
39228
|
+
visitors: period.ai.visitors,
|
|
39229
|
+
tools: period.ai.tools
|
|
39230
|
+
},
|
|
39231
|
+
capped: period.capped.pages,
|
|
39232
|
+
total: rows.length,
|
|
39233
|
+
offset,
|
|
39234
|
+
rows: rows.slice(offset, offset + 50)
|
|
39235
|
+
}
|
|
39236
|
+
};
|
|
39237
|
+
}
|
|
38713
39238
|
// packages/core/src/commands/sitemap-urls.ts
|
|
38714
39239
|
const MAX_FILES = 20;
|
|
38715
39240
|
const MAX_URLS = 5e4;
|
|
@@ -38926,6 +39451,12 @@ async function runPage(input, deps) {
|
|
|
38926
39451
|
});
|
|
38927
39452
|
}
|
|
38928
39453
|
rows.sort((a, b) => Number(b.clicks) - Number(a.clicks) || Number(b.impressions) - Number(a.impressions));
|
|
39454
|
+
const shaped = rows.map((row) => ({
|
|
39455
|
+
query: row.query,
|
|
39456
|
+
shape: queryShape(String(row.query ?? "")),
|
|
39457
|
+
...row
|
|
39458
|
+
}));
|
|
39459
|
+
const shapes = queryShapeLine(rows.map((row) => String(row.query ?? "")));
|
|
38929
39460
|
const sum = (list, key) => list.reduce((total, row) => total + row[key], 0);
|
|
38930
39461
|
const offset = input.offset ?? 0;
|
|
38931
39462
|
return {
|
|
@@ -38938,12 +39469,13 @@ async function runPage(input, deps) {
|
|
|
38938
39469
|
...reason ? [`Google's reason: ${reason.reason}. Label: ${reason.label}. ${reason.why} (Labels are rules over this evidence, not Google's; ${deps.call("index")} explains them.)`] : [],
|
|
38939
39470
|
...indexed && /^URL is unknown to Google$/i.test(indexed.coverage ?? "") ? [unknownNext(input, sitemap.urls.includes(input.url), deps)] : [],
|
|
38940
39471
|
`Query totals: clicks ${sum(now.rows, "clicks")} (was ${sum(then.rows, "clicks")}), impressions ${sum(now.rows, "impressions")} (was ${sum(then.rows, "impressions")}). Search Console hides rare queries, so these can be lower than the page total.`,
|
|
39472
|
+
...shapes ? [shapes] : [],
|
|
38941
39473
|
deps.pageMarkdown ? `Main content as Markdown: ${deps.call("page", {
|
|
38942
39474
|
url: input.url,
|
|
38943
39475
|
detail: "full"
|
|
38944
39476
|
})}.` : `Main content as Markdown: only in the CLI and the local MCP server, with \`npx -y seo page --url ${input.url} --detail full\`.`
|
|
38945
39477
|
],
|
|
38946
|
-
rows,
|
|
39478
|
+
rows: shaped,
|
|
38947
39479
|
offset,
|
|
38948
39480
|
limit: 50,
|
|
38949
39481
|
detail: input.detail ?? "summary",
|
|
@@ -38967,7 +39499,7 @@ async function runPage(input, deps) {
|
|
|
38967
39499
|
indexInspectedAt: savedAt,
|
|
38968
39500
|
reason,
|
|
38969
39501
|
totalQueries: rows.length,
|
|
38970
|
-
queries:
|
|
39502
|
+
queries: shaped.slice(offset, offset + 50),
|
|
38971
39503
|
...full ? { markdown } : {}
|
|
38972
39504
|
}
|
|
38973
39505
|
};
|
|
@@ -39044,7 +39576,7 @@ function markdownText(markdown, url) {
|
|
|
39044
39576
|
if (!markdown.markdown) return "Main content as Markdown: the page has no main content to read.";
|
|
39045
39577
|
return `Main content as Markdown (live page${markdown.truncated ? `, cut to ${markdown.markdown.length.toLocaleString("en-US")} of ${markdown.characters.toLocaleString("en-US")} characters` : ""}):\n\n${markdown.markdown}`;
|
|
39046
39578
|
}
|
|
39047
|
-
async function runCompare(input, deps) {
|
|
39579
|
+
async function runCompare(input, deps, keys) {
|
|
39048
39580
|
if (!realIsoDate(input.date)) throw new CommandError("INVALID_INPUT", "The date must be a real day as YYYY-MM-DD.");
|
|
39049
39581
|
const last = latestFinalGscDate(deps.now?.() ?? /* @__PURE__ */ new Date());
|
|
39050
39582
|
const daysAfter = Math.round((Date.parse(last) - Date.parse(input.date)) / 864e5) + 1;
|
|
@@ -39058,18 +39590,22 @@ async function runCompare(input, deps) {
|
|
|
39058
39590
|
startDate: shiftIsoDate(input.date, -days),
|
|
39059
39591
|
endDate: shiftIsoDate(input.date, -1)
|
|
39060
39592
|
};
|
|
39061
|
-
const [report, updates, analytics] = await Promise.all([
|
|
39593
|
+
const [report, updates, analytics, clicky, simpleAnalytics] = await Promise.all([
|
|
39062
39594
|
siteOverview(sharedReader(deps.searchAnalytics), input.site, after, before, input.pages),
|
|
39063
39595
|
googleUpdates({
|
|
39064
39596
|
start: before.startDate,
|
|
39065
39597
|
end: after.endDate
|
|
39066
39598
|
}),
|
|
39067
|
-
analyticsBeside(deps.analytics, input.site, after, before, input.pages)
|
|
39599
|
+
analyticsBeside(deps.analytics, input.site, after, before, input.pages),
|
|
39600
|
+
clickyBeside(keys, input.site, after, before, input.pages),
|
|
39601
|
+
simpleAnalyticsBeside(keys, input.site, after, before, input.pages)
|
|
39068
39602
|
]);
|
|
39069
39603
|
return {
|
|
39070
39604
|
text: [
|
|
39071
39605
|
overviewText(report, `Compare on ${input.site}: ${days} days after ${input.date}`, originOf(input.site), 10),
|
|
39072
39606
|
analytics?.text,
|
|
39607
|
+
clicky?.text,
|
|
39608
|
+
simpleAnalytics?.text,
|
|
39073
39609
|
listOfUpdates(updates),
|
|
39074
39610
|
`Next: ${deps.call("page")} for a page that moved.`,
|
|
39075
39611
|
FACTS_ONLY
|
|
@@ -39077,6 +39613,8 @@ async function runCompare(input, deps) {
|
|
|
39077
39613
|
data: {
|
|
39078
39614
|
...report,
|
|
39079
39615
|
...analytics ? { analytics: analytics.data } : {},
|
|
39616
|
+
...clicky ? { clicky: clicky.data } : {},
|
|
39617
|
+
...simpleAnalytics ? { simpleAnalytics: simpleAnalytics.data } : {},
|
|
39080
39618
|
googleUpdates: updates
|
|
39081
39619
|
}
|
|
39082
39620
|
};
|
|
@@ -39383,6 +39921,31 @@ function opportunityLines(site) {
|
|
|
39383
39921
|
" - Searches, CPC and intent are DataForSEO estimates, Domain Rating is by Ahrefs, fit with the site is a model classification and \"free tool\" is a guess from the words."
|
|
39384
39922
|
];
|
|
39385
39923
|
}
|
|
39924
|
+
const ENGINE_NAMES = {
|
|
39925
|
+
chatgpt: "ChatGPT search",
|
|
39926
|
+
google_ai_mode: "Google AI Mode",
|
|
39927
|
+
google_ai_overview: "AI Overviews"
|
|
39928
|
+
};
|
|
39929
|
+
function aiAnswerLines(site) {
|
|
39930
|
+
const found = site.ai_answers;
|
|
39931
|
+
if (!found) return [];
|
|
39932
|
+
if (found.blocked) return [`- AI answers: ${sentence(found.blocked)}`];
|
|
39933
|
+
if (!found.checked_at) return [];
|
|
39934
|
+
const day = (ms) => dayLabel(new Date(ms).toISOString().slice(0, 10));
|
|
39935
|
+
const { counts } = found;
|
|
39936
|
+
const answers = Object.values(counts).reduce((sum, n) => sum + n, 0);
|
|
39937
|
+
const unknown = [counts.unavailable ? `${count(counts.unavailable)} unavailable` : "", counts.pending ? `${count(counts.pending)} not ready yet` : ""].filter(Boolean);
|
|
39938
|
+
const engines = list(Object.values(ENGINE_NAMES));
|
|
39939
|
+
const lines = [`- AI answers, checked ${day(found.checked_at)}: ${plural$1(found.questions.length, "question")} from Search Console asked in ${engines}. Cited in ${count(counts.cited)} of ${plural$1(answers, "answer")}, mentioned by name in ${count(counts.mentioned)}, neither in ${count(counts.neither)}, no AI answer shown in ${count(counts.no_answer)}${unknown.length ? `, ${list(unknown)}` : ""}.`];
|
|
39940
|
+
if (found.previous_checked_at) {
|
|
39941
|
+
const shown = found.changes.slice(0, 10);
|
|
39942
|
+
const label = (result) => result.replace("_", " ");
|
|
39943
|
+
lines.push(shown.length ? ` - Changed since ${day(found.previous_checked_at)}:` : ` - No answer changed since ${day(found.previous_checked_at)}${counts.unavailable || counts.pending ? " among the ones known both weeks" : ""}.`, ...shown.map((change) => ` - "${change.question}" in ${ENGINE_NAMES[change.engine] ?? change.engine}: ${label(change.from)}, now ${label(change.to)}${change.cited_url ? ` (${change.cited_url})` : ""}.`), ...found.changes.length > shown.length ? [` - And ${plural$1(found.changes.length - shown.length, "more")}.`] : []);
|
|
39944
|
+
}
|
|
39945
|
+
if (found.cited_sites.length) lines.push(` - Sites cited instead: ${found.cited_sites.slice(0, 5).map((item) => `${item.host} (${item.answers})`).join(", ")}.`);
|
|
39946
|
+
lines.push(" - Each answer is one sample that can change from run to run, so one week’s change is not a trend.");
|
|
39947
|
+
return lines;
|
|
39948
|
+
}
|
|
39386
39949
|
function measuredLines(site) {
|
|
39387
39950
|
const found = site.measured;
|
|
39388
39951
|
if (!found?.total) return [];
|
|
@@ -39417,7 +39980,7 @@ function weekMarkdown(data) {
|
|
|
39417
39980
|
"",
|
|
39418
39981
|
attention.length ? total === 1 ? "Your site had changes worth a look this week." : `${attention.length} of your ${total} sites had changes worth a look this week.` : quiet.length ? total === 1 ? "Your site had a quiet week." : quiet.length === total ? `All ${total} of your sites had a quiet week.` : `${quiet.length} of your ${total} sites had a quiet week.` : "Your sites are still on their first checks."
|
|
39419
39982
|
];
|
|
39420
|
-
for (const { site, found } of rows) out.push("", `## ${siteName(site.property)}${found.length ? `: ${list(found.map((item) => item.heading))}` : ""}`, "", ...siteLines(site, startMs, endMs, data.first).map((line) => `- ${line}`), ...opportunityLines(site), ...measuredLines(site), ...updateLines(site), ...site.link ? [`- [View site](${site.link})`] : []);
|
|
39983
|
+
for (const { site, found } of rows) out.push("", `## ${siteName(site.property)}${found.length ? `: ${list(found.map((item) => item.heading))}` : ""}`, "", ...siteLines(site, startMs, endMs, data.first).map((line) => `- ${line}`), ...opportunityLines(site), ...aiAnswerLines(site), ...measuredLines(site), ...updateLines(site), ...site.link ? [`- [View site](${site.link})`] : []);
|
|
39421
39984
|
return out.join("\n");
|
|
39422
39985
|
}
|
|
39423
39986
|
async function runAllSites(deps, sites) {
|
|
@@ -39464,7 +40027,8 @@ const DATA_SOURCES = [
|
|
|
39464
40027
|
"search_console",
|
|
39465
40028
|
"google_analytics",
|
|
39466
40029
|
"bing",
|
|
39467
|
-
"clicky"
|
|
40030
|
+
"clicky",
|
|
40031
|
+
"simple_analytics"
|
|
39468
40032
|
];
|
|
39469
40033
|
function tool(spec) {
|
|
39470
40034
|
return spec;
|
|
@@ -39473,6 +40037,7 @@ const listSites$1 = async (surface) => runSites({
|
|
|
39473
40037
|
accounts: await surface.accounts(),
|
|
39474
40038
|
keys: await surface.keys(),
|
|
39475
40039
|
clicky: clickySites(await surface.keys()).map(clickyLabel),
|
|
40040
|
+
simpleAnalytics: Boolean(simpleAnalyticsKey(await surface.keys())),
|
|
39476
40041
|
signIn: surface.signIn,
|
|
39477
40042
|
bing: surface.deps.bing ? await surface.deps.bing() : void 0,
|
|
39478
40043
|
connect: surface.connect
|
|
@@ -39601,7 +40166,7 @@ const SHARED_TOOLS = [
|
|
|
39601
40166
|
name: "seo_compare",
|
|
39602
40167
|
command: "compare",
|
|
39603
40168
|
title: "Before and after a date",
|
|
39604
|
-
description: "Compares equal periods before and after a date, such as a site change or a Google update: totals, devices, and the pages and queries that moved, Google Analytics sessions from the property whose web stream matches the site, and Google updates in the window. Optional pages narrows it to URLs that contain that text, such as /blog/.",
|
|
40169
|
+
description: "Compares equal periods before and after a date, such as a site change or a Google update: totals, devices, and the pages and queries that moved, Google Analytics sessions from the property whose web stream matches the site, Clicky visits from a saved Clicky site with the same domain, Simple Analytics visitors when an API key is saved and it has the site, and Google updates in the window. Optional pages narrows it to URLs that contain that text, such as /blog/.",
|
|
39605
40170
|
input: z.object({
|
|
39606
40171
|
site,
|
|
39607
40172
|
date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("YYYY-MM-DD: the first day after the change."),
|
|
@@ -39611,7 +40176,7 @@ const SHARED_TOOLS = [
|
|
|
39611
40176
|
site: await surface.resolveSite(input.site),
|
|
39612
40177
|
date: input.date,
|
|
39613
40178
|
pages: input.pages
|
|
39614
|
-
}, surface.deps)
|
|
40179
|
+
}, surface.deps, await surface.keys())
|
|
39615
40180
|
}),
|
|
39616
40181
|
tool({
|
|
39617
40182
|
name: "seo_index",
|
|
@@ -39685,14 +40250,13 @@ const SHARED_TOOLS = [
|
|
|
39685
40250
|
name: "seo_data",
|
|
39686
40251
|
command: "data",
|
|
39687
40252
|
title: "Raw rows",
|
|
39688
|
-
description: `Raw rows for questions the report does not answer. search_console (default): rows for any dimensions, each with the previous period and the change; page and query narrow to rows whose URL or query contains that text;
|
|
40253
|
+
description: `Raw rows for questions the report does not answer. search_console (default): rows for any dimensions, each with the previous period and the change; page and query narrow to rows whose URL or query contains that text; page_regex, query_regex and exclude_query_regex take RE2 regexes for custom cuts. google_analytics: landing pages for visits from search, with Google Analytics’ own metric names. bing: Bing Webmaster query or page rows (first dimension) for the same site, by week. clicky: landing-page visits, traffic sources and search engines from a Clicky site the person saved (site is its domain or Clicky site ID; at most 31 days). simple_analytics: landing-page visitors, referrers, utm_source tags and AI tools from Simple Analytics with the API key the person saved (site is its domain).`,
|
|
39689
40254
|
input: z.object({
|
|
39690
40255
|
source: z.enum(DATA_SOURCES).default("search_console"),
|
|
39691
|
-
site: z.string().min(1).describe("search_console and bing: the property or site. google_analytics: numeric property id from seo_sites. clicky: the site or its Clicky site ID."),
|
|
40256
|
+
site: z.string().min(1).describe("search_console and bing: the property or site. google_analytics: numeric property id from seo_sites. clicky: the site or its Clicky site ID. simple_analytics: the site domain."),
|
|
39692
40257
|
dimensions: z.array(z.enum(DIMENSIONS)).max(4).default(["query"]).describe("search_console; bing uses the first, query or page."),
|
|
39693
40258
|
page: z.string().min(1).optional().describe("search_console only: URL text, such as /blog/."),
|
|
39694
40259
|
query: z.string().min(1).optional().describe("search_console only: query text."),
|
|
39695
|
-
query_preset: z.enum(QUERY_PRESET_NAMES).optional(),
|
|
39696
40260
|
page_regex: z.string().min(1).max(REGEX_MAX_CHARS).optional().describe("search_console only: RE2 the page URL must match."),
|
|
39697
40261
|
query_regex: z.string().min(1).max(REGEX_MAX_CHARS).optional().describe("search_console only: RE2 the query must match."),
|
|
39698
40262
|
exclude_query_regex: z.string().min(1).max(REGEX_MAX_CHARS).optional().describe("search_console only: RE2 for queries to leave out, such as the brand."),
|
|
@@ -39700,6 +40264,16 @@ const SHARED_TOOLS = [
|
|
|
39700
40264
|
...detail
|
|
39701
40265
|
}),
|
|
39702
40266
|
run: async (surface, input) => {
|
|
40267
|
+
if (input.source === "simple_analytics") return runSimpleAnalyticsRows({
|
|
40268
|
+
site: input.site,
|
|
40269
|
+
startDate: input.start_date,
|
|
40270
|
+
endDate: input.end_date,
|
|
40271
|
+
detail: input.detail,
|
|
40272
|
+
offset: input.offset
|
|
40273
|
+
}, await surface.keys(), {
|
|
40274
|
+
connect: surface.connect,
|
|
40275
|
+
call: (offset) => `seo_data with source "simple_analytics", site "${input.site}", detail "rows", offset ${offset}`
|
|
40276
|
+
});
|
|
39703
40277
|
if (input.source === "clicky") return runClickyRows({
|
|
39704
40278
|
site: input.site,
|
|
39705
40279
|
startDate: input.start_date,
|
|
@@ -39737,7 +40311,6 @@ const SHARED_TOOLS = [
|
|
|
39737
40311
|
query: input.query,
|
|
39738
40312
|
pageRegex: input.page_regex,
|
|
39739
40313
|
queryRegex: input.query_regex,
|
|
39740
|
-
queryPreset: input.query_preset,
|
|
39741
40314
|
excludeQueryRegex: input.exclude_query_regex
|
|
39742
40315
|
}),
|
|
39743
40316
|
startDate: input.start_date,
|
|
@@ -40030,6 +40603,35 @@ async function deleteDataForSeoCredentials() {
|
|
|
40030
40603
|
await deleteProviderSecret(DATAFORSEO_CREDENTIAL_SECRET);
|
|
40031
40604
|
clearLegacyConfigCredentials();
|
|
40032
40605
|
}
|
|
40606
|
+
// packages/core/src/simple-analytics/credentials.ts
|
|
40607
|
+
const SIMPLE_ANALYTICS_KEY_ENV = "SEO_SIMPLE_ANALYTICS_KEY";
|
|
40608
|
+
const SECRET = PROVIDER_SECRET_NAMES.simpleAnalyticsKey;
|
|
40609
|
+
function checked(value) {
|
|
40610
|
+
const key = value.trim();
|
|
40611
|
+
if (!isSimpleAnalyticsKey(key)) throw new ProviderError({
|
|
40612
|
+
provider: "simple-analytics",
|
|
40613
|
+
operation: "credentials",
|
|
40614
|
+
code: "configuration",
|
|
40615
|
+
message: "Simple Analytics needs an API key that starts with sa_api_key_ (Account settings, API keys)."
|
|
40616
|
+
});
|
|
40617
|
+
return key;
|
|
40618
|
+
}
|
|
40619
|
+
async function readSimpleAnalyticsKey() {
|
|
40620
|
+
const saved = await readProviderSecret({
|
|
40621
|
+
name: SECRET,
|
|
40622
|
+
envVar: SIMPLE_ANALYTICS_KEY_ENV
|
|
40623
|
+
});
|
|
40624
|
+
return saved ? {
|
|
40625
|
+
key: checked(saved.value),
|
|
40626
|
+
source: saved.source
|
|
40627
|
+
} : void 0;
|
|
40628
|
+
}
|
|
40629
|
+
async function writeSimpleAnalyticsKey(value) {
|
|
40630
|
+
return writeProviderSecret(SECRET, checked(value));
|
|
40631
|
+
}
|
|
40632
|
+
async function deleteSimpleAnalyticsKey() {
|
|
40633
|
+
await deleteProviderSecret(SECRET);
|
|
40634
|
+
}
|
|
40033
40635
|
// packages/core/src/storage/issues.ts
|
|
40034
40636
|
const issuesFile = () => join(getSeoCliPaths().configDir, "issues.json");
|
|
40035
40637
|
function readFile$1() {
|
|
@@ -40128,10 +40730,11 @@ async function localAccounts() {
|
|
|
40128
40730
|
}));
|
|
40129
40731
|
}
|
|
40130
40732
|
async function localResearchKeys() {
|
|
40131
|
-
const [dataForSeo, ahrefs, clicky, saved] = await Promise.all([
|
|
40733
|
+
const [dataForSeo, ahrefs, clicky, simpleAnalytics, saved] = await Promise.all([
|
|
40132
40734
|
readDataForSeoCredentials().catch(() => void 0),
|
|
40133
40735
|
readAhrefsApiKey().catch(() => void 0),
|
|
40134
40736
|
readClickySiteKeys().catch(() => ({})),
|
|
40737
|
+
readSimpleAnalyticsKey().catch(() => void 0),
|
|
40135
40738
|
cloudLinked() ? cloudKeys().catch(() => ({})) : {}
|
|
40136
40739
|
]);
|
|
40137
40740
|
const keys = new Headers(saved);
|
|
@@ -40144,6 +40747,7 @@ async function localResearchKeys() {
|
|
|
40144
40747
|
keys.set("x-dataforseo-password", dataForSeo.password);
|
|
40145
40748
|
}
|
|
40146
40749
|
if (ahrefs?.apiKey) keys.set("x-ahrefs-key", ahrefs.apiKey);
|
|
40750
|
+
if (simpleAnalytics) keys.set(SIMPLE_ANALYTICS_KEY, simpleAnalytics.key);
|
|
40147
40751
|
return keys;
|
|
40148
40752
|
}
|
|
40149
40753
|
const TYPESAFE_API_KEY_ENV = "TYPESAFE_API_KEY";
|
|
@@ -42735,6 +43339,6 @@ function isoDate(daysAgo = 0) {
|
|
|
42735
43339
|
date.setUTCDate(date.getUTCDate() - daysAgo);
|
|
42736
43340
|
return date.toISOString().slice(0, 10);
|
|
42737
43341
|
}
|
|
42738
|
-
export { AHREFS_API_KEY_ENV, AHREFS_API_KEY_SECRET, AI_REFERRAL_SOURCES, AI_REFERRAL_SOURCES_VERSION, ANALYTICS_PROVIDER_IDS, AUDIT_PAGE_RULE_IDS, AhrefsClient, BING_API_KEY_ENV, BING_API_KEY_SECRET, BROWSER_USER_AGENT, CANNIBAL_MAXIMUM_DOMINANT_SHARE, CANNIBAL_MINIMUM_PAGE_IMPRESSIONS, CANNIBAL_MINIMUM_PAGE_SHARE, CLICKY_SITEKEY_ENV, CLICKY_SITE_KEYS_SECRET, CLOUD_SIGN_IN, CLOUD_URL, CRAWL_SKIP_REASONS, CTR_DEFAULT_LIMIT, CTR_MAX_LIMIT, CTR_MAX_MIN_IMPRESSIONS, DATAFORSEO_CREDENTIAL_SECRET, DATAFORSEO_LOGIN_ENV, DATAFORSEO_PASSWORD_ENV, DEFAULT_MAX_PAGES, DEFAULT_SEARCH_CONSOLE_EXPORT_ROW_LIMIT, DEFAULT_UNREACHED_PAGE_LIMIT, DataForSeoClient, DecisionModelError, DecisionRunner, GOOGLE_TIMEOUT_MS, GSC_FINAL_DATA_LAG_DAYS, GSC_TIME_ZONE, GoogleApiError, INCIDENTS_URL, JsonFileStorageAdapter, LINK_ROLES, LINT_MAX_FILES, LOCAL_BING_CONNECT, LOCAL_SIGN_IN, LOG_MAX_AGE_MS, LOG_MAX_FILE_BYTES, LOG_MAX_TOTAL_BYTES, LocalCredentialsProvider, MANAGED_PROVIDER_SECRET_NAMES, MAX_CRAWL_CONCURRENCY, MAX_CRAWL_DEPTH, MAX_CRAWL_PAGES, MAX_CRAWL_TIMEOUT_MS, MAX_MAX_PAGES, MAX_SEARCH_CONSOLE_EXPORT_FILES, MAX_SEARCH_CONSOLE_EXPORT_ROW_LIMIT, PAGE_TYPES, PROVIDER_ERROR_CODES, PROVIDER_SECRET_NAMES, ProviderError, ProviderExtensionRegistry, RESEARCH_IMPORT_COLUMN_KEYS, ResponseSizeLimitError, SEARCH_INTENTS, SEO_CRAWLER_IDENTITY, SEO_CRAWLER_TOKEN, SEO_CRAWLER_USER_AGENT, SEO_PROVIDER_API_VERSION, SEO_VERSION, SERP_TITLE_REFERENCE_WIDTH_PX, SERP_TITLE_WIDTH_PROFILE, SITEMAP_FILE_URL_LIMIT, SITE_CHECK_MAX_ISSUES, SITE_CHECK_MAX_PAGES, SITE_FACTS_DEFAULT_CONCURRENCY, SITE_FACTS_MAX_CONCURRENCY, SITE_FACTS_MAX_SITES, SITE_FACTS_TIMEOUT_MS, STEP_CHANGE_RULES, SeoError, ServiceAccountAccessTokenClient, SessionLedger, TELEMETRY_AGENTS, TELEMETRY_ENDPOINT, TELEMETRY_ERROR_CATEGORIES, TELEMETRY_EVENTS, TELEMETRY_FAILURE_CONTEXTS, TELEMETRY_FAILURE_REASONS, TELEMETRY_NOTICE, TELEMETRY_OPERATIONS, TELEMETRY_REPORTS, TELEMETRY_SCHEMA_VERSION, TELEMETRY_TIMEOUT_MS, TYPESAFE_API_KEY_ENV, URL_INSPECTION_TIMEOUT_MS, agentActionsView, aiReferralSourceForValue, aiReferralsReport, analyticsConnectionLabel, analyticsConnectionProviderId, analyticsConnectionSchema, analyticsProviderDetails, analyticsProviderSchema, analyzeAiReferralRows, analyzeCannibalImportRows, analyzeCannibalRows, analyzeCtrUnderperformersFromRows, analyzeDecay, analyzeIndexCoverageSignals, analyzePageOpportunitiesFromRows, analyzeQueryClustersFromRows, analyzeQuickWinsFromRows, analyzeSecondPageRows, analyzeSegmentRows, analyzeStrikingDistanceRows, analyzeTrafficAnomalyRows, assertCrawlConfigLimits, assertUrlMatchesGscProperty, auditCrawlPages, auditCrawlRequests, auditPage, authStatus, bearerFetch, boundedSitemapInventory, buildAgentFindings, buildQueryClusterReportFromRows, buildTelemetryPayload, builtPagePath, cacheDb, cannibalDataStatus, cannibalImportReport, cannibalReport, cannibalReportWith, changeWindow, checkBuiltSite, checkDatabaseReadiness, checkSites, classifyTelemetryFailure, clearCache, cloudAccountFor, cloudBing, cloudCredentials, cloudGoogleEmails, cloudGoogleToken, cloudKeys, cloudLinked, cloudLogout, cloudWeek, clusterQueryRows, combineRobotsValues, compareSegmentRows, configSchema, contentCoverageRecommendation, contentCoverageType, contentOptimizationFromPageOpportunities, contentOptimizationReport, countLabel, crawlConfigHash, crawlConfigSchema, crawlCoverageCaveat, crawlDefinitionId, crawlFixToQueueItem, crawlImplementationQueueWorkflow, crawlIssueGroupSchema, crawlIssueSchema, crawlOne, crawlPageSnapshotSchema, crawlReportSchema, crawlReportSummarySchema, crawlRequestObservationSchema, crawlRunId, crawlSite, crawlSkipImpact, crawlSkipReasonCountsFromRecord, crawlStatusOnly, crawlTopFixSchema, crawlerJsonSchemas, crawlerRuleCategorySchema, crawlerRuleIdSchema, crawlerRuleInfoSchema, crawlerRuleRecommendationSchema, crawlerRuleSeveritySchema, crawlerSchemas, createAuthorizedClient, createCrawlReport, createCtrBenchmarkContext, createGoogleAccessTokenClient, createLogger, createPageRenderer, ctrUnderperformersReport, ctrUnderperformersReportWith, decayClusterDrafts, decayComparisonRange, decayingReport, decayingReportWith, deleteAhrefsApiKey, deleteBingApiKey, deleteClickySiteKey, deleteDataForSeoCredentials, deleteManagedProviderSecrets, deleteProviderExtensionAccount, deleteProviderExtensionCredentials, deleteProviderSecret, deleteTokens, deriveBrandTerms, describeInstalledProviderExtension, detectAgentName, detectBrandTerms, detectTelemetryAgent, diagnoseCsvFiles, diagnoseProperty, diagnosePropertyWorkflow, effectiveRobotsDirectives, effectiveSnippetControl, ensurePrivateDatabaseFiles, ensureSeoCliDirs, estimateSerpTitleWidth, expectedCtrForPosition, explainRule, fetchCruxFieldData, fetchFailureKind, fetchPage, fetchPageStatus, fetchSearchStatusIncidents, fetchSitemapUrls, fileSize, finalGscDateRange, findOverlappingSearchUpdates, finishCloudLogin, formatRelativeExpiry, ga4MatchReason, ga4PropertyIdFromName, ga4ReportQualityWarnings, ga4RequestCanUseCache, ga4RowsToObjects, getAuthModeStatus, getCacheStats, getClientConfig, getDb, getPrivacySnapshot, getSeoCliPaths, getServiceAccountConfig, getServiceAccountStatus, getTelemetryStatus, getTokenStorageStatus, googleJson, groupCrawlIssues, hasMetaRobotsDirective, hasRule, hasXRobotsDirective, hashKey, indexCoverageSignals, inferTemplateMovement, initializeTelemetry, inspectProviderPackage, inspectSearchConsoleUrl, inspectUrl, installProviderPackage, installedProviderPackageSchema, installedProviderPackagesSchema, installedProviderSerp, internalLinksReport, internalLinksReportWith, interpretUpdateCorrelation, isBrandQuery, isNewerVersion, isSkippableReportError, isTelemetryCi, isTelemetryOperation, isTelemetryReport, isoDate, isoWeek, latestFinalGscDate, linkRecover, linkRecoverRecommendation, lintPaths, listAnalyticsAccounts, listAnalyticsDataStreams, listGa4AccountSummaries, listGa4DataStreams, listGoogleAccounts, listInstalledProviderExtensions, listRules, listSearchConsoleSites, listSearchUpdates, listSites, loadInstalledProviderExtensions, loadProviderExtensions, loadProviderPackage, loadSearchConsoleExport, localAccounts, localBing, localCredentialsProvider, localError, localGoogleFetch, localInternalLinksDependencies, localRefreshClicky, localResearchKeys, localResearchStore, loginWithLoopback, makeRunId, matchGa4WebStreams, measureCoverage, metaRobotsDirectives, migrateLegacyMacConfig, missingOAuthClientMessage, missingSharedClientLoginMessage, nodeCommandDeps, normalizeBrandText, normalizeClickySiteId, normalizeClickySiteKey, normalizeCrawlConfig, normalizeCrawlSkipReasonCounts, normalizeForCoverage, normalizeHttpUrl, normalizeJavaScriptRenderingMode, normalizeLoadedCrawlReport, normalizeProviderExtensionAccount, normalizedResearchColumnName, notSignedIn, noteCacheWrite, openCloudLink, pageEvidenceRecommendation, pageOpportunitiesReport, parseOlderThan, pendingCloudLogin, performanceAudit, performanceReportIsCacheable, plural, providerCapabilitySchema, providerConnectionFieldSchema, providerExactVersionSchema, providerExtensionIdSchema, providerIdSchema, providerIntegritySchema, providerKindSchema, providerPackageManifestSchema, providerPackageNameSchema, providerPreferenceSchema, providerRegistrationSchema, providerRequestJson, providerRequestText, pruneLogs, publicHttpFetch, queryClusterReport, queryClusterTokens, queryContentCoverageFromPage, queryContentFieldsFromPage, queryFieldCoverage, queryOpportunityRecommendation, queryPageMetrics, queryPageTopQuery, queryPagesMetrics, queryPagesMetricsBatch, queryPagesTopQueries, queryPagesTopQueriesBatch, querySearchAnalytics, quickWinsCsvRows, quickWinsReport, quickWinsReportWith, readAhrefsApiKey, readAllTokens, readBingApiKey, readBoundedResponseText, readClickySiteKey, readClickySiteKeys, readConfig, readDataForSeoCredentials, readInstalledProviderPackages, readJson, readJsonOrUndefined, readLintFiles, readOauthClient, readProviderExtensionAccount, readProviderExtensionCredentials, readProviderSecret, readTokens, recommendationForRule, reconcileExportPagesWithCrawl, redirectTrace, refreshAuthToken, refreshPrioritiesCsvFiles, refreshPrioritiesWorkflow, registrableDomain, removeInstalledProviderPackage, renderCrawlCsv, renderCrawlHtml, renderCrawlJunit, renderCrawlMarkdownTickets, renderCrawlPagesCsv, renderCrawlPretty, renderCsv, renderPresentationTablesMarkdown, renderWorkflowMarkdown, reportNarrative, requestHeaders, requirePageVerification, researchImportColumns, resetSeoData, resolveLocalSite, resolveSegmentRanges, resolveSeoCliPaths, reviewObservations, roundedPosition, runAnalyticsProviderLandingPages, runAnalyticsReport, runDoctor, runGa4Report, runProviderExtensionAction, runtimeForProvider, safeProviderAdapterError, saveInstalledProviderPackage, searchAnalyticsRows, searchUpdatesFromIncidents, secondPage, secondPageWith, segmentComparisonRange, segmentImpact, segmentRangeDays, seoErrorEnvelope, sessionSourceInListFilter, setActiveGoogleAccount, setTelemetryEnabled, setTokenStorageMode, shiftIsoDate, shouldExcludeBrandQuery, siteStartUrl, snapshotFetchedPage, startCloudLogin, strikingDistance, strikingDistanceWith, summarizeCrawlReport, pageTechnicalSignals as technicalPageSignals, telemetryErrorCategory, toSeoError, tokenSchema, tokenStoreSchema, topFixes, trackTelemetryCommandFailed, trackTelemetryReportComplete, trackTelemetryReportFailed, trackTelemetryReportStart, trackTelemetrySetupComplete, trafficAnomaly, trafficAnomalyWith, typesafeDecisionModel, unavailableSegmentImpactReport, unicodeTokens, uninstallProviderExtension, updateCorrelation, updateNotice, updatePostmortemCsvFiles, updatePostmortemWorkflow, urlInspectionQuota, validateResearchImportColumnSources, verifyAnalyticsProvider, verifyProviderExtension, verifyQueryContent, verifyQueryContentWith, withAgentReportContract, withRankingHistory, withinGoogleTimeout, workflowPresentation, writeAhrefsApiKey, writeBingApiKey, writeClickySiteKey, writeConfig, writeDataForSeoCredentials, writeInstalledProviderPackages, writeOauthClient, writeProviderExtensionAccount, writeProviderExtensionCredentials, writeProviderSecret, writeToCache, writeTokens, xRobotsDirectives };
|
|
43342
|
+
export { AHREFS_API_KEY_ENV, AHREFS_API_KEY_SECRET, AI_REFERRAL_SOURCES, AI_REFERRAL_SOURCES_VERSION, ANALYTICS_PROVIDER_IDS, AUDIT_PAGE_RULE_IDS, AhrefsClient, BING_API_KEY_ENV, BING_API_KEY_SECRET, BROWSER_USER_AGENT, CANNIBAL_MAXIMUM_DOMINANT_SHARE, CANNIBAL_MINIMUM_PAGE_IMPRESSIONS, CANNIBAL_MINIMUM_PAGE_SHARE, CLICKY_SITEKEY_ENV, CLICKY_SITE_KEYS_SECRET, CLOUD_SIGN_IN, CLOUD_URL, CRAWL_SKIP_REASONS, CTR_DEFAULT_LIMIT, CTR_MAX_LIMIT, CTR_MAX_MIN_IMPRESSIONS, DATAFORSEO_CREDENTIAL_SECRET, DATAFORSEO_LOGIN_ENV, DATAFORSEO_PASSWORD_ENV, DEFAULT_MAX_PAGES, DEFAULT_SEARCH_CONSOLE_EXPORT_ROW_LIMIT, DEFAULT_UNREACHED_PAGE_LIMIT, DataForSeoClient, DecisionModelError, DecisionRunner, GOOGLE_TIMEOUT_MS, GSC_FINAL_DATA_LAG_DAYS, GSC_TIME_ZONE, GoogleApiError, INCIDENTS_URL, JsonFileStorageAdapter, LINK_ROLES, LINT_MAX_FILES, LOCAL_BING_CONNECT, LOCAL_SIGN_IN, LOG_MAX_AGE_MS, LOG_MAX_FILE_BYTES, LOG_MAX_TOTAL_BYTES, LocalCredentialsProvider, MANAGED_PROVIDER_SECRET_NAMES, MAX_CRAWL_CONCURRENCY, MAX_CRAWL_DEPTH, MAX_CRAWL_PAGES, MAX_CRAWL_TIMEOUT_MS, MAX_MAX_PAGES, MAX_SEARCH_CONSOLE_EXPORT_FILES, MAX_SEARCH_CONSOLE_EXPORT_ROW_LIMIT, PAGE_TYPES, PROVIDER_ERROR_CODES, PROVIDER_SECRET_NAMES, ProviderError, ProviderExtensionRegistry, RESEARCH_IMPORT_COLUMN_KEYS, ResponseSizeLimitError, SEARCH_INTENTS, SEO_CRAWLER_IDENTITY, SEO_CRAWLER_TOKEN, SEO_CRAWLER_USER_AGENT, SEO_PROVIDER_API_VERSION, SEO_VERSION, SERP_TITLE_REFERENCE_WIDTH_PX, SERP_TITLE_WIDTH_PROFILE, SIMPLE_ANALYTICS_KEY_ENV, SITEMAP_FILE_URL_LIMIT, SITE_CHECK_MAX_ISSUES, SITE_CHECK_MAX_PAGES, SITE_FACTS_DEFAULT_CONCURRENCY, SITE_FACTS_MAX_CONCURRENCY, SITE_FACTS_MAX_SITES, SITE_FACTS_TIMEOUT_MS, STEP_CHANGE_RULES, SeoError, ServiceAccountAccessTokenClient, SessionLedger, TELEMETRY_AGENTS, TELEMETRY_ENDPOINT, TELEMETRY_ERROR_CATEGORIES, TELEMETRY_EVENTS, TELEMETRY_FAILURE_CONTEXTS, TELEMETRY_FAILURE_REASONS, TELEMETRY_NOTICE, TELEMETRY_OPERATIONS, TELEMETRY_REPORTS, TELEMETRY_SCHEMA_VERSION, TELEMETRY_TIMEOUT_MS, TYPESAFE_API_KEY_ENV, URL_INSPECTION_TIMEOUT_MS, agentActionsView, aiReferralSourceForValue, aiReferralsReport, analyticsConnectionLabel, analyticsConnectionProviderId, analyticsConnectionSchema, analyticsProviderDetails, analyticsProviderSchema, analyzeAiReferralRows, analyzeCannibalImportRows, analyzeCannibalRows, analyzeCtrUnderperformersFromRows, analyzeDecay, analyzeIndexCoverageSignals, analyzePageOpportunitiesFromRows, analyzeQueryClustersFromRows, analyzeQuickWinsFromRows, analyzeSecondPageRows, analyzeSegmentRows, analyzeStrikingDistanceRows, analyzeTrafficAnomalyRows, assertCrawlConfigLimits, assertUrlMatchesGscProperty, auditCrawlPages, auditCrawlRequests, auditPage, authStatus, bearerFetch, boundedSitemapInventory, buildAgentFindings, buildQueryClusterReportFromRows, buildTelemetryPayload, builtPagePath, cacheDb, cannibalDataStatus, cannibalImportReport, cannibalReport, cannibalReportWith, changeWindow, checkBuiltSite, checkDatabaseReadiness, checkSites, classifyTelemetryFailure, clearCache, cloudAccountFor, cloudBing, cloudCredentials, cloudGoogleEmails, cloudGoogleToken, cloudKeys, cloudLinked, cloudLogout, cloudWeek, clusterQueryRows, combineRobotsValues, compareSegmentRows, configSchema, contentCoverageRecommendation, contentCoverageType, contentOptimizationFromPageOpportunities, contentOptimizationReport, countLabel, crawlConfigHash, crawlConfigSchema, crawlCoverageCaveat, crawlDefinitionId, crawlFixToQueueItem, crawlImplementationQueueWorkflow, crawlIssueGroupSchema, crawlIssueSchema, crawlOne, crawlPageSnapshotSchema, crawlReportSchema, crawlReportSummarySchema, crawlRequestObservationSchema, crawlRunId, crawlSite, crawlSkipImpact, crawlSkipReasonCountsFromRecord, crawlStatusOnly, crawlTopFixSchema, crawlerJsonSchemas, crawlerRuleCategorySchema, crawlerRuleIdSchema, crawlerRuleInfoSchema, crawlerRuleRecommendationSchema, crawlerRuleSeveritySchema, crawlerSchemas, createAuthorizedClient, createCrawlReport, createCtrBenchmarkContext, createGoogleAccessTokenClient, createLogger, createPageRenderer, ctrUnderperformersReport, ctrUnderperformersReportWith, decayClusterDrafts, decayComparisonRange, decayingReport, decayingReportWith, deleteAhrefsApiKey, deleteBingApiKey, deleteClickySiteKey, deleteDataForSeoCredentials, deleteManagedProviderSecrets, deleteProviderExtensionAccount, deleteProviderExtensionCredentials, deleteProviderSecret, deleteSimpleAnalyticsKey, deleteTokens, deriveBrandTerms, describeInstalledProviderExtension, detectAgentName, detectBrandTerms, detectTelemetryAgent, diagnoseCsvFiles, diagnoseProperty, diagnosePropertyWorkflow, effectiveRobotsDirectives, effectiveSnippetControl, ensurePrivateDatabaseFiles, ensureSeoCliDirs, estimateSerpTitleWidth, expectedCtrForPosition, explainRule, fetchCruxFieldData, fetchFailureKind, fetchPage, fetchPageStatus, fetchSearchStatusIncidents, fetchSitemapUrls, fileSize, finalGscDateRange, findOverlappingSearchUpdates, finishCloudLogin, formatRelativeExpiry, ga4MatchReason, ga4PropertyIdFromName, ga4ReportQualityWarnings, ga4RequestCanUseCache, ga4RowsToObjects, getAuthModeStatus, getCacheStats, getClientConfig, getDb, getPrivacySnapshot, getSeoCliPaths, getServiceAccountConfig, getServiceAccountStatus, getTelemetryStatus, getTokenStorageStatus, googleJson, groupCrawlIssues, hasMetaRobotsDirective, hasRule, hasXRobotsDirective, hashKey, indexCoverageSignals, inferTemplateMovement, initializeTelemetry, inspectProviderPackage, inspectSearchConsoleUrl, inspectUrl, installProviderPackage, installedProviderPackageSchema, installedProviderPackagesSchema, installedProviderSerp, internalLinksReport, internalLinksReportWith, interpretUpdateCorrelation, isBrandQuery, isNewerVersion, isSkippableReportError, isTelemetryCi, isTelemetryOperation, isTelemetryReport, isoDate, isoWeek, latestFinalGscDate, linkRecover, linkRecoverRecommendation, lintPaths, listAnalyticsAccounts, listAnalyticsDataStreams, listGa4AccountSummaries, listGa4DataStreams, listGoogleAccounts, listInstalledProviderExtensions, listRules, listSearchConsoleSites, listSearchUpdates, listSites, loadInstalledProviderExtensions, loadProviderExtensions, loadProviderPackage, loadSearchConsoleExport, localAccounts, localBing, localCredentialsProvider, localError, localGoogleFetch, localInternalLinksDependencies, localRefreshClicky, localResearchKeys, localResearchStore, loginWithLoopback, makeRunId, matchGa4WebStreams, measureCoverage, metaRobotsDirectives, migrateLegacyMacConfig, missingOAuthClientMessage, missingSharedClientLoginMessage, nodeCommandDeps, normalizeBrandText, normalizeClickySiteId, normalizeClickySiteKey, normalizeCrawlConfig, normalizeCrawlSkipReasonCounts, normalizeForCoverage, normalizeHttpUrl, normalizeJavaScriptRenderingMode, normalizeLoadedCrawlReport, normalizeProviderExtensionAccount, normalizedResearchColumnName, notSignedIn, noteCacheWrite, openCloudLink, pageEvidenceRecommendation, pageOpportunitiesReport, parseOlderThan, pendingCloudLogin, performanceAudit, performanceReportIsCacheable, plural, providerCapabilitySchema, providerConnectionFieldSchema, providerExactVersionSchema, providerExtensionIdSchema, providerIdSchema, providerIntegritySchema, providerKindSchema, providerPackageManifestSchema, providerPackageNameSchema, providerPreferenceSchema, providerRegistrationSchema, providerRequestJson, providerRequestText, pruneLogs, publicHttpFetch, queryClusterReport, queryClusterTokens, queryContentCoverageFromPage, queryContentFieldsFromPage, queryFieldCoverage, queryOpportunityRecommendation, queryPageMetrics, queryPageTopQuery, queryPagesMetrics, queryPagesMetricsBatch, queryPagesTopQueries, queryPagesTopQueriesBatch, querySearchAnalytics, quickWinsCsvRows, quickWinsReport, quickWinsReportWith, readAhrefsApiKey, readAllTokens, readBingApiKey, readBoundedResponseText, readClickySiteKey, readClickySiteKeys, readConfig, readDataForSeoCredentials, readInstalledProviderPackages, readJson, readJsonOrUndefined, readLintFiles, readOauthClient, readProviderExtensionAccount, readProviderExtensionCredentials, readProviderSecret, readSimpleAnalyticsKey, readTokens, recommendationForRule, reconcileExportPagesWithCrawl, redirectTrace, refreshAuthToken, refreshPrioritiesCsvFiles, refreshPrioritiesWorkflow, registrableDomain, removeInstalledProviderPackage, renderCrawlCsv, renderCrawlHtml, renderCrawlJunit, renderCrawlMarkdownTickets, renderCrawlPagesCsv, renderCrawlPretty, renderCsv, renderPresentationTablesMarkdown, renderWorkflowMarkdown, reportNarrative, requestHeaders, requirePageVerification, researchImportColumns, resetSeoData, resolveLocalSite, resolveSegmentRanges, resolveSeoCliPaths, reviewObservations, roundedPosition, runAnalyticsProviderLandingPages, runAnalyticsReport, runDoctor, runGa4Report, runProviderExtensionAction, runtimeForProvider, safeProviderAdapterError, saveInstalledProviderPackage, searchAnalyticsRows, searchUpdatesFromIncidents, secondPage, secondPageWith, segmentComparisonRange, segmentImpact, segmentRangeDays, seoErrorEnvelope, sessionSourceInListFilter, setActiveGoogleAccount, setTelemetryEnabled, setTokenStorageMode, shiftIsoDate, shouldExcludeBrandQuery, siteStartUrl, snapshotFetchedPage, startCloudLogin, strikingDistance, strikingDistanceWith, summarizeCrawlReport, pageTechnicalSignals as technicalPageSignals, telemetryErrorCategory, toSeoError, tokenSchema, tokenStoreSchema, topFixes, trackTelemetryCommandFailed, trackTelemetryReportComplete, trackTelemetryReportFailed, trackTelemetryReportStart, trackTelemetrySetupComplete, trafficAnomaly, trafficAnomalyWith, typesafeDecisionModel, unavailableSegmentImpactReport, unicodeTokens, uninstallProviderExtension, updateCorrelation, updateNotice, updatePostmortemCsvFiles, updatePostmortemWorkflow, urlInspectionQuota, validateResearchImportColumnSources, verifyAnalyticsProvider, verifyProviderExtension, verifyQueryContent, verifyQueryContentWith, withAgentReportContract, withRankingHistory, withinGoogleTimeout, workflowPresentation, writeAhrefsApiKey, writeBingApiKey, writeClickySiteKey, writeConfig, writeDataForSeoCredentials, writeInstalledProviderPackages, writeOauthClient, writeProviderExtensionAccount, writeProviderExtensionCredentials, writeProviderSecret, writeSimpleAnalyticsKey, writeToCache, writeTokens, xRobotsDirectives };
|
|
42739
43343
|
|
|
42740
43344
|
//# sourceMappingURL=index.js.map
|