@canonry/canonry 7.55.1 → 7.56.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 +6 -0
- package/assets/assets/{AgentSetupPage-Chb7OZYo.js → AgentSetupPage-BkKw_in_.js} +3 -3
- package/assets/assets/{AuditHistoryPanel-CWAAzxGL.js → AuditHistoryPanel-UtRnS-sh.js} +1 -1
- package/assets/assets/{BacklinksPage-CfRqXLjw.js → BacklinksPage-DCSmuAOQ.js} +1 -1
- package/assets/assets/{ChartPrimitives-DIEeZdrs.js → ChartPrimitives-BgY3tqbD.js} +1 -1
- package/assets/assets/{Hint-Cn4lh0Do.js → Hint-BsfMSR5e.js} +1 -1
- package/assets/assets/{HistoryPage-EXS6zGfM.js → HistoryPage-DzpqCNJM.js} +1 -1
- package/assets/assets/{InfoTooltip-TIx9qM5h.js → InfoTooltip-COkeQYiP.js} +1 -1
- package/assets/assets/MeasurementPropertyPage-Dh0BJw_f.js +4 -0
- package/assets/assets/ProjectPage-D-9IeFap.js +7 -0
- package/assets/assets/{RunsPage-Ck0A8Z-B.js → RunsPage-DtllYN3I.js} +1 -1
- package/assets/assets/{SettingsPage-DLwUxbGB.js → SettingsPage-_p15s-OC.js} +1 -1
- package/assets/assets/SiteHealthSection-BEpXTW3G.js +2 -0
- package/assets/assets/ToneBadge-nxe12_3b.js +60 -0
- package/assets/assets/{TrafficPage-jPUXy6qr.js → TrafficPage-wru6cQPP.js} +2 -2
- package/assets/assets/{TrafficSourceDetailPage-D1ApU8pZ.js → TrafficSourceDetailPage-_XKbd-aS.js} +1 -1
- package/assets/assets/{account-context-W2az42JI.js → account-context-BekDho6K.js} +1 -1
- package/assets/assets/{card-YusVbEjF.js → card-By9JlCCv.js} +1 -1
- package/assets/assets/{extract-error-message-XEIEg9D6.js → extract-error-message-SMPhaAkr.js} +1 -1
- package/assets/assets/{format-helpers-Bb7jAdHk.js → format-helpers-CVjOUs0j.js} +1 -1
- package/assets/assets/index-BMD46UDb.css +1 -0
- package/assets/assets/index-el2M4tYf.js +56 -0
- package/assets/assets/{query-client-Dz-pGbg8.js → query-client-8RITTP1A.js} +1 -1
- package/assets/assets/react-query-BXwc1UHc.js +1 -0
- package/assets/assets/{react-sigma_core.esm.min--9Hr2IJs.js → react-sigma_core.esm.min-CM12VcoB.js} +1 -1
- package/assets/assets/{service-B6yV5DWh.js → service-B0wkGxvy.js} +1 -1
- package/assets/assets/vendor-lucide-CPeGWK5C.js +1 -0
- package/assets/assets/{vendor-markdown-DWjffpgb.js → vendor-markdown-Bdsu1JLE.js} +1 -1
- package/assets/assets/{vendor-radix-BU76HM0G.js → vendor-radix-3k2C0Ly9.js} +1 -1
- package/assets/assets/{vendor-recharts-CsHBXoK8.js → vendor-recharts-CFnqWvWF.js} +1 -1
- package/assets/assets/{vendor-tanstack-QhOrDhIL.js → vendor-tanstack-CXaF1vMI.js} +1 -1
- package/assets/index.html +15 -15
- package/dist/{ads-FZ7MIWXC.js → ads-SPXNKDEW.js} +3 -3
- package/dist/{agent-E6DBBS3U.js → agent-THPYOGXD.js} +7 -7
- package/dist/{agent-ask-GFG646FW.js → agent-ask-VHRA5RVU.js} +3 -3
- package/dist/{agent-conversations-MF3JQUBO.js → agent-conversations-5HXXVMZV.js} +3 -3
- package/dist/{agent-memory-AHBHISRL.js → agent-memory-SKBUFHGV.js} +3 -3
- package/dist/{agent-providers-GPPFRFOJ.js → agent-providers-TOIA75C6.js} +3 -3
- package/dist/{agent-transcript-WAFQUNNS.js → agent-transcript-DFE2PDTS.js} +3 -3
- package/dist/{analytics-JIMNYMK7.js → analytics-JJHPK2TK.js} +3 -3
- package/dist/{apply-VQGED53E.js → apply-AC36NXPF.js} +3 -3
- package/dist/{backfill-2Z5NQJH7.js → backfill-HMP43HMJ.js} +9 -9
- package/dist/{backlinks-3OWR2TKF.js → backlinks-EKSQJXMS.js} +3 -3
- package/dist/{bing-VN5M2WTQ.js → bing-XZQ6CQM4.js} +3 -3
- package/dist/{bootstrap-E27HOPUD.js → bootstrap-GJUT3AVH.js} +10 -10
- package/dist/{cdp-DGUIUB6T.js → cdp-QROXKBXS.js} +7 -7
- package/dist/{chunk-SLMYLF4H.js → chunk-2Z7FALTN.js} +2 -2
- package/dist/{chunk-DGBFU7YE.js → chunk-37YB52NM.js} +84 -1
- package/dist/{chunk-6HEDNOEF.js → chunk-3BHGEP3O.js} +8 -8
- package/dist/{chunk-4MTFV6L2.js → chunk-3HZZ2XZD.js} +5 -5
- package/dist/{chunk-EULFLYW5.js → chunk-4QRF7TNW.js} +2 -2
- package/dist/{chunk-QUMODKMN.js → chunk-ADCVXKSD.js} +1 -1
- package/dist/{chunk-MHG2AFWS.js → chunk-AOBMI5UM.js} +1 -1
- package/dist/{chunk-M5E4ANAN.js → chunk-BALZYIFH.js} +4 -4
- package/dist/{chunk-F3KBEYKI.js → chunk-C5LD76KR.js} +3 -3
- package/dist/{chunk-5XOGLDAG.js → chunk-CFGQOIXW.js} +3 -3
- package/dist/{chunk-E4T73OGZ.js → chunk-DDM6PVXJ.js} +3 -3
- package/dist/{chunk-T5UIEVCS.js → chunk-DOP5QNPM.js} +364 -37
- package/dist/{chunk-EAE4N2VX.js → chunk-F5DLOQ3B.js} +2 -2
- package/dist/{chunk-OIOHLANV.js → chunk-NSE55FZE.js} +2 -2
- package/dist/{chunk-JYDXICGN.js → chunk-NZ6KZLTM.js} +2 -1
- package/dist/{chunk-5DX7N34L.js → chunk-P2OVWQKT.js} +1 -1
- package/dist/{chunk-YZP6IMCC.js → chunk-PUTJ6LPE.js} +1 -1
- package/dist/{chunk-6ME76HJO.js → chunk-Q5ZRUA57.js} +1 -1
- package/dist/{chunk-L23GLMDH.js → chunk-QAGZQ2DY.js} +137 -0
- package/dist/{chunk-7LA7MY4D.js → chunk-RCCZ6VGK.js} +1 -1
- package/dist/{chunk-FZW44W5P.js → chunk-RELKG6XH.js} +2 -2
- package/dist/{chunk-4DQFJP5E.js → chunk-RWYKUCPF.js} +338 -325
- package/dist/{chunk-BVWCQLRX.js → chunk-S4H7KMIH.js} +20 -20
- package/dist/{chunk-BR4RBXLD.js → chunk-SJLCALSV.js} +3 -3
- package/dist/{chunk-Y7CK6NY4.js → chunk-SVLNIJS2.js} +1 -1
- package/dist/{chunk-23YDBDYE.js → chunk-T7A46CVU.js} +5 -5
- package/dist/{chunk-TDMEFWWH.js → chunk-TPCXTUL5.js} +1 -1
- package/dist/{chunk-I7V5UIUZ.js → chunk-V4V7WOHY.js} +16 -2
- package/dist/{chunk-UOHAWN66.js → chunk-VZURJP3T.js} +1 -1
- package/dist/{chunk-CBJ2SBKN.js → chunk-W5FAL4LJ.js} +4 -4
- package/dist/{chunk-JKXX6DQS.js → chunk-WRYVESRH.js} +1 -1
- package/dist/{chunk-TBQTJRWL.js → chunk-XUW5SU24.js} +4 -4
- package/dist/{chunk-BM4XREGB.js → chunk-ZNAAZHNT.js} +19 -3
- package/dist/{chunk-64MEDTTQ.js → chunk-ZOVL5NAP.js} +1 -1
- package/dist/{citations-X3ACB4BK.js → citations-5ARZ6M42.js} +3 -3
- package/dist/{cli-catalog-KGYSKGDJ.js → cli-catalog-XD7VY3ES.js} +3 -3
- package/dist/{cli-commands-KN3ZROPW.js → cli-commands-KGTXEDAZ.js} +7 -7
- package/dist/cli.js +13 -13
- package/dist/{competitor-K4XKRB2A.js → competitor-XWTEIVZL.js} +3 -3
- package/dist/{content-K4ZF5PLU.js → content-4EVGV32G.js} +3 -3
- package/dist/{dashboard-IKLVLUF6.js → dashboard-YEYFINMF.js} +6 -6
- package/dist/{demo-S6MCF65Z.js → demo-RK5OKZIY.js} +1 -1
- package/dist/{demo-server-TFPIU4E2.js → demo-server-JL4JLKMG.js} +113 -12
- package/dist/{discover-PF4CWAL3.js → discover-VQYJ4UOL.js} +3 -3
- package/dist/{discover-eval-GL5EN3DK.js → discover-eval-FMEMPSM3.js} +3 -3
- package/dist/{doctor-GGMC5LXO.js → doctor-VYES5HCM.js} +3 -3
- package/dist/{evidence-KLMPJDIX.js → evidence-BG45EBS3.js} +3 -3
- package/dist/{export-cmd-SUBBU5TK.js → export-cmd-PQZCMR7C.js} +3 -3
- package/dist/{ga-XTJ4272V.js → ga-ZQL2LHQA.js} +42 -4
- package/dist/{gbp-3XIL64BL.js → gbp-KNWDBHFM.js} +3 -3
- package/dist/{google-4ZVLOEO7.js → google-GOKE6J5E.js} +4 -4
- package/dist/{google-marketing-EKHYN6RN.js → google-marketing-7DYEKRHS.js} +1 -1
- package/dist/{health-cmd-AS2XVZGM.js → health-cmd-4OZ7EYWI.js} +3 -3
- package/dist/{history-UFO6W5MK.js → history-U2W77DIY.js} +3 -3
- package/dist/index.d.ts +485 -10
- package/dist/index.js +24 -24
- package/dist/{init-X6CJISQ7.js → init-WTLTEYSB.js} +11 -11
- package/dist/{insights-MQUSMDKL.js → insights-LWMDBEYC.js} +3 -3
- package/dist/intelligence-service-PY6QR36M.js +15 -0
- package/dist/{keys-SHGKOF7L.js → keys-RSKVNMJI.js} +3 -3
- package/dist/{keyword-PQHI62EQ.js → keyword-IM4GUM5U.js} +3 -3
- package/dist/{logs-GKZ3C6U7.js → logs-B35V2RPE.js} +3 -3
- package/dist/{mcp-II46ISJK.js → mcp-UFMKQFGP.js} +2 -2
- package/dist/mcp.js +9 -9
- package/dist/{measurement-plan-AMYXJNGA.js → measurement-plan-BOHLLJD5.js} +5 -5
- package/dist/{notify-HBSOBXU5.js → notify-RQIQP5ZF.js} +3 -3
- package/dist/{organic-evidence-B6FTSLSS.js → organic-evidence-C3OZR7UY.js} +3 -3
- package/dist/{overview-CMSXYEFO.js → overview-OVIPKMAY.js} +4 -4
- package/dist/{project-TPY5QLJB.js → project-QBUTYR6J.js} +3 -3
- package/dist/{query-GRI574XT.js → query-KCGET5FS.js} +3 -3
- package/dist/{research-XZBMLGPZ.js → research-HTURJWRL.js} +3 -3
- package/dist/{results-export-P2R6W24Y.js → results-export-GJNXEXV4.js} +3 -3
- package/dist/{run-TYVYDQSF.js → run-ZNTT7W5M.js} +4 -4
- package/dist/{schedule-GKMCGZUD.js → schedule-S2ODDXFB.js} +3 -3
- package/dist/{search-IENKPV43.js → search-UW56VG5B.js} +3 -3
- package/dist/{serve-GORRM5KD.js → serve-BIWTUO6A.js} +25 -25
- package/dist/{session-JXRG3LRH.js → session-T4Q6NH3K.js} +12 -12
- package/dist/{settings-RATO7LTH.js → settings-TGSORPVW.js} +3 -3
- package/dist/{skills-BQRJVV3P.js → skills-SBZZLY4T.js} +2 -2
- package/dist/{snapshot-5O44JQYF.js → snapshot-OMS33CN4.js} +3 -3
- package/dist/{src-5HJMZCHY.js → src-LKNW35M6.js} +4 -2
- package/dist/{status-O2JPGJ27.js → status-7D7NUW7M.js} +4 -4
- package/dist/{technical-aeo-7DAQZPV2.js → technical-aeo-UFDHAV7G.js} +3 -3
- package/dist/{telemetry-4YY5IP5A.js → telemetry-ZPVJITHJ.js} +4 -4
- package/dist/{tools-MQZ5KQVL.js → tools-PDV6BJ5Y.js} +11 -11
- package/dist/{traffic-RGIEOKUQ.js → traffic-T6YAKUY5.js} +5 -5
- package/dist/{users-HNRMET2A.js → users-6N2YMWAP.js} +3 -3
- package/dist/{visibility-stats-AOQTJIWH.js → visibility-stats-GODBRQVG.js} +3 -3
- package/dist/{wordpress-UOAWGG7N.js → wordpress-ISFI67TH.js} +3 -3
- package/package.json +1 -1
- package/assets/assets/MeasurementPropertyPage-CnMKVlyr.js +0 -4
- package/assets/assets/ProjectPage-D8rNNTAJ.js +0 -7
- package/assets/assets/SiteHealthSection-B7-1csc8.js +0 -2
- package/assets/assets/ToneBadge-BcN0dkBF.js +0 -60
- package/assets/assets/index-B8W65ejO.css +0 -1
- package/assets/assets/index-Gz_0R4O6.js +0 -56
- package/assets/assets/react-query-DB0ftGOM.js +0 -1
- package/assets/assets/vendor-lucide-BjvO55Hk.js +0 -1
- package/dist/intelligence-service-P44IBE6G.js +0 -15
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
isSelfTraffic,
|
|
7
7
|
normalizeCloudflareWorkerEvent,
|
|
8
8
|
verifyRequestSignature
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-P2OVWQKT.js";
|
|
10
10
|
import {
|
|
11
11
|
currentOutcomeAttribution,
|
|
12
12
|
getRequestContext,
|
|
13
13
|
registerRequestContext,
|
|
14
14
|
requestAuditIdentity,
|
|
15
15
|
sanitizeRequestContext
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-AOBMI5UM.js";
|
|
17
17
|
import {
|
|
18
18
|
SentimentIdempotencyConflict,
|
|
19
19
|
SentimentRepository,
|
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
gaTrafficSnapshots,
|
|
63
63
|
gaTrafficSummaries,
|
|
64
64
|
gaTrafficWindowSummaries,
|
|
65
|
+
gaWindowMetrics,
|
|
65
66
|
gbpAttributesSnapshots,
|
|
66
67
|
gbpDailyMetrics,
|
|
67
68
|
gbpKeywordImpressions,
|
|
@@ -142,7 +143,7 @@ import {
|
|
|
142
143
|
userSessions,
|
|
143
144
|
users,
|
|
144
145
|
writeNegativeReviewMaxStars
|
|
145
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-37YB52NM.js";
|
|
146
147
|
import {
|
|
147
148
|
ADS_ACTIVATE_SCOPE,
|
|
148
149
|
ADS_ACTIVATION_ABSOLUTE_MAX_ENTITIES,
|
|
@@ -221,6 +222,8 @@ import {
|
|
|
221
222
|
DiscoverySessionStatuses,
|
|
222
223
|
FeatureNames,
|
|
223
224
|
GA4_AI_ASSISTANT_CHANNEL_GROUP,
|
|
225
|
+
GA_OVERVIEW_HISTORY_DAYS,
|
|
226
|
+
GA_OVERVIEW_METRIC_ORDER,
|
|
224
227
|
GA_SEARCH_LANDING_DEFAULT_LIMIT,
|
|
225
228
|
GA_SEARCH_LANDING_DEFAULT_WINDOW,
|
|
226
229
|
GA_SEARCH_LANDING_MAX_LIMIT,
|
|
@@ -232,6 +235,7 @@ import {
|
|
|
232
235
|
GOOGLE_MARKETING_WRITE_SCOPE,
|
|
233
236
|
GaAcquisitionDimensions,
|
|
234
237
|
GaMoverChangeBases,
|
|
238
|
+
GaOverviewPeriods,
|
|
235
239
|
GoogleAdsCampaignStatuses,
|
|
236
240
|
GoogleAdsConnectionStates,
|
|
237
241
|
GoogleAdsGoalConfigurationLevels,
|
|
@@ -601,6 +605,9 @@ import {
|
|
|
601
605
|
gaAttributionTrendResponseSchema,
|
|
602
606
|
gaMeasurementAnalysisDtoSchema,
|
|
603
607
|
gaMeasurementHostScopeSchema,
|
|
608
|
+
gaOverviewComparisonDaysAgo,
|
|
609
|
+
gaOverviewComparisonRanges,
|
|
610
|
+
gaOverviewResponseSchema,
|
|
604
611
|
gaSearchLandingPagesResponseSchema,
|
|
605
612
|
gaSearchLandingWindowSchema,
|
|
606
613
|
gaSocialReferralTrendResponseSchema,
|
|
@@ -677,6 +684,7 @@ import {
|
|
|
677
684
|
isEligibleFor,
|
|
678
685
|
isFetchTransportError,
|
|
679
686
|
isGa4AiAssistantChannel,
|
|
687
|
+
isGaOverviewWindow,
|
|
680
688
|
isListingMarketplace,
|
|
681
689
|
isLocationRedirectStatus,
|
|
682
690
|
isNegativeReviewRating,
|
|
@@ -1076,7 +1084,7 @@ import {
|
|
|
1076
1084
|
wordpressSchemaDeployResultDtoSchema,
|
|
1077
1085
|
wordpressSchemaStatusResultDtoSchema,
|
|
1078
1086
|
wordpressStatusDtoSchema
|
|
1079
|
-
} from "./chunk-
|
|
1087
|
+
} from "./chunk-QAGZQ2DY.js";
|
|
1080
1088
|
|
|
1081
1089
|
// ../api-routes/src/user-session.ts
|
|
1082
1090
|
import crypto2 from "crypto";
|
|
@@ -32709,6 +32717,7 @@ var SCHEMA_TABLE = {
|
|
|
32709
32717
|
GA4AiReferralHistoryEntry: ga4AiReferralHistoryEntrySchema,
|
|
32710
32718
|
GA4MeasurementAnalysisDto: gaMeasurementAnalysisDtoSchema,
|
|
32711
32719
|
GA4SessionHistoryEntry: ga4SessionHistoryEntrySchema,
|
|
32720
|
+
GaOverviewResponse: gaOverviewResponseSchema,
|
|
32712
32721
|
GA4SocialReferralHistoryEntry: ga4SocialReferralHistoryEntrySchema,
|
|
32713
32722
|
GA4PropertiesDto: ga4PropertiesDtoSchema,
|
|
32714
32723
|
GA4StatusDto: ga4StatusDtoSchema,
|
|
@@ -33327,6 +33336,12 @@ var analyticsWindowParameter = {
|
|
|
33327
33336
|
description: "Time window for analytics queries. An unrecognised value is rejected with 400; it is never widened to the full history.",
|
|
33328
33337
|
schema: { type: "string", enum: ["7d", "30d", "90d", "all"] }
|
|
33329
33338
|
};
|
|
33339
|
+
var gaOverviewWindowParameter = {
|
|
33340
|
+
name: "window",
|
|
33341
|
+
in: "query",
|
|
33342
|
+
description: 'Overview window: the complete days ending yesterday, as GA4 counts "Last 30 days". Defaults to 30d. Any other value is rejected with 400.',
|
|
33343
|
+
schema: { type: "string", enum: ["7d", "30d", "90d"] }
|
|
33344
|
+
};
|
|
33330
33345
|
var competitorLandscapeGroupKeyParameter = {
|
|
33331
33346
|
name: "groupKey",
|
|
33332
33347
|
in: "query",
|
|
@@ -39139,6 +39154,18 @@ var routeCatalog = [
|
|
|
39139
39154
|
404: errorResponse("Project not found.")
|
|
39140
39155
|
}
|
|
39141
39156
|
},
|
|
39157
|
+
{
|
|
39158
|
+
method: "get",
|
|
39159
|
+
path: "/api/v1/projects/{name}/ga/overview",
|
|
39160
|
+
summary: "Get the GA4 overview: totals, change against the previous period, and both periods by day",
|
|
39161
|
+
tags: ["ga4"],
|
|
39162
|
+
parameters: [nameParameter, gaOverviewWindowParameter],
|
|
39163
|
+
responses: {
|
|
39164
|
+
200: jsonResponse("GA4 overview returned.", "GaOverviewResponse"),
|
|
39165
|
+
400: errorResponse("GA4 is not connected, or the window is not 7d, 30d or 90d."),
|
|
39166
|
+
404: errorResponse("Project not found.")
|
|
39167
|
+
}
|
|
39168
|
+
},
|
|
39142
39169
|
{
|
|
39143
39170
|
method: "get",
|
|
39144
39171
|
path: "/api/v1/projects/{name}/ga/session-history",
|
|
@@ -42271,6 +42298,17 @@ var GA4_METRICS = {
|
|
|
42271
42298
|
* sessions did not (captured live, 2026-10-08).
|
|
42272
42299
|
*/
|
|
42273
42300
|
activeUsers: "activeUsers",
|
|
42301
|
+
/** GA4's "Views": web pages and app screens viewed. */
|
|
42302
|
+
screenPageViews: "screenPageViews",
|
|
42303
|
+
/** GA4's "Key events" (named "conversions" until 2024). */
|
|
42304
|
+
keyEvents: "keyEvents",
|
|
42305
|
+
/**
|
|
42306
|
+
* Engaged time in seconds, summed. GA4's "Average engagement time" is this
|
|
42307
|
+
* divided by `activeUsers` over the same span.
|
|
42308
|
+
*/
|
|
42309
|
+
userEngagementDuration: "userEngagementDuration",
|
|
42310
|
+
/** Share of sessions that were not engaged (0-1), GA4's own figure. */
|
|
42311
|
+
bounceRate: "bounceRate",
|
|
42274
42312
|
/**
|
|
42275
42313
|
* Search Console metrics a GA4 property exposes once it is linked to Search
|
|
42276
42314
|
* Console. Compatible only with the landing page, device and country
|
|
@@ -42578,6 +42616,18 @@ async function batchRunReports(accessToken, propertyId, requests) {
|
|
|
42578
42616
|
function formatDate(d) {
|
|
42579
42617
|
return d.toISOString().slice(0, 10);
|
|
42580
42618
|
}
|
|
42619
|
+
function ga4RelativeDate(daysAgo) {
|
|
42620
|
+
if (daysAgo === 0) return "today";
|
|
42621
|
+
if (daysAgo === 1) return "yesterday";
|
|
42622
|
+
return `${daysAgo}daysAgo`;
|
|
42623
|
+
}
|
|
42624
|
+
function reportTimeZone(...responses) {
|
|
42625
|
+
for (const res of responses) {
|
|
42626
|
+
const zone = res?.metadata?.timeZone?.trim();
|
|
42627
|
+
if (zone) return zone;
|
|
42628
|
+
}
|
|
42629
|
+
return null;
|
|
42630
|
+
}
|
|
42581
42631
|
function measurementDateRange(days) {
|
|
42582
42632
|
const { effectiveDays: syncDays } = resolveGa4SyncDays(days);
|
|
42583
42633
|
const endDate = /* @__PURE__ */ new Date();
|
|
@@ -42987,38 +43037,75 @@ function parseOptionalCountMetric(value) {
|
|
|
42987
43037
|
const parsed = parseOptionalMetric(value);
|
|
42988
43038
|
return parsed === null ? null : Math.round(parsed);
|
|
42989
43039
|
}
|
|
42990
|
-
async function fetchDailyTotals(accessToken, propertyId, days) {
|
|
43040
|
+
async function fetchDailyTotals(accessToken, propertyId, days = GA_OVERVIEW_HISTORY_DAYS, options = {}) {
|
|
42991
43041
|
validateAccessToken2(accessToken);
|
|
42992
43042
|
validatePropertyId(propertyId);
|
|
42993
|
-
const
|
|
42994
|
-
const
|
|
42995
|
-
const
|
|
42996
|
-
|
|
42997
|
-
|
|
42998
|
-
|
|
42999
|
-
|
|
43000
|
-
|
|
43001
|
-
|
|
43002
|
-
|
|
43003
|
-
|
|
43004
|
-
|
|
43005
|
-
|
|
43006
|
-
|
|
43007
|
-
|
|
43008
|
-
|
|
43009
|
-
|
|
43010
|
-
|
|
43011
|
-
|
|
43043
|
+
const historyDays = Math.min(Math.max(1, Number.isFinite(days) ? Math.trunc(days) : GA_OVERVIEW_HISTORY_DAYS), GA_OVERVIEW_HISTORY_DAYS);
|
|
43044
|
+
const requestedAt = (options.now ?? /* @__PURE__ */ new Date()).toISOString();
|
|
43045
|
+
const dateRange = { startDate: ga4RelativeDate(historyDays), endDate: ga4RelativeDate(0) };
|
|
43046
|
+
ga4Log("info", "fetch-daily-totals.start", { propertyId, days: historyDays });
|
|
43047
|
+
const [totalsRes, organicRes] = await batchRunReports(accessToken, propertyId, [
|
|
43048
|
+
{
|
|
43049
|
+
dateRanges: [dateRange],
|
|
43050
|
+
dimensions: [{ name: GA4_DIMENSIONS.date }],
|
|
43051
|
+
metrics: [
|
|
43052
|
+
{ name: GA4_METRICS.sessions },
|
|
43053
|
+
{ name: GA4_METRICS.totalUsers },
|
|
43054
|
+
{ name: GA4_METRICS.engagementRate },
|
|
43055
|
+
{ name: GA4_METRICS.newUsers },
|
|
43056
|
+
{ name: GA4_METRICS.activeUsers },
|
|
43057
|
+
{ name: GA4_METRICS.screenPageViews },
|
|
43058
|
+
{ name: GA4_METRICS.eventCount },
|
|
43059
|
+
{ name: GA4_METRICS.keyEvents },
|
|
43060
|
+
{ name: GA4_METRICS.userEngagementDuration },
|
|
43061
|
+
{ name: GA4_METRICS.bounceRate }
|
|
43062
|
+
],
|
|
43063
|
+
limit: historyDays + 1
|
|
43064
|
+
},
|
|
43065
|
+
{
|
|
43066
|
+
dateRanges: [dateRange],
|
|
43067
|
+
dimensions: [{ name: GA4_DIMENSIONS.date }],
|
|
43068
|
+
metrics: [{ name: GA4_METRICS.sessions }],
|
|
43069
|
+
dimensionFilter: {
|
|
43070
|
+
filter: {
|
|
43071
|
+
fieldName: GA4_DIMENSIONS.sessionDefaultChannelGrouping,
|
|
43072
|
+
stringFilter: { matchType: "EXACT", value: "Organic Search" }
|
|
43073
|
+
}
|
|
43074
|
+
},
|
|
43075
|
+
limit: historyDays + 1
|
|
43076
|
+
}
|
|
43077
|
+
]);
|
|
43078
|
+
const organicByDate = /* @__PURE__ */ new Map();
|
|
43079
|
+
for (const row of organicRes?.rows ?? []) {
|
|
43080
|
+
const date = compactDateToIso(row.dimensionValues[0]?.value ?? "");
|
|
43081
|
+
if (date) organicByDate.set(date, parseOptionalCountMetric(row.metricValues[0]?.value) ?? 0);
|
|
43082
|
+
}
|
|
43083
|
+
const rows = (totalsRes?.rows ?? []).map((row) => {
|
|
43084
|
+
const date = compactDateToIso(row.dimensionValues[0]?.value ?? "");
|
|
43085
|
+
const metric2 = (index) => parseOptionalMetric(row.metricValues[index]?.value);
|
|
43086
|
+
const count9 = (index) => parseOptionalCountMetric(row.metricValues[index]?.value);
|
|
43012
43087
|
return {
|
|
43013
|
-
date
|
|
43088
|
+
date,
|
|
43014
43089
|
sessions: parseInt(row.metricValues[0]?.value ?? "0", 10) || 0,
|
|
43015
|
-
users:
|
|
43016
|
-
engagementRate: parseBoundedRate(
|
|
43017
|
-
newUsers
|
|
43090
|
+
users: parseInt(row.metricValues[1]?.value ?? "0", 10) || 0,
|
|
43091
|
+
engagementRate: parseBoundedRate(metric2(2)),
|
|
43092
|
+
newUsers: count9(3),
|
|
43093
|
+
activeUsers: count9(4),
|
|
43094
|
+
organicSessions: organicRes ? organicByDate.get(date) ?? 0 : null,
|
|
43095
|
+
views: count9(5),
|
|
43096
|
+
eventCount: count9(6),
|
|
43097
|
+
keyEvents: metric2(7),
|
|
43098
|
+
engagementSeconds: metric2(8),
|
|
43099
|
+
bounceRate: parseBoundedRate(metric2(9))
|
|
43018
43100
|
};
|
|
43019
43101
|
}).filter((row) => row.date.length > 0);
|
|
43020
|
-
|
|
43021
|
-
|
|
43102
|
+
const timeZone = reportTimeZone(totalsRes, organicRes) ?? "UTC";
|
|
43103
|
+
ga4Log("info", "fetch-daily-totals.done", { propertyId, days: historyDays, timeZone, rows: rows.length });
|
|
43104
|
+
return {
|
|
43105
|
+
startDate: isoDateDaysBeforeInTimeZone(requestedAt, historyDays, timeZone),
|
|
43106
|
+
endDate: isoDateDaysBeforeInTimeZone(requestedAt, 0, timeZone),
|
|
43107
|
+
rows
|
|
43108
|
+
};
|
|
43022
43109
|
}
|
|
43023
43110
|
var WINDOW_DAYS2 = { "7d": 7, "30d": 30, "90d": 90 };
|
|
43024
43111
|
async function fetchWindowSummary(accessToken, propertyId, windowKey) {
|
|
@@ -43080,6 +43167,84 @@ async function fetchWindowSummary(accessToken, propertyId, windowKey) {
|
|
|
43080
43167
|
ga4Log("info", "fetch-window-summary.done", { propertyId, ...summary3 });
|
|
43081
43168
|
return summary3;
|
|
43082
43169
|
}
|
|
43170
|
+
var COMPARISON_RANGE_NAMES = { current: "current", previous: "previous" };
|
|
43171
|
+
async function fetchWindowMetrics(accessToken, propertyId, windowKey, options = {}) {
|
|
43172
|
+
validateAccessToken2(accessToken);
|
|
43173
|
+
validatePropertyId(propertyId);
|
|
43174
|
+
const requestedAt = options.now ?? /* @__PURE__ */ new Date();
|
|
43175
|
+
const daysAgo = gaOverviewComparisonDaysAgo(windowKey);
|
|
43176
|
+
const dateRanges = [
|
|
43177
|
+
{ startDate: ga4RelativeDate(daysAgo.current.start), endDate: ga4RelativeDate(daysAgo.current.end), name: COMPARISON_RANGE_NAMES.current },
|
|
43178
|
+
{ startDate: ga4RelativeDate(daysAgo.previous.start), endDate: ga4RelativeDate(daysAgo.previous.end), name: COMPARISON_RANGE_NAMES.previous }
|
|
43179
|
+
];
|
|
43180
|
+
ga4Log("info", "fetch-window-metrics.start", { propertyId, windowKey });
|
|
43181
|
+
const [totalsRes, organicRes] = await batchRunReports(accessToken, propertyId, [
|
|
43182
|
+
{
|
|
43183
|
+
dateRanges,
|
|
43184
|
+
dimensions: [],
|
|
43185
|
+
metrics: [
|
|
43186
|
+
{ name: GA4_METRICS.activeUsers },
|
|
43187
|
+
{ name: GA4_METRICS.newUsers },
|
|
43188
|
+
{ name: GA4_METRICS.totalUsers },
|
|
43189
|
+
{ name: GA4_METRICS.sessions },
|
|
43190
|
+
{ name: GA4_METRICS.screenPageViews },
|
|
43191
|
+
{ name: GA4_METRICS.eventCount },
|
|
43192
|
+
{ name: GA4_METRICS.keyEvents },
|
|
43193
|
+
{ name: GA4_METRICS.engagementRate },
|
|
43194
|
+
{ name: GA4_METRICS.bounceRate },
|
|
43195
|
+
{ name: GA4_METRICS.userEngagementDuration }
|
|
43196
|
+
],
|
|
43197
|
+
limit: dateRanges.length
|
|
43198
|
+
},
|
|
43199
|
+
{
|
|
43200
|
+
dateRanges,
|
|
43201
|
+
dimensions: [],
|
|
43202
|
+
metrics: [{ name: GA4_METRICS.sessions }],
|
|
43203
|
+
dimensionFilter: {
|
|
43204
|
+
filter: {
|
|
43205
|
+
fieldName: GA4_DIMENSIONS.sessionDefaultChannelGrouping,
|
|
43206
|
+
stringFilter: { matchType: "EXACT", value: "Organic Search" }
|
|
43207
|
+
}
|
|
43208
|
+
},
|
|
43209
|
+
limit: dateRanges.length
|
|
43210
|
+
}
|
|
43211
|
+
]);
|
|
43212
|
+
const rowFor = (res, name) => {
|
|
43213
|
+
const index = Math.max(0, (res?.dimensionHeaders ?? []).findIndex((header2) => header2.name === "dateRange"));
|
|
43214
|
+
return res?.rows?.find((row) => row.dimensionValues[index]?.value === name);
|
|
43215
|
+
};
|
|
43216
|
+
const period2 = (name, range) => {
|
|
43217
|
+
const totals = rowFor(totalsRes, name);
|
|
43218
|
+
const organic = rowFor(organicRes, name);
|
|
43219
|
+
const metric2 = (index) => parseOptionalMetric(totals?.metricValues[index]?.value);
|
|
43220
|
+
const count9 = (index) => parseOptionalCountMetric(totals?.metricValues[index]?.value);
|
|
43221
|
+
return {
|
|
43222
|
+
...range,
|
|
43223
|
+
activeUsers: count9(0),
|
|
43224
|
+
newUsers: count9(1),
|
|
43225
|
+
totalUsers: count9(2),
|
|
43226
|
+
sessions: count9(3),
|
|
43227
|
+
views: count9(4),
|
|
43228
|
+
eventCount: count9(5),
|
|
43229
|
+
keyEvents: metric2(6),
|
|
43230
|
+
engagementRate: parseBoundedRate(metric2(7)),
|
|
43231
|
+
bounceRate: parseBoundedRate(metric2(8)),
|
|
43232
|
+
engagementSeconds: metric2(9),
|
|
43233
|
+
// A period with sessions but no Organic Search row had none; a period
|
|
43234
|
+
// GA4 sent nothing for stays unknown.
|
|
43235
|
+
organicSessions: organic ? parseOptionalCountMetric(organic.metricValues[0]?.value) : totals ? 0 : null
|
|
43236
|
+
};
|
|
43237
|
+
};
|
|
43238
|
+
const timeZone = reportTimeZone(totalsRes, organicRes) ?? "UTC";
|
|
43239
|
+
const ranges = gaOverviewComparisonRanges(windowKey, requestedAt, timeZone);
|
|
43240
|
+
const result = {
|
|
43241
|
+
windowKey,
|
|
43242
|
+
current: period2(COMPARISON_RANGE_NAMES.current, ranges.current),
|
|
43243
|
+
previous: period2(COMPARISON_RANGE_NAMES.previous, ranges.previous)
|
|
43244
|
+
};
|
|
43245
|
+
ga4Log("info", "fetch-window-metrics.done", { propertyId, windowKey, timeZone });
|
|
43246
|
+
return result;
|
|
43247
|
+
}
|
|
43083
43248
|
async function fetchAiReferrals(accessToken, propertyId, days) {
|
|
43084
43249
|
validateAccessToken2(accessToken);
|
|
43085
43250
|
validatePropertyId(propertyId);
|
|
@@ -53442,6 +53607,111 @@ function buildSessionHistory(landingPageDays, dailyTotals) {
|
|
|
53442
53607
|
});
|
|
53443
53608
|
}
|
|
53444
53609
|
|
|
53610
|
+
// ../api-routes/src/ga-overview.ts
|
|
53611
|
+
function parseGaOverviewWindow(value) {
|
|
53612
|
+
if (value === void 0 || value === "") return "30d";
|
|
53613
|
+
if (!isGaOverviewWindow(value)) throw validationError(`Invalid window "${value}": the GA4 overview supports 7d, 30d or 90d.`);
|
|
53614
|
+
return value;
|
|
53615
|
+
}
|
|
53616
|
+
var NO_VALUES = {
|
|
53617
|
+
activeUsers: null,
|
|
53618
|
+
newUsers: null,
|
|
53619
|
+
totalUsers: null,
|
|
53620
|
+
sessions: null,
|
|
53621
|
+
organicSessions: null,
|
|
53622
|
+
views: null,
|
|
53623
|
+
eventCount: null,
|
|
53624
|
+
keyEvents: null,
|
|
53625
|
+
engagementRate: null,
|
|
53626
|
+
bounceRate: null,
|
|
53627
|
+
averageEngagementTimeSeconds: null
|
|
53628
|
+
};
|
|
53629
|
+
var NO_TRAFFIC_DAY = {
|
|
53630
|
+
...NO_VALUES,
|
|
53631
|
+
activeUsers: 0,
|
|
53632
|
+
newUsers: 0,
|
|
53633
|
+
totalUsers: 0,
|
|
53634
|
+
sessions: 0,
|
|
53635
|
+
organicSessions: 0,
|
|
53636
|
+
views: 0,
|
|
53637
|
+
eventCount: 0,
|
|
53638
|
+
keyEvents: 0
|
|
53639
|
+
};
|
|
53640
|
+
function averageEngagementSeconds(engagementSeconds, activeUsers) {
|
|
53641
|
+
if (engagementSeconds === null || activeUsers === null || activeUsers <= 0) return null;
|
|
53642
|
+
return engagementSeconds / activeUsers;
|
|
53643
|
+
}
|
|
53644
|
+
function periodValues(row) {
|
|
53645
|
+
if (!row) return NO_VALUES;
|
|
53646
|
+
return {
|
|
53647
|
+
activeUsers: row.activeUsers,
|
|
53648
|
+
newUsers: row.newUsers,
|
|
53649
|
+
totalUsers: row.totalUsers,
|
|
53650
|
+
sessions: row.sessions,
|
|
53651
|
+
organicSessions: row.organicSessions,
|
|
53652
|
+
views: row.views,
|
|
53653
|
+
eventCount: row.eventCount,
|
|
53654
|
+
keyEvents: row.keyEvents,
|
|
53655
|
+
engagementRate: row.engagementRate,
|
|
53656
|
+
bounceRate: row.bounceRate,
|
|
53657
|
+
averageEngagementTimeSeconds: averageEngagementSeconds(row.engagementSeconds, row.activeUsers)
|
|
53658
|
+
};
|
|
53659
|
+
}
|
|
53660
|
+
function dayValues(row) {
|
|
53661
|
+
return {
|
|
53662
|
+
activeUsers: row.activeUsers,
|
|
53663
|
+
newUsers: row.newUsers,
|
|
53664
|
+
totalUsers: row.users,
|
|
53665
|
+
sessions: row.sessions,
|
|
53666
|
+
organicSessions: row.organicSessions,
|
|
53667
|
+
views: row.views,
|
|
53668
|
+
eventCount: row.eventCount,
|
|
53669
|
+
keyEvents: row.keyEvents,
|
|
53670
|
+
engagementRate: row.engagementRate,
|
|
53671
|
+
bounceRate: row.bounceRate,
|
|
53672
|
+
averageEngagementTimeSeconds: averageEngagementSeconds(row.engagementSeconds, row.activeUsers)
|
|
53673
|
+
};
|
|
53674
|
+
}
|
|
53675
|
+
function changeOf(totals, previous) {
|
|
53676
|
+
const change = {};
|
|
53677
|
+
for (const key of GA_OVERVIEW_METRIC_ORDER) {
|
|
53678
|
+
const current = totals[key];
|
|
53679
|
+
const prior = previous[key];
|
|
53680
|
+
change[key] = current === null || prior === null ? null : deltaPercent(current, prior);
|
|
53681
|
+
}
|
|
53682
|
+
return change;
|
|
53683
|
+
}
|
|
53684
|
+
function buildGaOverview(input) {
|
|
53685
|
+
const current = input.current ?? input.fallback.current;
|
|
53686
|
+
const previous = input.previous ?? input.fallback.previous;
|
|
53687
|
+
const synced = input.current !== null && input.previous !== null;
|
|
53688
|
+
const byDate = new Map(input.daily.map((row) => [row.date, row]));
|
|
53689
|
+
const valuesOn = (date) => {
|
|
53690
|
+
const row = byDate.get(date);
|
|
53691
|
+
if (row) return dayValues(row);
|
|
53692
|
+
return synced ? NO_TRAFFIC_DAY : NO_VALUES;
|
|
53693
|
+
};
|
|
53694
|
+
const dayCount = inclusiveDayCount(current.startDate, current.endDate) ?? 0;
|
|
53695
|
+
const days = [];
|
|
53696
|
+
for (let index = 0; index < dayCount; index++) {
|
|
53697
|
+
const date = shiftIsoCalendarDate(current.startDate, index);
|
|
53698
|
+
const previousDate = shiftIsoCalendarDate(previous.startDate, index);
|
|
53699
|
+
days.push({ date, previousDate, values: valuesOn(date), previousValues: valuesOn(previousDate) });
|
|
53700
|
+
}
|
|
53701
|
+
const totals = periodValues(input.current);
|
|
53702
|
+
const previousTotals = periodValues(input.previous);
|
|
53703
|
+
return {
|
|
53704
|
+
window: input.window,
|
|
53705
|
+
current: { startDate: current.startDate, endDate: current.endDate },
|
|
53706
|
+
previous: { startDate: previous.startDate, endDate: previous.endDate },
|
|
53707
|
+
totals,
|
|
53708
|
+
previousTotals,
|
|
53709
|
+
changePct: changeOf(totals, previousTotals),
|
|
53710
|
+
days,
|
|
53711
|
+
syncedAt: input.current?.syncedAt ?? null
|
|
53712
|
+
};
|
|
53713
|
+
}
|
|
53714
|
+
|
|
53445
53715
|
// ../api-routes/src/ga-source-mover.ts
|
|
53446
53716
|
function moverChangeBasis(prior) {
|
|
53447
53717
|
if (prior <= 0) return GaMoverChangeBases.new;
|
|
@@ -54106,6 +54376,8 @@ async function ga4Routes(app, opts) {
|
|
|
54106
54376
|
}
|
|
54107
54377
|
app.db.delete(gaTrafficSnapshots).where(eq69(gaTrafficSnapshots.projectId, project.id)).run();
|
|
54108
54378
|
app.db.delete(gaTrafficSummaries).where(eq69(gaTrafficSummaries.projectId, project.id)).run();
|
|
54379
|
+
app.db.delete(gaTrafficWindowSummaries).where(eq69(gaTrafficWindowSummaries.projectId, project.id)).run();
|
|
54380
|
+
app.db.delete(gaWindowMetrics).where(eq69(gaWindowMetrics.projectId, project.id)).run();
|
|
54109
54381
|
app.db.delete(gaDailyTotals).where(eq69(gaDailyTotals.projectId, project.id)).run();
|
|
54110
54382
|
app.db.delete(gaAiReferrals).where(eq69(gaAiReferrals.projectId, project.id)).run();
|
|
54111
54383
|
app.db.delete(gaSocialReferrals).where(eq69(gaSocialReferrals.projectId, project.id)).run();
|
|
@@ -54208,7 +54480,8 @@ async function ga4Routes(app, opts) {
|
|
|
54208
54480
|
const fetches = [
|
|
54209
54481
|
fetchAggregateSummary(accessToken, propertyId, days),
|
|
54210
54482
|
...WINDOW_KEYS.map((w) => fetchWindowSummary(accessToken, propertyId, w)),
|
|
54211
|
-
fetchDailyTotals(accessToken, propertyId,
|
|
54483
|
+
fetchDailyTotals(accessToken, propertyId),
|
|
54484
|
+
...WINDOW_KEYS.map((w) => fetchWindowMetrics(accessToken, propertyId, w))
|
|
54212
54485
|
];
|
|
54213
54486
|
if (syncTraffic) fetches.push(fetchTrafficByLandingPage(accessToken, propertyId, days));
|
|
54214
54487
|
if (syncAi) fetches.push(fetchAiReferrals(accessToken, propertyId, days));
|
|
@@ -54223,7 +54496,8 @@ async function ga4Routes(app, opts) {
|
|
|
54223
54496
|
const summary3 = results[0];
|
|
54224
54497
|
const windowSummaries = results.slice(1, 1 + WINDOW_KEYS.length);
|
|
54225
54498
|
const dailyTotals = results[1 + WINDOW_KEYS.length];
|
|
54226
|
-
|
|
54499
|
+
const windowMetrics = results.slice(2 + WINDOW_KEYS.length, 2 + 2 * WINDOW_KEYS.length);
|
|
54500
|
+
let idx = 2 + 2 * WINDOW_KEYS.length;
|
|
54227
54501
|
if (syncTraffic) {
|
|
54228
54502
|
rows = results[idx++];
|
|
54229
54503
|
}
|
|
@@ -54262,11 +54536,11 @@ async function ga4Routes(app, opts) {
|
|
|
54262
54536
|
tx.delete(gaDailyTotals).where(
|
|
54263
54537
|
and58(
|
|
54264
54538
|
eq69(gaDailyTotals.projectId, project.id),
|
|
54265
|
-
sql23`${gaDailyTotals.date} >= ${
|
|
54266
|
-
sql23`${gaDailyTotals.date} <= ${
|
|
54539
|
+
sql23`${gaDailyTotals.date} >= ${dailyTotals.startDate}`,
|
|
54540
|
+
sql23`${gaDailyTotals.date} <= ${dailyTotals.endDate}`
|
|
54267
54541
|
)
|
|
54268
54542
|
).run();
|
|
54269
|
-
for (const row of dailyTotals) {
|
|
54543
|
+
for (const row of dailyTotals.rows) {
|
|
54270
54544
|
tx.insert(gaDailyTotals).values({
|
|
54271
54545
|
id: crypto45.randomUUID(),
|
|
54272
54546
|
projectId: project.id,
|
|
@@ -54279,11 +54553,47 @@ async function ga4Routes(app, opts) {
|
|
|
54279
54553
|
// row keeps only what GA4 actually reported.
|
|
54280
54554
|
engagementRate: row.engagementRate,
|
|
54281
54555
|
newUsers: row.newUsers,
|
|
54556
|
+
activeUsers: row.activeUsers,
|
|
54557
|
+
organicSessions: row.organicSessions,
|
|
54558
|
+
views: row.views,
|
|
54559
|
+
eventCount: row.eventCount,
|
|
54560
|
+
keyEvents: row.keyEvents,
|
|
54561
|
+
engagementSeconds: row.engagementSeconds,
|
|
54562
|
+
bounceRate: row.bounceRate,
|
|
54282
54563
|
syncedAt: now,
|
|
54283
54564
|
syncRunId: runId,
|
|
54284
54565
|
createdAt: now
|
|
54285
54566
|
}).run();
|
|
54286
54567
|
}
|
|
54568
|
+
tx.delete(gaWindowMetrics).where(eq69(gaWindowMetrics.projectId, project.id)).run();
|
|
54569
|
+
for (const windowMetric of windowMetrics) {
|
|
54570
|
+
for (const [period2, totals] of [
|
|
54571
|
+
[GaOverviewPeriods.current, windowMetric.current],
|
|
54572
|
+
[GaOverviewPeriods.previous, windowMetric.previous]
|
|
54573
|
+
]) {
|
|
54574
|
+
tx.insert(gaWindowMetrics).values({
|
|
54575
|
+
id: crypto45.randomUUID(),
|
|
54576
|
+
projectId: project.id,
|
|
54577
|
+
windowKey: windowMetric.windowKey,
|
|
54578
|
+
period: period2,
|
|
54579
|
+
startDate: totals.startDate,
|
|
54580
|
+
endDate: totals.endDate,
|
|
54581
|
+
activeUsers: totals.activeUsers,
|
|
54582
|
+
newUsers: totals.newUsers,
|
|
54583
|
+
totalUsers: totals.totalUsers,
|
|
54584
|
+
sessions: totals.sessions,
|
|
54585
|
+
organicSessions: totals.organicSessions,
|
|
54586
|
+
views: totals.views,
|
|
54587
|
+
eventCount: totals.eventCount,
|
|
54588
|
+
keyEvents: totals.keyEvents,
|
|
54589
|
+
engagementRate: totals.engagementRate,
|
|
54590
|
+
bounceRate: totals.bounceRate,
|
|
54591
|
+
engagementSeconds: totals.engagementSeconds,
|
|
54592
|
+
syncedAt: now,
|
|
54593
|
+
syncRunId: runId
|
|
54594
|
+
}).run();
|
|
54595
|
+
}
|
|
54596
|
+
}
|
|
54287
54597
|
if (syncAi) {
|
|
54288
54598
|
tx.delete(gaAiReferrals).where(
|
|
54289
54599
|
and58(
|
|
@@ -54498,10 +54808,10 @@ async function ga4Routes(app, opts) {
|
|
|
54498
54808
|
totalUsers: summary3.totalUsers,
|
|
54499
54809
|
...only ? { only } : {}
|
|
54500
54810
|
});
|
|
54501
|
-
const counts2 = { rows: rows.length + dailyTotals.length + aiReferrals.length + socialReferrals.length };
|
|
54811
|
+
const counts2 = { rows: rows.length + dailyTotals.rows.length + aiReferrals.length + socialReferrals.length };
|
|
54502
54812
|
if (componentFailure) {
|
|
54503
54813
|
outcome2.report({ status: OutcomeStatuses.partial, ...classifyOutcomeError(componentFailure.error), counts: counts2 });
|
|
54504
|
-
} else if (rows.length === 0 && dailyTotals.length === 0) {
|
|
54814
|
+
} else if (rows.length === 0 && dailyTotals.rows.length === 0) {
|
|
54505
54815
|
outcome2.report({ status: OutcomeStatuses.skipped, reasonCode: OutcomeReasonCodes.NO_DATA, counts: counts2 });
|
|
54506
54816
|
} else {
|
|
54507
54817
|
outcome2.report({ status: OutcomeStatuses.succeeded, counts: counts2 });
|
|
@@ -54927,6 +55237,23 @@ async function ga4Routes(app, opts) {
|
|
|
54927
55237
|
};
|
|
54928
55238
|
return response;
|
|
54929
55239
|
});
|
|
55240
|
+
app.get("/projects/:name/ga/overview", async (request, _reply) => {
|
|
55241
|
+
const project = resolveProject(app.db, request.params.name);
|
|
55242
|
+
requireGa4Connection(opts, project.name, project.canonicalDomain);
|
|
55243
|
+
const window = parseGaOverviewWindow(request.query.window);
|
|
55244
|
+
const periodRows = app.db.select().from(gaWindowMetrics).where(and58(eq69(gaWindowMetrics.projectId, project.id), eq69(gaWindowMetrics.windowKey, window))).all();
|
|
55245
|
+
const current = periodRows.find((row) => row.period === GaOverviewPeriods.current) ?? null;
|
|
55246
|
+
const previous = periodRows.find((row) => row.period === GaOverviewPeriods.previous) ?? null;
|
|
55247
|
+
const fallback = gaOverviewComparisonRanges(window);
|
|
55248
|
+
const from = previous?.startDate ?? fallback.previous.startDate;
|
|
55249
|
+
const to = current?.endDate ?? fallback.current.endDate;
|
|
55250
|
+
const daily = app.db.select().from(gaDailyTotals).where(and58(
|
|
55251
|
+
eq69(gaDailyTotals.projectId, project.id),
|
|
55252
|
+
sql23`${gaDailyTotals.date} >= ${from}`,
|
|
55253
|
+
sql23`${gaDailyTotals.date} <= ${to}`
|
|
55254
|
+
)).all();
|
|
55255
|
+
return buildGaOverview({ window, current, previous, daily, fallback });
|
|
55256
|
+
});
|
|
54930
55257
|
app.get("/projects/:name/ga/session-history", async (request, _reply) => {
|
|
54931
55258
|
const project = resolveProject(app.db, request.params.name);
|
|
54932
55259
|
requireGa4Connection(opts, project.name, project.canonicalDomain);
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
siteCrawlGraphNodes,
|
|
6
6
|
siteCrawlPages,
|
|
7
7
|
siteCrawlSnapshots
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-37YB52NM.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-QAGZQ2DY.js";
|
|
19
19
|
|
|
20
20
|
// src/site-audit-factors.ts
|
|
21
21
|
function recordedSharePct(factor) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApiClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-V4V7WOHY.js";
|
|
4
4
|
import {
|
|
5
5
|
emitJsonl
|
|
6
6
|
} from "./chunk-Z7IUAJOF.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
formatMicros,
|
|
20
20
|
formatRunErrorOneLine,
|
|
21
21
|
resolveProviderInput
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QAGZQ2DY.js";
|
|
23
23
|
|
|
24
24
|
// src/commands/run.ts
|
|
25
25
|
function getClient() {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
AppError,
|
|
6
6
|
parseWindowIn,
|
|
7
7
|
resolveDateRange
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QAGZQ2DY.js";
|
|
9
9
|
|
|
10
10
|
// src/cli-access.ts
|
|
11
11
|
var CLI_ACCESS_BY_ID = Object.freeze({
|
|
@@ -149,6 +149,7 @@ var CLI_ACCESS_BY_ID = Object.freeze({
|
|
|
149
149
|
"ga.measurement-analysis": "stored",
|
|
150
150
|
"ga.properties": "live",
|
|
151
151
|
"ga.search-landing-pages": "stored",
|
|
152
|
+
"ga.overview": "stored",
|
|
152
153
|
"ga.session-history": "stored",
|
|
153
154
|
"ga.social-referral-history": "stored",
|
|
154
155
|
"ga.social-referral-summary": "stored",
|