@ainyc/canonry 3.3.8 → 3.3.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/dist/cli.js +66 -3
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -5206,6 +5206,48 @@ function formatNumber(value) {
|
|
|
5206
5206
|
if (Math.abs(value) >= 1e3) return `${(value / 1e3).toFixed(1)}K`;
|
|
5207
5207
|
return value.toLocaleString("en-US");
|
|
5208
5208
|
}
|
|
5209
|
+
function summarizeQueryParams(params) {
|
|
5210
|
+
const keys = Array.from(params.keys());
|
|
5211
|
+
const total = keys.length;
|
|
5212
|
+
if (total === 0) return "";
|
|
5213
|
+
const noun = total === 1 ? "param" : "params";
|
|
5214
|
+
const tag = inferAdSource(params);
|
|
5215
|
+
return tag ? `${tag} \xB7 ${total} ${noun}` : `${total} tracking ${noun}`;
|
|
5216
|
+
}
|
|
5217
|
+
function inferAdSource(params) {
|
|
5218
|
+
if (params.has("fbclid")) return "Facebook Ad";
|
|
5219
|
+
if (params.has("gclid") || params.has("gbraid") || params.has("wbraid")) return "Google Ad";
|
|
5220
|
+
if (params.has("msclkid")) return "Microsoft Ad";
|
|
5221
|
+
if (params.has("ttclid")) return "TikTok Ad";
|
|
5222
|
+
if (params.has("li_fat_id")) return "LinkedIn Ad";
|
|
5223
|
+
if (params.has("twclid")) return "X / Twitter Ad";
|
|
5224
|
+
if (params.has("epik")) return "Pinterest Ad";
|
|
5225
|
+
for (const k of params.keys()) {
|
|
5226
|
+
if (k.startsWith("hsa_")) return "Search Ad";
|
|
5227
|
+
}
|
|
5228
|
+
const src = params.get("utm_source");
|
|
5229
|
+
const med = params.get("utm_medium");
|
|
5230
|
+
if (src && med) return `${src} / ${med}`;
|
|
5231
|
+
if (src) return `Source: ${src}`;
|
|
5232
|
+
if (med) return `Medium: ${med}`;
|
|
5233
|
+
return null;
|
|
5234
|
+
}
|
|
5235
|
+
function formatLandingPageHtml(raw) {
|
|
5236
|
+
const value = raw ?? "";
|
|
5237
|
+
const queryIdx = value.indexOf("?");
|
|
5238
|
+
const path10 = queryIdx === -1 ? value : value.slice(0, queryIdx);
|
|
5239
|
+
const query = queryIdx === -1 ? "" : value.slice(queryIdx + 1);
|
|
5240
|
+
const pathHtml = `<span class="page-path">${escapeHtml(path10 || "/")}</span>`;
|
|
5241
|
+
if (!query) return pathHtml;
|
|
5242
|
+
let summary = "";
|
|
5243
|
+
try {
|
|
5244
|
+
summary = summarizeQueryParams(new URLSearchParams(query));
|
|
5245
|
+
} catch {
|
|
5246
|
+
summary = "tracking params";
|
|
5247
|
+
}
|
|
5248
|
+
if (!summary) return pathHtml;
|
|
5249
|
+
return `${pathHtml}<span class="page-query" title="${escapeHtml(value)}">${escapeHtml(summary)}</span>`;
|
|
5250
|
+
}
|
|
5209
5251
|
function formatDate(iso) {
|
|
5210
5252
|
if (!iso) return "\u2014";
|
|
5211
5253
|
try {
|
|
@@ -5344,6 +5386,9 @@ table.report-table th, table.report-table td {
|
|
|
5344
5386
|
text-align: left;
|
|
5345
5387
|
padding: 10px 12px;
|
|
5346
5388
|
border-bottom: 1px solid ${COLORS.border};
|
|
5389
|
+
vertical-align: top;
|
|
5390
|
+
overflow-wrap: anywhere;
|
|
5391
|
+
word-break: break-word;
|
|
5347
5392
|
}
|
|
5348
5393
|
table.report-table th {
|
|
5349
5394
|
font-weight: 600;
|
|
@@ -5352,7 +5397,25 @@ table.report-table th {
|
|
|
5352
5397
|
letter-spacing: 0.06em;
|
|
5353
5398
|
font-size: 10px;
|
|
5354
5399
|
}
|
|
5355
|
-
table.report-table td.numeric { text-align: right; font-variant-numeric: tabular-nums; }
|
|
5400
|
+
table.report-table td.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
5401
|
+
table.report-table td.page-cell { max-width: 0; }
|
|
5402
|
+
table.report-table td.page-cell .page-path {
|
|
5403
|
+
display: block;
|
|
5404
|
+
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
|
|
5405
|
+
font-size: 12px;
|
|
5406
|
+
color: ${COLORS.text};
|
|
5407
|
+
}
|
|
5408
|
+
table.report-table td.page-cell .page-query {
|
|
5409
|
+
display: inline-block;
|
|
5410
|
+
margin-top: 4px;
|
|
5411
|
+
padding: 1px 8px;
|
|
5412
|
+
font-size: 11px;
|
|
5413
|
+
color: ${COLORS.textMuted};
|
|
5414
|
+
background: ${COLORS.surface};
|
|
5415
|
+
border: 1px solid ${COLORS.border};
|
|
5416
|
+
border-radius: 999px;
|
|
5417
|
+
cursor: help;
|
|
5418
|
+
}
|
|
5356
5419
|
table.report-table td .badge {
|
|
5357
5420
|
display: inline-block;
|
|
5358
5421
|
padding: 2px 8px;
|
|
@@ -5774,7 +5837,7 @@ function renderGa(report) {
|
|
|
5774
5837
|
}
|
|
5775
5838
|
const pageRows = ga.topLandingPages.map((p) => `
|
|
5776
5839
|
<tr>
|
|
5777
|
-
<td>${
|
|
5840
|
+
<td class="page-cell">${formatLandingPageHtml(p.page)}</td>
|
|
5778
5841
|
<td class="numeric">${formatNumber(p.sessions)}</td>
|
|
5779
5842
|
<td class="numeric">${formatNumber(p.users)}</td>
|
|
5780
5843
|
<td class="numeric">${formatNumber(p.organicSessions)}</td>
|
|
@@ -5864,7 +5927,7 @@ function renderAiReferrals(report) {
|
|
|
5864
5927
|
</tr>`).join("");
|
|
5865
5928
|
const pageRows = ai.topLandingPages.map((p) => `
|
|
5866
5929
|
<tr>
|
|
5867
|
-
<td>${
|
|
5930
|
+
<td class="page-cell">${formatLandingPageHtml(p.page)}</td>
|
|
5868
5931
|
<td class="numeric">${formatNumber(p.sessions)}</td>
|
|
5869
5932
|
<td class="numeric">${formatNumber(p.users)}</td>
|
|
5870
5933
|
</tr>`).join("");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainyc/canonry",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Agent-first open-source AEO operating platform - track how answer engines cite your domain",
|
|
6
6
|
"license": "FSL-1.1-ALv2",
|
|
@@ -59,16 +59,16 @@
|
|
|
59
59
|
"@types/node-cron": "^3.0.11",
|
|
60
60
|
"tsup": "^8.5.1",
|
|
61
61
|
"tsx": "^4.19.0",
|
|
62
|
-
"@ainyc/canonry-config": "0.0.0",
|
|
63
62
|
"@ainyc/canonry-api-routes": "0.0.0",
|
|
64
63
|
"@ainyc/canonry-contracts": "0.0.0",
|
|
65
|
-
"@ainyc/canonry-intelligence": "0.0.0",
|
|
66
64
|
"@ainyc/canonry-db": "0.0.0",
|
|
67
|
-
"@ainyc/canonry-integration-commoncrawl": "0.0.0",
|
|
68
65
|
"@ainyc/canonry-integration-bing": "0.0.0",
|
|
69
|
-
"@ainyc/canonry-
|
|
66
|
+
"@ainyc/canonry-config": "0.0.0",
|
|
67
|
+
"@ainyc/canonry-intelligence": "0.0.0",
|
|
68
|
+
"@ainyc/canonry-integration-commoncrawl": "0.0.0",
|
|
70
69
|
"@ainyc/canonry-integration-wordpress": "0.0.0",
|
|
71
70
|
"@ainyc/canonry-provider-cdp": "0.0.0",
|
|
71
|
+
"@ainyc/canonry-integration-google": "0.0.0",
|
|
72
72
|
"@ainyc/canonry-provider-claude": "0.0.0",
|
|
73
73
|
"@ainyc/canonry-provider-gemini": "0.0.0",
|
|
74
74
|
"@ainyc/canonry-provider-local": "0.0.0",
|