@siteoshq/cli 2.2.0 → 2.3.1

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/README.md CHANGED
@@ -311,6 +311,9 @@ when requested with `npx playwright@1.61.1 install chromium` or `npx playwright@
311
311
  The check opens fresh contexts, exercises the public consent API and reports request origins and
312
312
  storage names without values, query strings, request bodies or authenticated sessions. These are
313
313
  real visits; normal installation/aggregate signals may be recorded. Reports remain local.
314
+ CLI 2.3.1 distinguishes the `/gtm.js` container bootstrap from `/gtag/js` and recognizes
315
+ regional GA4 `/g/collect` endpoints. Loading GTM to run the consent manager is not itself
316
+ evidence that an Analytics tag ran; a GA4 request after withdrawal remains a failure in Basic mode.
314
317
 
315
318
  A report records the revision, runtime, observed Edge location, scenario scope and 24-hour expiry.
316
319
  `passed` exits 0; `needs-review` and `failed` exit 1. Unknown origins/storage require classification.
package/dist/cli.js CHANGED
@@ -38,8 +38,12 @@ function assessCookieObservations(input) {
38
38
  const unknownStorage = /* @__PURE__ */ new Set();
39
39
  const services = input.envelope.config.services;
40
40
  for (const request of input.requests) {
41
+ if (request.origin === "https://www.googletagmanager.com" && request.path === "/gtm.js" && request.type === "script")
42
+ continue;
41
43
  const matches = services.filter(
42
- (service) => service.lifecycle && [
44
+ (service) => service.key === "google-analytics" && /^https:\/\/(?:www\.|region\d+\.)?google-analytics\.com$/u.test(
45
+ request.origin
46
+ ) && request.path === "/g/collect" || service.lifecycle && [
43
47
  ...service.lifecycle.scriptOrigins,
44
48
  ...service.lifecycle.iframeOrigins,
45
49
  ...service.lifecycle.pixelOrigins
@@ -157,6 +161,7 @@ async function verifyCookieWebsite(input) {
157
161
  }
158
162
  requests.push({
159
163
  origin: new URL(request.url()).origin,
164
+ path: new URL(request.url()).pathname,
160
165
  type: request.resourceType(),
161
166
  scenario
162
167
  });
@@ -7842,6 +7847,7 @@ var filters = [
7842
7847
  var TRACE_EXPLORER_FLAGS = {
7843
7848
  coverage: ["environment"],
7844
7849
  "gtm summary": ["environment", "period"],
7850
+ "ga4 show": ["environment"],
7845
7851
  "notifications show": ["environment"],
7846
7852
  "notifications destinations": ["environment", "cursor"],
7847
7853
  destinations: filters,
@@ -7948,6 +7954,7 @@ function traceExplorerSuffix(route, values) {
7948
7954
  }
7949
7955
  const suffix = {
7950
7956
  "gtm summary": "gtm/summary",
7957
+ "ga4 show": "ga4",
7951
7958
  "notifications show": "notifications",
7952
7959
  "notifications destinations": "notification-destinations"
7953
7960
  }[route] ?? route;
@@ -7993,6 +8000,10 @@ Usage:
7993
8000
  siteos trace environments [--json]
7994
8001
  siteos trace report [--environment <slug>] [--json]
7995
8002
  siteos trace coverage [--environment <slug>] [--json]
8003
+ siteos trace ga4 show [--environment <slug>] [--json]
8004
+ siteos trace ga4 bind --input <json-file> [--environment <slug>] [--json]
8005
+ siteos trace ga4 sync --input <json-file> [--environment <slug>] [--json]
8006
+ siteos trace ga4 disconnect --input <json-file> [--environment <slug>] [--json]
7996
8007
  siteos trace gtm summary [--environment <slug>] [--period <24h|7d>] [--json]
7997
8008
  siteos trace notifications show [--environment <slug>] [--json]
7998
8009
  siteos trace notifications destinations [--environment <slug>] [--cursor <cursor>] [--json]
@@ -8096,6 +8107,9 @@ async function runServiceCommand(service, options) {
8096
8107
  environments: [],
8097
8108
  report: ["environment"],
8098
8109
  ...TRACE_EXPLORER_FLAGS,
8110
+ "ga4 bind": ["environment", "input"],
8111
+ "ga4 sync": ["environment", "input"],
8112
+ "ga4 disconnect": ["environment", "input"],
8099
8113
  "notifications save": ["environment", "input"],
8100
8114
  "notifications retry": ["environment", "input"],
8101
8115
  "schema restart": ["environment", "input"],
@@ -8295,7 +8309,7 @@ async function runServiceCommand(service, options) {
8295
8309
  result = await request(site);
8296
8310
  else if (action === "environments" && positionals.length === 1)
8297
8311
  result = await request(`${site}/environments`);
8298
- else if (action === "notifications" || action === "schema" || action === "report" || action === "installation" || action === "tracking-plan" || explorerSuffix !== null) {
8312
+ else if (action === "ga4" || action === "notifications" || action === "schema" || action === "report" || action === "installation" || action === "tracking-plan" || explorerSuffix !== null) {
8299
8313
  const response = z13.object({
8300
8314
  environments: z13.array(
8301
8315
  z13.object({ id: z13.string(), slug: z13.string() })
@@ -8324,6 +8338,12 @@ async function runServiceCommand(service, options) {
8324
8338
  const base = `/environments/${encodeURIComponent(matches[0].id)}`;
8325
8339
  if (explorerSuffix !== null) {
8326
8340
  result = await request(`${base}${explorerSuffix}`);
8341
+ } else if (action === "ga4") {
8342
+ result = await request(
8343
+ `${base}/ga4/${subaction}`,
8344
+ "POST",
8345
+ await inputFile()
8346
+ );
8327
8347
  } else if (route === "notifications retry" || route === "schema restart") {
8328
8348
  result = await request(
8329
8349
  `${base}/${route === "schema restart" ? "schema-baselines/reset" : "notification-retries"}`,