@canonry/canonry 7.50.0 → 7.51.0
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/assets/agent-workspace/skills/canonry/references/canonry-cli.md +10 -4
- package/assets/assets/{AuditHistoryPanel-CX61JUTX.js → AuditHistoryPanel-wdUF2gRW.js} +1 -1
- package/assets/assets/{BacklinksPage-DqnhCPLf.js → BacklinksPage-CJY1OPYR.js} +1 -1
- package/assets/assets/{ChartPrimitives-CZ4wVBJL.js → ChartPrimitives-B6ryduMN.js} +1 -1
- package/assets/assets/{HistoryPage-rRFCtFL5.js → HistoryPage-BuJ6rkxQ.js} +1 -1
- package/assets/assets/{MeasurementPropertyPage-CfIZVKgg.js → MeasurementPropertyPage-B2L33Gl3.js} +3 -3
- package/assets/assets/ProjectPage-26oduSKK.js +8 -0
- package/assets/assets/RunsPage-BLflXqnd.js +1 -0
- package/assets/assets/{SettingsPage-098-3JC1.js → SettingsPage-Dh5p6mPo.js} +1 -1
- package/assets/assets/{SiteHealthSection-CfcQYuwU.js → SiteHealthSection-ulXVd0QR.js} +3 -3
- package/assets/assets/{TrafficPage-Bl6INnLT.js → TrafficPage-DKn4SB01.js} +3 -3
- package/assets/assets/{TrafficSourceDetailPage-Bu_0hPCZ.js → TrafficSourceDetailPage-Ew3DvkC2.js} +1 -1
- package/assets/assets/{extract-error-message-Dp43pOCs.js → extract-error-message-Bqp9rHty.js} +1 -1
- package/assets/assets/{index-Bll2LqWk.css → index-Br2WtEIO.css} +1 -1
- package/assets/assets/{index-je69pgAK.js → index-CKxYUKlD.js} +26 -26
- package/assets/assets/{react-sigma_core.esm.min-DFuzq2Lx.js → react-sigma_core.esm.min-CmQ0UJ-q.js} +1 -1
- package/assets/assets/{v2-overview-adapter-CjEkLZwJ.js → v2-overview-adapter-P6JaB0ii.js} +1 -1
- package/assets/assets/{vendor-recharts-D-cUuLZo.js → vendor-recharts-D_R6YxjS.js} +1 -1
- package/assets/index.html +3 -3
- package/dist/{chunk-CS4POCLI.js → chunk-2SWNW5O6.js} +2 -2
- package/dist/{chunk-5KCJQO4I.js → chunk-5ZYVREGG.js} +1 -1
- package/dist/{chunk-NVKQVQ3C.js → chunk-77T24PPR.js} +2348 -2162
- package/dist/{chunk-NPYNNEFP.js → chunk-CNBKVUMJ.js} +3 -3
- package/dist/{chunk-JPFZ4CXQ.js → chunk-GG6ECPAO.js} +2 -2
- package/dist/{chunk-AKDSQTHE.js → chunk-IKIAETMK.js} +1 -1
- package/dist/{chunk-74NFXXD2.js → chunk-T4EXTQQK.js} +36 -9
- package/dist/{chunk-U2GU6MAC.js → chunk-UJLIMXPX.js} +253 -72
- package/dist/{chunk-WMYDLP4K.js → chunk-WTATIC3M.js} +6 -6
- package/dist/{chunk-P6KH6N4Z.js → chunk-ZKIUO7RY.js} +3 -3
- package/dist/{cli-catalog-NJPHC55G.js → cli-catalog-MGEBTBSU.js} +3 -3
- package/dist/cli-commands-D5TBJLXO.js +15 -0
- package/dist/cli.js +10 -10
- package/dist/{demo-server-CX2FZGR5.js → demo-server-GJD7I6FS.js} +86 -5
- package/dist/index.js +6 -6
- package/dist/{intelligence-service-6INMSEAQ.js → intelligence-service-COKNG64A.js} +2 -2
- package/dist/mcp.js +4 -4
- package/package.json +14 -14
- package/assets/assets/ProjectPage-DU88Joxp.js +0 -8
- package/assets/assets/RunsPage-B3NIVoWb.js +0 -1
- package/dist/cli-commands-LCP2I6IP.js +0 -15
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
installSkills,
|
|
5
5
|
loadConfigRaw,
|
|
6
6
|
saveConfigPatch
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2SWNW5O6.js";
|
|
8
8
|
import {
|
|
9
9
|
PACKAGE_VERSION
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5ZYVREGG.js";
|
|
11
11
|
import {
|
|
12
12
|
SKILL_MANIFEST_FILENAME,
|
|
13
13
|
SkillsClients
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-77T24PPR.js";
|
|
15
15
|
|
|
16
16
|
// src/skills-autosync.ts
|
|
17
17
|
import fs from "fs";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
siteCrawlGraphNodes,
|
|
6
6
|
siteCrawlPages,
|
|
7
7
|
siteCrawlSnapshots
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UJLIMXPX.js";
|
|
9
9
|
import {
|
|
10
10
|
SITE_CRAWL_GRAPH_MAX_EDGES,
|
|
11
11
|
SITE_CRAWL_GRAPH_MAX_NODES,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
factorStatusFromDistribution,
|
|
16
16
|
factorStatusFromScore,
|
|
17
17
|
roundPreservingTotal
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-77T24PPR.js";
|
|
19
19
|
|
|
20
20
|
// src/site-audit-factors.ts
|
|
21
21
|
function recordedSharePct(factor) {
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
trackFeatureCompleted,
|
|
32
32
|
trackIntegrationConnection,
|
|
33
33
|
waitForServerRuntimeStartup
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-WTATIC3M.js";
|
|
35
35
|
import {
|
|
36
36
|
clearDashboardPassword,
|
|
37
37
|
configExists,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
saveConfigPatch,
|
|
51
51
|
shouldPrintServeSkillsNudge,
|
|
52
52
|
withBootstrapProviderDefaults
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-2SWNW5O6.js";
|
|
54
54
|
import {
|
|
55
55
|
emitJsonl,
|
|
56
56
|
getBoolean,
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
resolveCliAccess,
|
|
65
65
|
stringOption,
|
|
66
66
|
unknownSubcommand
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-IKIAETMK.js";
|
|
68
68
|
import {
|
|
69
69
|
DEFAULT_DEMO_TRUSTED_PROXIES,
|
|
70
70
|
trustedProxiesProblem,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
resolveDiscoveredGscSitemapUrls,
|
|
78
78
|
runMeasurementDraftAction,
|
|
79
79
|
submitGscSitemapBatches
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-5ZYVREGG.js";
|
|
81
81
|
import {
|
|
82
82
|
CANONRY_DISCORD_URL,
|
|
83
83
|
CANONRY_ISSUES_URL,
|
|
@@ -122,7 +122,7 @@ import {
|
|
|
122
122
|
rawEventSamples,
|
|
123
123
|
readMarketCompetitorNames,
|
|
124
124
|
runs
|
|
125
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-UJLIMXPX.js";
|
|
126
126
|
import {
|
|
127
127
|
AdsDeliverySnapshotStatuses,
|
|
128
128
|
AdsHistoricalCampaignRollupStatuses,
|
|
@@ -278,7 +278,7 @@ import {
|
|
|
278
278
|
visibilityCompareSelectionSchema,
|
|
279
279
|
visibilityReportRequestSchema,
|
|
280
280
|
winnabilityClassSchema
|
|
281
|
-
} from "./chunk-
|
|
281
|
+
} from "./chunk-77T24PPR.js";
|
|
282
282
|
|
|
283
283
|
// src/cli-commands/sentiment.ts
|
|
284
284
|
import "zod";
|
|
@@ -586,7 +586,7 @@ function parseDemoTrustedProxies(values) {
|
|
|
586
586
|
async function demoCommand(options) {
|
|
587
587
|
const { host, port } = parseDemoListenOptions(options);
|
|
588
588
|
const trustProxy = parseDemoTrustedProxies(options.trustProxy);
|
|
589
|
-
const { createDemoServer } = await import("./demo-server-
|
|
589
|
+
const { createDemoServer } = await import("./demo-server-GJD7I6FS.js");
|
|
590
590
|
const app = await createDemoServer({ trustProxy });
|
|
591
591
|
let stopping = false;
|
|
592
592
|
const stop = () => {
|
|
@@ -1000,7 +1000,7 @@ No DB writes performed. Re-run without --dry-run to apply.`);
|
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
1002
|
async function backfillInsightsCommand(project2, opts) {
|
|
1003
|
-
const { IntelligenceService } = await import("./intelligence-service-
|
|
1003
|
+
const { IntelligenceService } = await import("./intelligence-service-COKNG64A.js");
|
|
1004
1004
|
const config = loadConfig();
|
|
1005
1005
|
const db = createClient(config.database);
|
|
1006
1006
|
migrate(db);
|
|
@@ -5462,6 +5462,9 @@ async function gaTraffic(project2, opts) {
|
|
|
5462
5462
|
}
|
|
5463
5463
|
}
|
|
5464
5464
|
console.log();
|
|
5465
|
+
if ((result.aiEngines?.length ?? 0) > 0) {
|
|
5466
|
+
printReferralGroups("AI REFERRALS BY ENGINE", "ENGINE", result.aiEngines);
|
|
5467
|
+
}
|
|
5465
5468
|
if (result.aiReferrals.length > 0) {
|
|
5466
5469
|
const attrWidth = 12;
|
|
5467
5470
|
const classWidth = 8;
|
|
@@ -5496,6 +5499,13 @@ async function gaTraffic(project2, opts) {
|
|
|
5496
5499
|
const chanWidth = 12;
|
|
5497
5500
|
if (result.socialSessions > 0) {
|
|
5498
5501
|
console.log(` Social Sessions: ${result.socialSessions} (${result.socialSharePctDisplay} of total)`);
|
|
5502
|
+
if ((result.paidSocialSessions ?? 0) > 0) {
|
|
5503
|
+
console.log(` Paid Social: ${result.paidSocialSessions} (${formatPercent(result.paidSocialShare)} of social)`);
|
|
5504
|
+
}
|
|
5505
|
+
console.log();
|
|
5506
|
+
}
|
|
5507
|
+
if ((result.socialPlatforms?.length ?? 0) > 0) {
|
|
5508
|
+
printReferralGroups("SOCIAL PLATFORMS", "PLATFORM", result.socialPlatforms);
|
|
5499
5509
|
}
|
|
5500
5510
|
console.log(" SOCIAL REFERRAL SOURCES");
|
|
5501
5511
|
console.log(` ${"SOURCE".padEnd(25)} ${"MEDIUM".padEnd(15)} ${"CHANNEL".padEnd(chanWidth)} ${"SESSIONS".padEnd(10)} SHARE`);
|
|
@@ -5637,6 +5647,19 @@ async function gaAiReferralHistory(project2, opts) {
|
|
|
5637
5647
|
);
|
|
5638
5648
|
}
|
|
5639
5649
|
}
|
|
5650
|
+
function printReferralGroups(heading, column, groups) {
|
|
5651
|
+
const labelWidth = Math.min(30, Math.max(column.length, ...groups.map((group) => group.label.length)));
|
|
5652
|
+
console.log(` ${heading}`);
|
|
5653
|
+
console.log(` ${column.padEnd(labelWidth)} ${"SESSIONS".padEnd(10)}${"ORGANIC".padEnd(9)}${"PAID".padEnd(8)}${"SHARE".padEnd(8)}SOURCES`);
|
|
5654
|
+
console.log(` ${"\u2500".repeat(labelWidth)} ${"\u2500".repeat(10)}${"\u2500".repeat(9)}${"\u2500".repeat(8)}${"\u2500".repeat(8)}${"\u2500".repeat(7)}`);
|
|
5655
|
+
for (const group of groups) {
|
|
5656
|
+
const label = group.label.length > labelWidth ? group.label.slice(0, labelWidth - 3) + "..." : group.label;
|
|
5657
|
+
console.log(
|
|
5658
|
+
` ${label.padEnd(labelWidth)} ${String(group.sessions).padEnd(10)}${String(group.organicSessions).padEnd(9)}${String(group.paidSessions).padEnd(8)}${formatPercent(group.share).padEnd(8)}${group.sources.length}`
|
|
5659
|
+
);
|
|
5660
|
+
}
|
|
5661
|
+
console.log();
|
|
5662
|
+
}
|
|
5640
5663
|
async function gaAiReferralDaily(project2, opts) {
|
|
5641
5664
|
const client = getClient7();
|
|
5642
5665
|
const result = await client.gaAiReferralDaily(project2, rangeParams(opts));
|
|
@@ -5666,6 +5689,10 @@ async function gaAiReferralDaily(project2, opts) {
|
|
|
5666
5689
|
}
|
|
5667
5690
|
console.log(`
|
|
5668
5691
|
Total: ${result.totalSessions} sessions (${result.totalPaidSessions} paid, ${result.totalOrganicSessions} organic)`);
|
|
5692
|
+
if (result.byEngine && result.byEngine.series.length > 0) {
|
|
5693
|
+
const folded = result.byEngine.otherCount > 0 ? ` (Other folds ${result.byEngine.otherCount})` : "";
|
|
5694
|
+
console.log(` By engine${folded}: ${result.byEngine.series.map((series) => `${series.label} ${series.sessions}`).join(" \xB7 ")}`);
|
|
5695
|
+
}
|
|
5669
5696
|
}
|
|
5670
5697
|
async function gaSocialReferralHistory(project2, opts) {
|
|
5671
5698
|
const client = getClient7();
|
|
@@ -19378,7 +19405,7 @@ var SYSTEM_CLI_COMMANDS = [
|
|
|
19378
19405
|
options: { access: stringOption() },
|
|
19379
19406
|
run: async (input) => {
|
|
19380
19407
|
if (input.positionals.length > 1) throw usageError("Expected at most one command group");
|
|
19381
|
-
const [{ printCliCatalog }, { REGISTERED_CLI_COMMANDS: REGISTERED_CLI_COMMANDS2 }] = await Promise.all([import("./cli-catalog-
|
|
19408
|
+
const [{ printCliCatalog }, { REGISTERED_CLI_COMMANDS: REGISTERED_CLI_COMMANDS2 }] = await Promise.all([import("./cli-catalog-MGEBTBSU.js"), import("./cli-commands-D5TBJLXO.js")]);
|
|
19382
19409
|
printCliCatalog(REGISTERED_CLI_COMMANDS2, input.format, input.positionals[0], getString(input.values, "access"));
|
|
19383
19410
|
}
|
|
19384
19411
|
},
|
|
@@ -74,6 +74,7 @@ import {
|
|
|
74
74
|
DiscoveryPromoteCompetitorSkipReasons,
|
|
75
75
|
DiscoverySessionStatuses,
|
|
76
76
|
FeatureNames,
|
|
77
|
+
GA4_AI_ASSISTANT_CHANNEL_GROUP,
|
|
77
78
|
GA_SEARCH_LANDING_DEFAULT_LIMIT,
|
|
78
79
|
GA_SEARCH_LANDING_DEFAULT_WINDOW,
|
|
79
80
|
GA_SEARCH_LANDING_MAX_LIMIT,
|
|
@@ -294,6 +295,7 @@ import {
|
|
|
294
295
|
buildMeasurementExecutionIdentity,
|
|
295
296
|
buildMeasurementRunManifestV1,
|
|
296
297
|
buildRedactedNotificationUrl,
|
|
298
|
+
buildStackedDailySeries,
|
|
297
299
|
businessProfileReviewsCover,
|
|
298
300
|
calendarDateRange,
|
|
299
301
|
calendarDateSchema,
|
|
@@ -849,6 +851,8 @@ import {
|
|
|
849
851
|
snapshotReportSchema,
|
|
850
852
|
snapshotRequestInputSchema,
|
|
851
853
|
snapshotRequestSchema,
|
|
854
|
+
socialPlatformForReferralSource,
|
|
855
|
+
socialPlatformLabel,
|
|
852
856
|
sortedUnique,
|
|
853
857
|
sourceBreakdownDtoSchema,
|
|
854
858
|
sourceBreakdownQuerySchema,
|
|
@@ -916,7 +920,7 @@ import {
|
|
|
916
920
|
wordpressSchemaDeployResultDtoSchema,
|
|
917
921
|
wordpressSchemaStatusResultDtoSchema,
|
|
918
922
|
wordpressStatusDtoSchema
|
|
919
|
-
} from "./chunk-
|
|
923
|
+
} from "./chunk-77T24PPR.js";
|
|
920
924
|
|
|
921
925
|
// src/intelligence-service.ts
|
|
922
926
|
import { eq as eq99, desc as desc45, asc as asc20, and as and82, ne as ne17, or as or24, inArray as inArray40, gte as gte26, lte as lte23, isNull as isNull19, sql as sql37, exists as exists2 } from "drizzle-orm";
|
|
@@ -35956,6 +35960,105 @@ async function trafficSamplesRoutes(app) {
|
|
|
35956
35960
|
// ../api-routes/src/referral-assessment.ts
|
|
35957
35961
|
import { and as and39, desc as desc22, eq as eq48, gte as gte10, lte as lte10, ne as ne11, sql as sql17 } from "drizzle-orm";
|
|
35958
35962
|
|
|
35963
|
+
// ../api-routes/src/ga-referral-groups.ts
|
|
35964
|
+
var CHART_SERIES_LIMIT = 5;
|
|
35965
|
+
var UNATTRIBUTED_AI_LABEL = "Unattributed AI";
|
|
35966
|
+
var UNATTRIBUTED_AI_KEY = "unattributed";
|
|
35967
|
+
var PAID_SOCIAL_CHANNEL_GROUP = "Paid Social";
|
|
35968
|
+
function bySessionsThenLabel(a, b) {
|
|
35969
|
+
return b.sessions - a.sessions || a.label.localeCompare(b.label);
|
|
35970
|
+
}
|
|
35971
|
+
function socialGroupKey(source, platform) {
|
|
35972
|
+
return platform ?? `source:${source}`;
|
|
35973
|
+
}
|
|
35974
|
+
function isPaidSocialChannel(channelGroup) {
|
|
35975
|
+
return channelGroup === PAID_SOCIAL_CHANNEL_GROUP;
|
|
35976
|
+
}
|
|
35977
|
+
function groupSocialPlatforms(rows) {
|
|
35978
|
+
const groups = /* @__PURE__ */ new Map();
|
|
35979
|
+
for (const row of rows) {
|
|
35980
|
+
const platform = socialPlatformForReferralSource(row.source);
|
|
35981
|
+
const key = socialGroupKey(row.source, platform);
|
|
35982
|
+
let group = groups.get(key);
|
|
35983
|
+
if (!group) {
|
|
35984
|
+
group = {
|
|
35985
|
+
platform,
|
|
35986
|
+
label: platform ? socialPlatformLabel(platform) : row.source,
|
|
35987
|
+
sessions: 0,
|
|
35988
|
+
organicSessions: 0,
|
|
35989
|
+
paidSessions: 0,
|
|
35990
|
+
sources: []
|
|
35991
|
+
};
|
|
35992
|
+
groups.set(key, group);
|
|
35993
|
+
}
|
|
35994
|
+
group.sessions += row.sessions;
|
|
35995
|
+
if (isPaidSocialChannel(row.channelGroup)) group.paidSessions += row.sessions;
|
|
35996
|
+
else group.organicSessions += row.sessions;
|
|
35997
|
+
group.sources.push(row);
|
|
35998
|
+
}
|
|
35999
|
+
const sorted = [...groups.values()].sort(bySessionsThenLabel);
|
|
36000
|
+
const shares = breakdownShares(sorted.map((group) => group.sessions));
|
|
36001
|
+
return sorted.map((group, index2) => ({
|
|
36002
|
+
...group,
|
|
36003
|
+
share: shares[index2] ?? 0,
|
|
36004
|
+
sources: [...group.sources].sort((a, b) => b.sessions - a.sessions || a.source.localeCompare(b.source))
|
|
36005
|
+
}));
|
|
36006
|
+
}
|
|
36007
|
+
function socialPlatformDailySeries(rows) {
|
|
36008
|
+
return buildStackedDailySeries(
|
|
36009
|
+
[...rows].map((row) => {
|
|
36010
|
+
const platform = socialPlatformForReferralSource(row.source);
|
|
36011
|
+
return {
|
|
36012
|
+
date: row.date,
|
|
36013
|
+
key: socialGroupKey(row.source, platform),
|
|
36014
|
+
label: platform ? socialPlatformLabel(platform) : row.source,
|
|
36015
|
+
sessions: row.sessions
|
|
36016
|
+
};
|
|
36017
|
+
}),
|
|
36018
|
+
{ limit: CHART_SERIES_LIMIT, otherLabel: "Other" }
|
|
36019
|
+
);
|
|
36020
|
+
}
|
|
36021
|
+
function paidSocialSummary(rows) {
|
|
36022
|
+
const total = rows.reduce((sum, row) => sum + row.sessions, 0);
|
|
36023
|
+
const paidSocialSessions = rows.filter((row) => isPaidSocialChannel(row.channelGroup)).reduce((sum, row) => sum + row.sessions, 0);
|
|
36024
|
+
return { paidSocialSessions, paidSocialShare: shareOf(paidSocialSessions, total) ?? 0 };
|
|
36025
|
+
}
|
|
36026
|
+
function aiEngineGroup(source) {
|
|
36027
|
+
const engine = aiEngineForReferralSource(source);
|
|
36028
|
+
return engine ? { engine, key: engine, label: aiReferralEngineLabel(engine) } : { engine: null, key: UNATTRIBUTED_AI_KEY, label: UNATTRIBUTED_AI_LABEL };
|
|
36029
|
+
}
|
|
36030
|
+
function groupAiEngines(rows) {
|
|
36031
|
+
const groups = /* @__PURE__ */ new Map();
|
|
36032
|
+
for (const row of rows) {
|
|
36033
|
+
const { engine, key, label } = aiEngineGroup(row.source);
|
|
36034
|
+
let group = groups.get(key);
|
|
36035
|
+
if (!group) {
|
|
36036
|
+
group = { engine, label, sessions: 0, organicSessions: 0, paidSessions: 0, sources: [] };
|
|
36037
|
+
groups.set(key, group);
|
|
36038
|
+
}
|
|
36039
|
+
group.sessions += row.sessions;
|
|
36040
|
+
if (row.trafficClass === AiReferralTrafficClasses.paid) group.paidSessions += row.sessions;
|
|
36041
|
+
else group.organicSessions += row.sessions;
|
|
36042
|
+
group.sources.push(row);
|
|
36043
|
+
}
|
|
36044
|
+
const sorted = [...groups.values()].sort((a, b) => Number(a.engine === null) - Number(b.engine === null) || bySessionsThenLabel(a, b));
|
|
36045
|
+
const shares = breakdownShares(sorted.map((group) => group.sessions));
|
|
36046
|
+
return sorted.map((group, index2) => ({
|
|
36047
|
+
...group,
|
|
36048
|
+
share: shares[index2] ?? 0,
|
|
36049
|
+
sources: [...group.sources].sort((a, b) => b.sessions - a.sessions || a.source.localeCompare(b.source))
|
|
36050
|
+
}));
|
|
36051
|
+
}
|
|
36052
|
+
function aiEngineDailySeries(winners) {
|
|
36053
|
+
return buildStackedDailySeries(
|
|
36054
|
+
[...winners].map((winner) => {
|
|
36055
|
+
const { key, label } = aiEngineGroup(winner.source);
|
|
36056
|
+
return { date: winner.date, key, label, sessions: winner.sessions };
|
|
36057
|
+
}),
|
|
36058
|
+
{ limit: CHART_SERIES_LIMIT, otherLabel: "Other" }
|
|
36059
|
+
);
|
|
36060
|
+
}
|
|
36061
|
+
|
|
35959
36062
|
// ../api-routes/src/ga-ai-referral-aggregation.ts
|
|
35960
36063
|
function normalizeAiTrafficClass(value) {
|
|
35961
36064
|
return value === AiReferralTrafficClasses.paid ? AiReferralTrafficClasses.paid : AiReferralTrafficClasses.organic;
|
|
@@ -36065,7 +36168,8 @@ function buildAiReferralDailySeries(rows) {
|
|
|
36065
36168
|
let totalSessions = 0;
|
|
36066
36169
|
let totalPaidSessions = 0;
|
|
36067
36170
|
let totalOrganicSessions = 0;
|
|
36068
|
-
|
|
36171
|
+
const winners = resolveWinningDimensions(rows);
|
|
36172
|
+
for (const winner of winners) {
|
|
36069
36173
|
const sessions = winner.paidSessions + winner.organicSessions;
|
|
36070
36174
|
let bySource = byDate.get(winner.date);
|
|
36071
36175
|
if (!bySource) {
|
|
@@ -36096,7 +36200,12 @@ function buildAiReferralDailySeries(rows) {
|
|
|
36096
36200
|
};
|
|
36097
36201
|
});
|
|
36098
36202
|
const sources = [...sourceTotals.entries()].sort(([aSource, aSessions], [bSource, bSessions]) => bSessions - aSessions || aSource.localeCompare(bSource)).map(([source]) => source);
|
|
36099
|
-
|
|
36203
|
+
const byEngine = aiEngineDailySeries(winners.map((winner) => ({
|
|
36204
|
+
date: winner.date,
|
|
36205
|
+
source: winner.source,
|
|
36206
|
+
sessions: winner.paidSessions + winner.organicSessions
|
|
36207
|
+
})));
|
|
36208
|
+
return { days, sources, totalSessions, totalPaidSessions, totalOrganicSessions, byEngine };
|
|
36100
36209
|
}
|
|
36101
36210
|
|
|
36102
36211
|
// ../api-routes/src/referral-assessment.ts
|
|
@@ -50037,6 +50146,12 @@ var GA4_DIMENSIONS = {
|
|
|
50037
50146
|
sessionManualMedium: "sessionManualMedium",
|
|
50038
50147
|
firstUserSource: "firstUserSource",
|
|
50039
50148
|
firstUserMedium: "firstUserMedium",
|
|
50149
|
+
/**
|
|
50150
|
+
* The channel group of the source and medium that first acquired the user,
|
|
50151
|
+
* the first-user counterpart of `sessionDefaultChannelGroup` (deprecated
|
|
50152
|
+
* name `firstUserDefaultChannelGrouping`, getMetadata, captured live).
|
|
50153
|
+
*/
|
|
50154
|
+
firstUserDefaultChannelGroup: "firstUserDefaultChannelGroup",
|
|
50040
50155
|
sessionDefaultChannelGrouping: "sessionDefaultChannelGrouping",
|
|
50041
50156
|
sessionDefaultChannelGroup: "sessionDefaultChannelGroup",
|
|
50042
50157
|
hostName: "hostName",
|
|
@@ -50496,9 +50611,40 @@ var AI_REFERRAL_SOURCE_FILTERS = [
|
|
|
50496
50611
|
{ matchType: "CONTAINS", value: "anthropic" },
|
|
50497
50612
|
{ matchType: "CONTAINS", value: "copilot" },
|
|
50498
50613
|
{ matchType: "CONTAINS", value: "phind" },
|
|
50614
|
+
// Grok by host and bare tag only: as a substring it sits inside ordinary
|
|
50615
|
+
// sources such as ngrok tunnels (`demo.ngrok-free.app`).
|
|
50616
|
+
{ matchType: "EXACT", value: AI_ENGINE_DOMAINS.grok },
|
|
50617
|
+
{ matchType: "ENDS_WITH", value: `.${AI_ENGINE_DOMAINS.grok}` },
|
|
50618
|
+
{ matchType: "EXACT", value: "grok" },
|
|
50619
|
+
{ matchType: "CONTAINS", value: "deepseek" },
|
|
50499
50620
|
{ matchType: "EXACT", value: AI_ENGINE_DOMAINS.you },
|
|
50500
50621
|
{ matchType: "CONTAINS", value: AI_ENGINE_DOMAINS.metaAi }
|
|
50501
50622
|
];
|
|
50623
|
+
var AI_REFERRAL_PASSES = [
|
|
50624
|
+
{
|
|
50625
|
+
label: "session",
|
|
50626
|
+
sourceDimension: GA4_DIMENSIONS.sessionSource,
|
|
50627
|
+
mediumDimension: GA4_DIMENSIONS.sessionMedium,
|
|
50628
|
+
// Same name as the channel the report requests, so the filter matches the
|
|
50629
|
+
// stored `channelGroup` value exactly.
|
|
50630
|
+
channelDimension: GA4_DIMENSIONS.sessionDefaultChannelGrouping
|
|
50631
|
+
},
|
|
50632
|
+
{
|
|
50633
|
+
label: "first_user",
|
|
50634
|
+
sourceDimension: GA4_DIMENSIONS.firstUserSource,
|
|
50635
|
+
mediumDimension: GA4_DIMENSIONS.firstUserMedium,
|
|
50636
|
+
channelDimension: GA4_DIMENSIONS.firstUserDefaultChannelGroup
|
|
50637
|
+
},
|
|
50638
|
+
{
|
|
50639
|
+
label: "manual_utm",
|
|
50640
|
+
sourceDimension: GA4_DIMENSIONS.sessionManualSource,
|
|
50641
|
+
mediumDimension: GA4_DIMENSIONS.sessionManualMedium,
|
|
50642
|
+
channelDimension: null
|
|
50643
|
+
}
|
|
50644
|
+
];
|
|
50645
|
+
function isInvalidGa4Request(error) {
|
|
50646
|
+
return error instanceof GA4ApiError && error.status === 400;
|
|
50647
|
+
}
|
|
50502
50648
|
async function fetchTrafficByLandingPage(accessToken, propertyId, days) {
|
|
50503
50649
|
validateAccessToken2(accessToken);
|
|
50504
50650
|
validatePropertyId(propertyId);
|
|
@@ -50844,69 +50990,24 @@ async function fetchAiReferrals(accessToken, propertyId, days) {
|
|
|
50844
50990
|
const endDate = /* @__PURE__ */ new Date();
|
|
50845
50991
|
const startDate = /* @__PURE__ */ new Date();
|
|
50846
50992
|
startDate.setDate(startDate.getDate() - syncDays);
|
|
50993
|
+
const dateRange = { startDate: formatDate(startDate), endDate: formatDate(endDate) };
|
|
50847
50994
|
ga4Log("info", "fetch-ai-referrals.start", { propertyId, days: syncDays });
|
|
50848
|
-
const PAGE_SIZE = 1e3;
|
|
50849
50995
|
const rows = [];
|
|
50850
|
-
const
|
|
50851
|
-
|
|
50852
|
-
|
|
50853
|
-
|
|
50854
|
-
|
|
50855
|
-
|
|
50856
|
-
|
|
50857
|
-
|
|
50858
|
-
|
|
50859
|
-
|
|
50860
|
-
|
|
50861
|
-
dateRanges: [{ startDate: formatDate(startDate), endDate: formatDate(endDate) }],
|
|
50862
|
-
dimensions: [
|
|
50863
|
-
{ name: GA4_DIMENSIONS.date },
|
|
50864
|
-
{ name: sourceDim },
|
|
50865
|
-
{ name: mediumDim },
|
|
50866
|
-
{ name: GA4_DIMENSIONS.sessionDefaultChannelGrouping },
|
|
50867
|
-
{ name: GA4_DIMENSIONS.landingPagePlusQueryString }
|
|
50868
|
-
],
|
|
50869
|
-
metrics: [
|
|
50870
|
-
{ name: GA4_METRICS.sessions },
|
|
50871
|
-
{ name: GA4_METRICS.totalUsers }
|
|
50872
|
-
],
|
|
50873
|
-
dimensionFilter: {
|
|
50874
|
-
orGroup: {
|
|
50875
|
-
expressions: AI_REFERRAL_SOURCE_FILTERS.map(({ matchType, value }) => ({
|
|
50876
|
-
filter: {
|
|
50877
|
-
fieldName: sourceDim,
|
|
50878
|
-
stringFilter: { matchType, value }
|
|
50879
|
-
}
|
|
50880
|
-
}))
|
|
50881
|
-
}
|
|
50882
|
-
},
|
|
50883
|
-
limit: PAGE_SIZE,
|
|
50884
|
-
offset
|
|
50885
|
-
};
|
|
50886
|
-
const response = await runReport(accessToken, propertyId, request);
|
|
50887
|
-
if (!response) break;
|
|
50888
|
-
const pageRows = (response.rows ?? []).map((row) => {
|
|
50889
|
-
const source = row.dimensionValues[1].value;
|
|
50890
|
-
const medium = row.dimensionValues[2].value;
|
|
50891
|
-
const channelGroup = row.dimensionValues[3]?.value ?? "(not set)";
|
|
50892
|
-
const landingPage = row.dimensionValues[4]?.value ?? "(not set)";
|
|
50893
|
-
return {
|
|
50894
|
-
date: row.dimensionValues[0].value,
|
|
50895
|
-
source,
|
|
50896
|
-
medium,
|
|
50897
|
-
trafficClass: classifyAiReferralTrafficClass({ source, medium, channelGroup, landingPage }),
|
|
50898
|
-
channelGroup,
|
|
50899
|
-
landingPage,
|
|
50900
|
-
sessions: parseInt(row.metricValues[0].value, 10) || 0,
|
|
50901
|
-
users: parseInt(row.metricValues[1].value, 10) || 0,
|
|
50902
|
-
sourceDimension: dimLabel
|
|
50903
|
-
};
|
|
50996
|
+
for (const pass of AI_REFERRAL_PASSES) {
|
|
50997
|
+
let passRows;
|
|
50998
|
+
try {
|
|
50999
|
+
passRows = await fetchAiReferralPass(accessToken, propertyId, dateRange, pass, pass.channelDimension);
|
|
51000
|
+
} catch (error) {
|
|
51001
|
+
if (pass.channelDimension === null || !isInvalidGa4Request(error)) throw error;
|
|
51002
|
+
ga4Log("error", "fetch-ai-referrals.channel-filter-rejected", {
|
|
51003
|
+
propertyId,
|
|
51004
|
+
sourceDimension: pass.label,
|
|
51005
|
+
channelDimension: pass.channelDimension,
|
|
51006
|
+
error: describeError(error)
|
|
50904
51007
|
});
|
|
50905
|
-
|
|
50906
|
-
const totalRows = response.rowCount ?? 0;
|
|
50907
|
-
offset += pageRows.length;
|
|
50908
|
-
if (pageRows.length < PAGE_SIZE || offset >= totalRows) break;
|
|
51008
|
+
passRows = await fetchAiReferralPass(accessToken, propertyId, dateRange, pass, null);
|
|
50909
51009
|
}
|
|
51010
|
+
rows.push(...passRows);
|
|
50910
51011
|
}
|
|
50911
51012
|
const deduped = /* @__PURE__ */ new Map();
|
|
50912
51013
|
for (const row of rows) {
|
|
@@ -50929,6 +51030,70 @@ async function fetchAiReferrals(accessToken, propertyId, days) {
|
|
|
50929
51030
|
ga4Log("info", "fetch-ai-referrals.done", { propertyId, rowCount: dedupedRows.length });
|
|
50930
51031
|
return dedupedRows;
|
|
50931
51032
|
}
|
|
51033
|
+
async function fetchAiReferralPass(accessToken, propertyId, dateRange, pass, channelDimension) {
|
|
51034
|
+
const PAGE_SIZE = 1e3;
|
|
51035
|
+
const expressions = AI_REFERRAL_SOURCE_FILTERS.map(({ matchType, value }) => ({
|
|
51036
|
+
filter: {
|
|
51037
|
+
fieldName: pass.sourceDimension,
|
|
51038
|
+
stringFilter: { matchType, value }
|
|
51039
|
+
}
|
|
51040
|
+
}));
|
|
51041
|
+
if (channelDimension) {
|
|
51042
|
+
expressions.push({
|
|
51043
|
+
filter: {
|
|
51044
|
+
fieldName: channelDimension,
|
|
51045
|
+
stringFilter: { matchType: "EXACT", value: GA4_AI_ASSISTANT_CHANNEL_GROUP, caseSensitive: false }
|
|
51046
|
+
}
|
|
51047
|
+
});
|
|
51048
|
+
}
|
|
51049
|
+
const rows = [];
|
|
51050
|
+
let offset = 0;
|
|
51051
|
+
let pageCount = 0;
|
|
51052
|
+
while (pageCount < GA4_MAX_PAGES) {
|
|
51053
|
+
pageCount++;
|
|
51054
|
+
const request = {
|
|
51055
|
+
dateRanges: [dateRange],
|
|
51056
|
+
dimensions: [
|
|
51057
|
+
{ name: GA4_DIMENSIONS.date },
|
|
51058
|
+
{ name: pass.sourceDimension },
|
|
51059
|
+
{ name: pass.mediumDimension },
|
|
51060
|
+
{ name: GA4_DIMENSIONS.sessionDefaultChannelGrouping },
|
|
51061
|
+
{ name: GA4_DIMENSIONS.landingPagePlusQueryString }
|
|
51062
|
+
],
|
|
51063
|
+
metrics: [
|
|
51064
|
+
{ name: GA4_METRICS.sessions },
|
|
51065
|
+
{ name: GA4_METRICS.totalUsers }
|
|
51066
|
+
],
|
|
51067
|
+
dimensionFilter: { orGroup: { expressions } },
|
|
51068
|
+
limit: PAGE_SIZE,
|
|
51069
|
+
offset
|
|
51070
|
+
};
|
|
51071
|
+
const response = await runReport(accessToken, propertyId, request);
|
|
51072
|
+
if (!response) break;
|
|
51073
|
+
const pageRows = (response.rows ?? []).map((row) => {
|
|
51074
|
+
const source = row.dimensionValues[1].value;
|
|
51075
|
+
const medium = row.dimensionValues[2].value;
|
|
51076
|
+
const channelGroup = row.dimensionValues[3]?.value ?? "(not set)";
|
|
51077
|
+
const landingPage = row.dimensionValues[4]?.value ?? "(not set)";
|
|
51078
|
+
return {
|
|
51079
|
+
date: row.dimensionValues[0].value,
|
|
51080
|
+
source,
|
|
51081
|
+
medium,
|
|
51082
|
+
trafficClass: classifyAiReferralTrafficClass({ source, medium, channelGroup, landingPage }),
|
|
51083
|
+
channelGroup,
|
|
51084
|
+
landingPage,
|
|
51085
|
+
sessions: parseInt(row.metricValues[0].value, 10) || 0,
|
|
51086
|
+
users: parseInt(row.metricValues[1].value, 10) || 0,
|
|
51087
|
+
sourceDimension: pass.label
|
|
51088
|
+
};
|
|
51089
|
+
});
|
|
51090
|
+
rows.push(...pageRows);
|
|
51091
|
+
const totalRows = response.rowCount ?? 0;
|
|
51092
|
+
offset += pageRows.length;
|
|
51093
|
+
if (pageRows.length < PAGE_SIZE || offset >= totalRows) break;
|
|
51094
|
+
}
|
|
51095
|
+
return rows;
|
|
51096
|
+
}
|
|
50932
51097
|
var SOCIAL_CHANNEL_GROUPS = ["Organic Social", "Paid Social"];
|
|
50933
51098
|
async function fetchSocialReferrals(accessToken, propertyId, days) {
|
|
50934
51099
|
validateAccessToken2(accessToken);
|
|
@@ -62381,6 +62546,11 @@ async function ga4Routes(app, opts) {
|
|
|
62381
62546
|
// conclusion the AI-referral surfaces reached in 4.135.0.
|
|
62382
62547
|
sessions: sql27`SUM(${gaSocialReferrals.sessions})`
|
|
62383
62548
|
}).from(gaSocialReferrals).where(and57(...socialConditions)).groupBy(gaSocialReferrals.source, gaSocialReferrals.medium, gaSocialReferrals.channelGroup).orderBy(sql27`SUM(${gaSocialReferrals.sessions}) DESC`).all();
|
|
62549
|
+
const socialDailyRows = app.db.select({
|
|
62550
|
+
date: gaSocialReferrals.date,
|
|
62551
|
+
source: gaSocialReferrals.source,
|
|
62552
|
+
sessions: sql27`SUM(${gaSocialReferrals.sessions})`
|
|
62553
|
+
}).from(gaSocialReferrals).where(and57(...socialConditions)).groupBy(gaSocialReferrals.date, gaSocialReferrals.source).all();
|
|
62384
62554
|
const socialTotals = app.db.select({
|
|
62385
62555
|
sessions: sql27`SUM(${gaSocialReferrals.sessions})`
|
|
62386
62556
|
}).from(gaSocialReferrals).where(and57(...socialConditions)).get();
|
|
@@ -62399,6 +62569,19 @@ async function ga4Routes(app, opts) {
|
|
|
62399
62569
|
directSessions: totalDirectSessions,
|
|
62400
62570
|
aiSessionsByChannelGroup: aiSummary.bySessionChannelGroup
|
|
62401
62571
|
});
|
|
62572
|
+
const aiReferralDtos = withSessionShares(aiReferrals.map((r) => ({
|
|
62573
|
+
source: r.source,
|
|
62574
|
+
medium: r.medium,
|
|
62575
|
+
trafficClass: normalizeAiTrafficClass(r.trafficClass),
|
|
62576
|
+
sourceDimension: r.sourceDimension,
|
|
62577
|
+
sessions: r.sessions ?? 0
|
|
62578
|
+
})));
|
|
62579
|
+
const socialReferralDtos = withSessionShares(socialReferrals.map((r) => ({
|
|
62580
|
+
source: r.source,
|
|
62581
|
+
medium: r.medium,
|
|
62582
|
+
channelGroup: r.channelGroup,
|
|
62583
|
+
sessions: r.sessions ?? 0
|
|
62584
|
+
})));
|
|
62402
62585
|
return {
|
|
62403
62586
|
totalSessions: total,
|
|
62404
62587
|
totalOrganicSessions,
|
|
@@ -62425,13 +62608,8 @@ async function ga4Routes(app, opts) {
|
|
|
62425
62608
|
// Shares of the rows' own sum, not of `aiSessionsDeduped`: that total
|
|
62426
62609
|
// keeps the winning lens per day, these rows one lens per source over the
|
|
62427
62610
|
// window, so it can exceed what the rows add up to.
|
|
62428
|
-
aiReferrals:
|
|
62429
|
-
|
|
62430
|
-
medium: r.medium,
|
|
62431
|
-
trafficClass: normalizeAiTrafficClass(r.trafficClass),
|
|
62432
|
-
sourceDimension: r.sourceDimension,
|
|
62433
|
-
sessions: r.sessions ?? 0
|
|
62434
|
-
}))),
|
|
62611
|
+
aiReferrals: aiReferralDtos,
|
|
62612
|
+
aiEngines: groupAiEngines(aiReferralDtos),
|
|
62435
62613
|
aiReferralLandingPages: aiReferralLandingPages.map((r) => ({
|
|
62436
62614
|
source: r.source,
|
|
62437
62615
|
medium: r.medium,
|
|
@@ -62448,13 +62626,15 @@ async function ga4Routes(app, opts) {
|
|
|
62448
62626
|
organicAiSessionsBySession: aiSummary.organicBySession.sessions,
|
|
62449
62627
|
// These rows partition `socialSessions` (same window, one lens), so each
|
|
62450
62628
|
// share is also the row's share of that total.
|
|
62451
|
-
socialReferrals:
|
|
62629
|
+
socialReferrals: socialReferralDtos,
|
|
62630
|
+
socialPlatforms: groupSocialPlatforms(socialReferralDtos),
|
|
62631
|
+
socialPlatformDaily: socialPlatformDailySeries(socialDailyRows.map((r) => ({
|
|
62632
|
+
date: r.date,
|
|
62452
62633
|
source: r.source,
|
|
62453
|
-
medium: r.medium,
|
|
62454
|
-
channelGroup: r.channelGroup,
|
|
62455
62634
|
sessions: r.sessions ?? 0
|
|
62456
62635
|
}))),
|
|
62457
62636
|
socialSessions,
|
|
62637
|
+
...paidSocialSummary(socialReferralDtos),
|
|
62458
62638
|
channelBreakdown,
|
|
62459
62639
|
organicSharePct: percentOf(totalOrganicSessions, total) ?? 0,
|
|
62460
62640
|
aiSharePct: percentOf(aiSummary.deduped.sessions, total) ?? 0,
|
|
@@ -95691,6 +95871,7 @@ export {
|
|
|
95691
95871
|
gaLeadEventsDaily,
|
|
95692
95872
|
gaMeasurementSyncStates,
|
|
95693
95873
|
gaAiReferrals,
|
|
95874
|
+
gaSocialReferrals,
|
|
95694
95875
|
gaTrafficSummaries,
|
|
95695
95876
|
gaTrafficWindowSummaries,
|
|
95696
95877
|
gaSearchLandingWindows,
|
|
@@ -22,19 +22,19 @@ import {
|
|
|
22
22
|
saveConfig,
|
|
23
23
|
saveConfigPatch,
|
|
24
24
|
sentimentInstallReadiness
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-2SWNW5O6.js";
|
|
26
26
|
import {
|
|
27
27
|
computeFactorAverages,
|
|
28
28
|
deleteSiteCrawlGraphLayout,
|
|
29
29
|
persistSiteCrawlGraphLayout,
|
|
30
30
|
prepareSiteCrawlGraphLayout,
|
|
31
31
|
recordedSharePct
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-GG6ECPAO.js";
|
|
33
33
|
import {
|
|
34
34
|
CanonryMcpToolNames,
|
|
35
35
|
PACKAGE_VERSION,
|
|
36
36
|
canonryMcpTools
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-5ZYVREGG.js";
|
|
38
38
|
import {
|
|
39
39
|
CliError
|
|
40
40
|
} from "./chunk-HGMYEDAQ.js";
|
|
@@ -241,7 +241,7 @@ import {
|
|
|
241
241
|
webhookResponseReason,
|
|
242
242
|
webhookTargetRefusalReason,
|
|
243
243
|
writeAuditLog
|
|
244
|
-
} from "./chunk-
|
|
244
|
+
} from "./chunk-UJLIMXPX.js";
|
|
245
245
|
import {
|
|
246
246
|
AGENT_MEMORY_VALUE_MAX_BYTES,
|
|
247
247
|
AGENT_NONE,
|
|
@@ -489,7 +489,7 @@ import {
|
|
|
489
489
|
winnabilityClassLabel,
|
|
490
490
|
withRetry,
|
|
491
491
|
withSkippedProviders
|
|
492
|
-
} from "./chunk-
|
|
492
|
+
} from "./chunk-77T24PPR.js";
|
|
493
493
|
|
|
494
494
|
// src/runtime-context.ts
|
|
495
495
|
function cliRuntimeContext(env = process.env, stdio = process) {
|
|
@@ -8625,7 +8625,7 @@ function nonBlank(value) {
|
|
|
8625
8625
|
return trimmed ? trimmed : void 0;
|
|
8626
8626
|
}
|
|
8627
8627
|
function resolveBuildCommit(env = process.env) {
|
|
8628
|
-
const embedded = true ? "
|
|
8628
|
+
const embedded = true ? "2694af820e6c8ba6e9be675cc1087c332a2c093d" : void 0;
|
|
8629
8629
|
return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
|
|
8630
8630
|
}
|
|
8631
8631
|
function resolveInstanceIdentity(env = process.env) {
|