[object Object]

← back to Ga4 Dashboard

Add GA4 fleet traffic dashboard (local, port 9710)

f917b8b3abd4ec3bba0fc204f2c6cab032b54603 · 2026-08-04 13:49:53 -0700 · Steve Abrams

ETL script (etl.py) auto-discovers all accounts + properties via GA4 Admin API,
pulls 7d + 30d traffic metrics, writes cache/data.json. Server (server.js) serves
the cache instantly with basic-auth, sort, density slider, grid/table toggle, and
drill-down links to GA4 reports. 126 properties across 2 accounts, 0 errors, $0 cost.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files touched

Diff

commit f917b8b3abd4ec3bba0fc204f2c6cab032b54603
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Aug 4 13:49:53 2026 -0700

    Add GA4 fleet traffic dashboard (local, port 9710)
    
    ETL script (etl.py) auto-discovers all accounts + properties via GA4 Admin API,
    pulls 7d + 30d traffic metrics, writes cache/data.json. Server (server.js) serves
    the cache instantly with basic-auth, sort, density slider, grid/table toggle, and
    drill-down links to GA4 reports. 126 properties across 2 accounts, 0 errors, $0 cost.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---
 .gitignore                      |   6 +
 etl.py                          | 178 +++++++++
 launchd/com.steve.ga4-etl.plist |  48 +++
 package-lock.json               | 867 ++++++++++++++++++++++++++++++++++++++++
 package.json                    |  15 +
 server.js                       | 631 +++++++++++++++++++++++++++++
 6 files changed, 1745 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cc987ba
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+node_modules/
+.env*
+tmp/
+*.log
+.DS_Store
+cache/
diff --git a/etl.py b/etl.py
new file mode 100644
index 0000000..06a0ec2
--- /dev/null
+++ b/etl.py
@@ -0,0 +1,178 @@
+#!/usr/bin/env python3
+"""
+GA4 Fleet Traffic ETL — reads from the GA4 Data API and writes to cache/data.json.
+
+Usage:
+    python3 etl.py                    # full refresh (7d + 30d for all properties)
+    python3 etl.py --dry-run          # list properties only, no data pull
+
+Cost: $0 local — GA4 Data API quota is free up to 200k tokens/day.
+      This script issues 2 RunReport calls per property (7d + 30d).
+      With 126 properties that is 252 API calls — within free quota.
+
+Schedule (Steve-gated, do not auto-install):
+    Hourly via crontab:
+        0 * * * * cd /Users/macstudio3/Projects/ga4-dashboard && python3 etl.py >> /tmp/ga4-etl.log 2>&1
+    Or via launchd plist (see launchd/com.steve.ga4-etl.plist).
+"""
+from __future__ import annotations
+
+import argparse
+import json
+import os
+import sys
+import time
+from datetime import datetime, timezone
+from pathlib import Path
+
+# Auth
+SKILLS_DIR = Path.home() / ".claude" / "skills" / "analytics" / "scripts"
+sys.path.insert(0, str(SKILLS_DIR))
+from _auth import ensure_credentials  # noqa: E402
+
+CACHE_DIR = Path(__file__).parent / "cache"
+CACHE_FILE = CACHE_DIR / "data.json"
+CONFIG_DIR = Path.home() / ".config" / "ga-analytics-agent"
+
+
+def list_all_accounts(client) -> list[str]:
+    """Return every account name the SA can see."""
+    try:
+        return [a.name for a in client.list_accounts()]
+    except Exception as e:
+        print(f"WARNING: list_accounts failed: {e}", file=sys.stderr)
+        return []
+
+
+def list_properties_for_account(client, account_name: str) -> list[dict]:
+    """Return property dicts for one account."""
+    props = []
+    try:
+        for p in client.list_properties(request={"filter": f"parent:{account_name}"}):
+            pid = p.name.split("/")[-1]
+            entry = {
+                "property_name": p.name,
+                "property_id": pid,
+                "display_name": p.display_name,
+                "account_name": account_name,
+                "measurement_id": None,
+                "domain": None,
+                "create_time": p.create_time.isoformat() if p.create_time else None,
+                "update_time": p.update_time.isoformat() if p.update_time else None,
+            }
+            # Get web stream measurement ID + domain
+            try:
+                for s in client.list_data_streams(parent=p.name):
+                    if s.type_.name == "WEB_DATA_STREAM":
+                        entry["measurement_id"] = s.web_stream_data.measurement_id
+                        entry["domain"] = s.web_stream_data.default_uri
+                        break
+            except Exception:
+                pass
+            props.append(entry)
+    except Exception as e:
+        print(f"WARNING: list_properties for {account_name} failed: {e}", file=sys.stderr)
+    return props
+
+
+def run_report_totals(data_client, property_id: str, start: str, end: str) -> dict:
+    """Return {sessions, activeUsers, screenPageViews} summed over the date range."""
+    from google.analytics.data_v1beta.types import DateRange, Metric, RunReportRequest
+
+    req = RunReportRequest(
+        property=f"properties/{property_id}",
+        date_ranges=[DateRange(start_date=start, end_date=end)],
+        metrics=[
+            Metric(name="sessions"),
+            Metric(name="activeUsers"),
+            Metric(name="screenPageViews"),
+        ],
+    )
+    resp = data_client.run_report(req)
+    if not resp.rows:
+        return {"sessions": 0, "activeUsers": 0, "screenPageViews": 0}
+    # No dimensions so there's exactly 1 summary row
+    row = resp.rows[0]
+    return {
+        "sessions": int(row.metric_values[0].value),
+        "activeUsers": int(row.metric_values[1].value),
+        "screenPageViews": int(row.metric_values[2].value),
+    }
+
+
+def main() -> int:
+    ap = argparse.ArgumentParser()
+    ap.add_argument("--dry-run", action="store_true", help="List properties only, skip data pull")
+    args = ap.parse_args()
+
+    ensure_credentials()
+
+    from google.analytics.admin import AnalyticsAdminServiceClient
+    from google.analytics.data_v1beta import BetaAnalyticsDataClient
+
+    admin_client = AnalyticsAdminServiceClient()
+    data_client = BetaAnalyticsDataClient()
+
+    # --- Step 1: discover all accounts + properties ---
+    print("Discovering accounts...")
+    account_names = list_all_accounts(admin_client)
+    print(f"  {len(account_names)} account(s): {account_names}")
+
+    all_props: list[dict] = []
+    for acct in account_names:
+        props = list_properties_for_account(admin_client, acct)
+        print(f"  {acct}: {len(props)} properties")
+        all_props.extend(props)
+
+    print(f"Total properties: {len(all_props)}")
+
+    if args.dry_run:
+        for p in all_props:
+            print(f"  {p['property_id']}  {p['display_name']}  {p['domain']}")
+        return 0
+
+    # --- Step 2: fetch 7d + 30d metrics per property ---
+    CACHE_DIR.mkdir(parents=True, exist_ok=True)
+
+    results = []
+    errors = []
+    t0 = time.time()
+    for i, prop in enumerate(all_props, 1):
+        pid = prop["property_id"]
+        name = prop["display_name"]
+        print(f"  [{i}/{len(all_props)}] {name} ({pid})", end="", flush=True)
+        entry = dict(prop)
+        try:
+            d7 = run_report_totals(data_client, pid, "7daysAgo", "yesterday")
+            d30 = run_report_totals(data_client, pid, "30daysAgo", "yesterday")
+            entry["stats_7d"] = d7
+            entry["stats_30d"] = d30
+            print(f"  sessions_7d={d7['sessions']}  sessions_30d={d30['sessions']}")
+        except Exception as e:
+            msg = str(e)
+            entry["stats_7d"] = {"sessions": 0, "activeUsers": 0, "screenPageViews": 0}
+            entry["stats_30d"] = {"sessions": 0, "activeUsers": 0, "screenPageViews": 0}
+            entry["error"] = msg
+            errors.append({"pid": pid, "name": name, "error": msg})
+            print(f"  ERROR: {msg[:80]}")
+        results.append(entry)
+        # Polite pause to avoid rate limits
+        if i % 50 == 0:
+            time.sleep(2)
+
+    elapsed = time.time() - t0
+    payload = {
+        "fetched_at": datetime.now(timezone.utc).isoformat(),
+        "elapsed_seconds": round(elapsed, 1),
+        "property_count": len(results),
+        "error_count": len(errors),
+        "properties": results,
+    }
+    CACHE_FILE.write_text(json.dumps(payload, indent=2))
+    print(f"\nWrote {CACHE_FILE} ({len(results)} properties, {len(errors)} errors, {elapsed:.0f}s)")
+    print("Cost: $0 (GA4 Data API reads are free within quota)")
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/launchd/com.steve.ga4-etl.plist b/launchd/com.steve.ga4-etl.plist
new file mode 100644
index 0000000..48c3a2e
--- /dev/null
+++ b/launchd/com.steve.ga4-etl.plist
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
+  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+  GA4 ETL hourly refresh — Steve-gated, do NOT install without approval.
+
+  To install when ready:
+    cp ~/Projects/ga4-dashboard/launchd/com.steve.ga4-etl.plist ~/Library/LaunchAgents/
+    launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.steve.ga4-etl.plist
+
+  To uninstall:
+    launchctl bootout gui/$(id -u)/com.steve.ga4-etl
+    rm ~/Library/LaunchAgents/com.steve.ga4-etl.plist
+
+  Alternatively, use crontab (simpler):
+    crontab -e
+    # add: 0 * * * * cd /Users/macstudio3/Projects/ga4-dashboard && python3 etl.py >> /tmp/ga4-etl.log 2>&1
+-->
+<plist version="1.0">
+<dict>
+  <key>Label</key>
+  <string>com.steve.ga4-etl</string>
+  <key>ProgramArguments</key>
+  <array>
+    <string>/opt/homebrew/bin/python3</string>
+    <string>/Users/macstudio3/Projects/ga4-dashboard/etl.py</string>
+  </array>
+  <key>WorkingDirectory</key>
+  <string>/Users/macstudio3/Projects/ga4-dashboard</string>
+  <key>StartInterval</key>
+  <integer>3600</integer>
+  <key>RunAtLoad</key>
+  <true/>
+  <key>StandardOutPath</key>
+  <string>/tmp/ga4-etl.log</string>
+  <key>StandardErrorPath</key>
+  <string>/tmp/ga4-etl.log</string>
+  <key>EnvironmentVariables</key>
+  <dict>
+    <key>GOOGLE_APPLICATION_CREDENTIALS</key>
+    <string>/Users/macstudio3/.config/ga-analytics-agent/service-account.json</string>
+    <key>HOME</key>
+    <string>/Users/macstudio3</string>
+    <key>PATH</key>
+    <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
+  </dict>
+</dict>
+</plist>
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..8f98425
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,867 @@
+{
+  "name": "ga4-dashboard",
+  "version": "1.0.0",
+  "lockfileVersion": 3,
+  "requires": true,
+  "packages": {
+    "": {
+      "name": "ga4-dashboard",
+      "version": "1.0.0",
+      "dependencies": {
+        "basic-auth": "^2.0.1",
+        "express": "^4.19.2"
+      }
+    },
+    "node_modules/accepts": {
+      "version": "1.3.8",
+      "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
+      "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
+      "license": "MIT",
+      "dependencies": {
+        "mime-types": "~2.1.34",
+        "negotiator": "0.6.3"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/array-flatten": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
+      "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
+      "license": "MIT"
+    },
+    "node_modules/basic-auth": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
+      "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
+      "license": "MIT",
+      "dependencies": {
+        "safe-buffer": "5.1.2"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/body-parser": {
+      "version": "1.20.6",
+      "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.6.tgz",
+      "integrity": "sha512-p5tAzS57i5MV9fZFDj9LeIiTZEufbSe2eDozP+ElheSUq1m74CRq1jI4mYNDdVs9vQztXFLuk/Gd6BWTdwRJ5g==",
+      "license": "MIT",
+      "dependencies": {
+        "bytes": "~3.1.2",
+        "content-type": "~1.0.5",
+        "debug": "2.6.9",
+        "depd": "2.0.0",
+        "destroy": "~1.2.0",
+        "http-errors": "~2.0.1",
+        "iconv-lite": "~0.4.24",
+        "on-finished": "~2.4.1",
+        "qs": "~6.15.1",
+        "raw-body": "~2.5.3",
+        "type-is": "~1.6.18",
+        "unpipe": "~1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.8",
+        "npm": "1.2.8000 || >= 1.4.16"
+      }
+    },
+    "node_modules/bytes": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+      "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/call-bind-apply-helpers": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+      "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+      "license": "MIT",
+      "dependencies": {
+        "es-errors": "^1.3.0",
+        "function-bind": "^1.1.2"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/call-bound": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
+      "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
+      "license": "MIT",
+      "dependencies": {
+        "call-bind-apply-helpers": "^1.0.2",
+        "get-intrinsic": "^1.3.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/content-disposition": {
+      "version": "0.5.4",
+      "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
+      "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
+      "license": "MIT",
+      "dependencies": {
+        "safe-buffer": "5.2.1"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/content-disposition/node_modules/safe-buffer": {
+      "version": "5.2.1",
+      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+      "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/feross"
+        },
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/feross"
+        },
+        {
+          "type": "consulting",
+          "url": "https://feross.org/support"
+        }
+      ],
+      "license": "MIT"
+    },
+    "node_modules/content-type": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
+      "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/cookie": {
+      "version": "0.7.2",
+      "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+      "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/cookie-signature": {
+      "version": "1.0.7",
+      "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
+      "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
+      "license": "MIT"
+    },
+    "node_modules/debug": {
+      "version": "2.6.9",
+      "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+      "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+      "license": "MIT",
+      "dependencies": {
+        "ms": "2.0.0"
+      }
+    },
+    "node_modules/depd": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+      "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/destroy": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
+      "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8",
+        "npm": "1.2.8000 || >= 1.4.16"
+      }
+    },
+    "node_modules/dunder-proto": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+      "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+      "license": "MIT",
+      "dependencies": {
+        "call-bind-apply-helpers": "^1.0.1",
+        "es-errors": "^1.3.0",
+        "gopd": "^1.2.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/ee-first": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+      "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
+      "license": "MIT"
+    },
+    "node_modules/encodeurl": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+      "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/es-define-property": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+      "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/es-errors": {
+      "version": "1.3.0",
+      "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+      "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/es-object-atoms": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
+      "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
+      "license": "MIT",
+      "dependencies": {
+        "es-errors": "^1.3.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/escape-html": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+      "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
+      "license": "MIT"
+    },
+    "node_modules/etag": {
+      "version": "1.8.1",
+      "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+      "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/express": {
+      "version": "4.22.2",
+      "resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz",
+      "integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==",
+      "license": "MIT",
+      "dependencies": {
+        "accepts": "~1.3.8",
+        "array-flatten": "1.1.1",
+        "body-parser": "~1.20.5",
+        "content-disposition": "~0.5.4",
+        "content-type": "~1.0.4",
+        "cookie": "~0.7.1",
+        "cookie-signature": "~1.0.6",
+        "debug": "2.6.9",
+        "depd": "2.0.0",
+        "encodeurl": "~2.0.0",
+        "escape-html": "~1.0.3",
+        "etag": "~1.8.1",
+        "finalhandler": "~1.3.1",
+        "fresh": "~0.5.2",
+        "http-errors": "~2.0.0",
+        "merge-descriptors": "1.0.3",
+        "methods": "~1.1.2",
+        "on-finished": "~2.4.1",
+        "parseurl": "~1.3.3",
+        "path-to-regexp": "~0.1.12",
+        "proxy-addr": "~2.0.7",
+        "qs": "~6.15.1",
+        "range-parser": "~1.2.1",
+        "safe-buffer": "5.2.1",
+        "send": "~0.19.0",
+        "serve-static": "~1.16.2",
+        "setprototypeof": "1.2.0",
+        "statuses": "~2.0.1",
+        "type-is": "~1.6.18",
+        "utils-merge": "1.0.1",
+        "vary": "~1.1.2"
+      },
+      "engines": {
+        "node": ">= 0.10.0"
+      },
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/express"
+      }
+    },
+    "node_modules/express/node_modules/safe-buffer": {
+      "version": "5.2.1",
+      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+      "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/feross"
+        },
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/feross"
+        },
+        {
+          "type": "consulting",
+          "url": "https://feross.org/support"
+        }
+      ],
+      "license": "MIT"
+    },
+    "node_modules/finalhandler": {
+      "version": "1.3.2",
+      "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
+      "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
+      "license": "MIT",
+      "dependencies": {
+        "debug": "2.6.9",
+        "encodeurl": "~2.0.0",
+        "escape-html": "~1.0.3",
+        "on-finished": "~2.4.1",
+        "parseurl": "~1.3.3",
+        "statuses": "~2.0.2",
+        "unpipe": "~1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/forwarded": {
+      "version": "0.2.0",
+      "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
+      "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/fresh": {
+      "version": "0.5.2",
+      "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
+      "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/function-bind": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+      "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+      "license": "MIT",
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/get-intrinsic": {
+      "version": "1.3.0",
+      "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+      "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+      "license": "MIT",
+      "dependencies": {
+        "call-bind-apply-helpers": "^1.0.2",
+        "es-define-property": "^1.0.1",
+        "es-errors": "^1.3.0",
+        "es-object-atoms": "^1.1.1",
+        "function-bind": "^1.1.2",
+        "get-proto": "^1.0.1",
+        "gopd": "^1.2.0",
+        "has-symbols": "^1.1.0",
+        "hasown": "^2.0.2",
+        "math-intrinsics": "^1.1.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/get-proto": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+      "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+      "license": "MIT",
+      "dependencies": {
+        "dunder-proto": "^1.0.1",
+        "es-object-atoms": "^1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/gopd": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+      "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/has-symbols": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+      "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/hasown": {
+      "version": "2.0.4",
+      "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
+      "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
+      "license": "MIT",
+      "dependencies": {
+        "function-bind": "^1.1.2"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/http-errors": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
+      "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
+      "license": "MIT",
+      "dependencies": {
+        "depd": "~2.0.0",
+        "inherits": "~2.0.4",
+        "setprototypeof": "~1.2.0",
+        "statuses": "~2.0.2",
+        "toidentifier": "~1.0.1"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      },
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/express"
+      }
+    },
+    "node_modules/iconv-lite": {
+      "version": "0.4.24",
+      "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+      "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+      "license": "MIT",
+      "dependencies": {
+        "safer-buffer": ">= 2.1.2 < 3"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/inherits": {
+      "version": "2.0.4",
+      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+      "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+      "license": "ISC"
+    },
+    "node_modules/ipaddr.js": {
+      "version": "1.9.1",
+      "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
+      "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.10"
+      }
+    },
+    "node_modules/math-intrinsics": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+      "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      }
+    },
+    "node_modules/media-typer": {
+      "version": "0.3.0",
+      "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
+      "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/merge-descriptors": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
+      "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
+      "license": "MIT",
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
+    "node_modules/methods": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
+      "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/mime": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
+      "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+      "license": "MIT",
+      "bin": {
+        "mime": "cli.js"
+      },
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/mime-db": {
+      "version": "1.52.0",
+      "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+      "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/mime-types": {
+      "version": "2.1.35",
+      "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+      "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+      "license": "MIT",
+      "dependencies": {
+        "mime-db": "1.52.0"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/ms": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+      "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+      "license": "MIT"
+    },
+    "node_modules/negotiator": {
+      "version": "0.6.3",
+      "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
+      "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/object-inspect": {
+      "version": "1.13.4",
+      "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
+      "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/on-finished": {
+      "version": "2.4.1",
+      "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
+      "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+      "license": "MIT",
+      "dependencies": {
+        "ee-first": "1.1.1"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/parseurl": {
+      "version": "1.3.3",
+      "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+      "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/path-to-regexp": {
+      "version": "0.1.13",
+      "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
+      "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
+      "license": "MIT"
+    },
+    "node_modules/proxy-addr": {
+      "version": "2.0.7",
+      "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
+      "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
+      "license": "MIT",
+      "dependencies": {
+        "forwarded": "0.2.0",
+        "ipaddr.js": "1.9.1"
+      },
+      "engines": {
+        "node": ">= 0.10"
+      }
+    },
+    "node_modules/qs": {
+      "version": "6.15.3",
+      "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",
+      "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==",
+      "license": "BSD-3-Clause",
+      "dependencies": {
+        "es-define-property": "^1.0.1",
+        "side-channel": "^1.1.1"
+      },
+      "engines": {
+        "node": ">=0.6"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/range-parser": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+      "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/raw-body": {
+      "version": "2.5.3",
+      "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
+      "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
+      "license": "MIT",
+      "dependencies": {
+        "bytes": "~3.1.2",
+        "http-errors": "~2.0.1",
+        "iconv-lite": "~0.4.24",
+        "unpipe": "~1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/safe-buffer": {
+      "version": "5.1.2",
+      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+      "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+      "license": "MIT"
+    },
+    "node_modules/safer-buffer": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+      "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+      "license": "MIT"
+    },
+    "node_modules/send": {
+      "version": "0.19.2",
+      "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
+      "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
+      "license": "MIT",
+      "dependencies": {
+        "debug": "2.6.9",
+        "depd": "2.0.0",
+        "destroy": "1.2.0",
+        "encodeurl": "~2.0.0",
+        "escape-html": "~1.0.3",
+        "etag": "~1.8.1",
+        "fresh": "~0.5.2",
+        "http-errors": "~2.0.1",
+        "mime": "1.6.0",
+        "ms": "2.1.3",
+        "on-finished": "~2.4.1",
+        "range-parser": "~1.2.1",
+        "statuses": "~2.0.2"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/send/node_modules/ms": {
+      "version": "2.1.3",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+      "license": "MIT"
+    },
+    "node_modules/serve-static": {
+      "version": "1.16.3",
+      "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
+      "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
+      "license": "MIT",
+      "dependencies": {
+        "encodeurl": "~2.0.0",
+        "escape-html": "~1.0.3",
+        "parseurl": "~1.3.3",
+        "send": "~0.19.1"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/setprototypeof": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+      "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
+      "license": "ISC"
+    },
+    "node_modules/side-channel": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
+      "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
+      "license": "MIT",
+      "dependencies": {
+        "es-errors": "^1.3.0",
+        "object-inspect": "^1.13.4",
+        "side-channel-list": "^1.0.1",
+        "side-channel-map": "^1.0.1",
+        "side-channel-weakmap": "^1.0.2"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/side-channel-list": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
+      "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
+      "license": "MIT",
+      "dependencies": {
+        "es-errors": "^1.3.0",
+        "object-inspect": "^1.13.4"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/side-channel-map": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
+      "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
+      "license": "MIT",
+      "dependencies": {
+        "call-bound": "^1.0.2",
+        "es-errors": "^1.3.0",
+        "get-intrinsic": "^1.2.5",
+        "object-inspect": "^1.13.3"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/side-channel-weakmap": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
+      "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
+      "license": "MIT",
+      "dependencies": {
+        "call-bound": "^1.0.2",
+        "es-errors": "^1.3.0",
+        "get-intrinsic": "^1.2.5",
+        "object-inspect": "^1.13.3",
+        "side-channel-map": "^1.0.1"
+      },
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/statuses": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
+      "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/toidentifier": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+      "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=0.6"
+      }
+    },
+    "node_modules/type-is": {
+      "version": "1.6.18",
+      "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
+      "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
+      "license": "MIT",
+      "dependencies": {
+        "media-typer": "0.3.0",
+        "mime-types": "~2.1.24"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/unpipe": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+      "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/utils-merge": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
+      "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.4.0"
+      }
+    },
+    "node_modules/vary": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+      "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    }
+  }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..e0230f2
--- /dev/null
+++ b/package.json
@@ -0,0 +1,15 @@
+{
+  "name": "ga4-dashboard",
+  "version": "1.0.0",
+  "description": "Local GA4 fleet traffic dashboard — readonly, cache-backed",
+  "main": "server.js",
+  "scripts": {
+    "start": "node server.js",
+    "etl": "python3 etl.py",
+    "refresh": "python3 etl.py && echo 'ETL done'"
+  },
+  "dependencies": {
+    "express": "^4.19.2",
+    "basic-auth": "^2.0.1"
+  }
+}
diff --git a/server.js b/server.js
new file mode 100644
index 0000000..9ff3988
--- /dev/null
+++ b/server.js
@@ -0,0 +1,631 @@
+/**
+ * GA4 Fleet Traffic Dashboard — local server, port 9710
+ * Serves cached data from cache/data.json. Never makes live API calls on page load.
+ * Basic-auth: admin / DW2024!
+ *
+ * Cost: $0 local (cache reads, no external API calls per page hit)
+ */
+
+const express = require('express');
+const basicAuth = require('basic-auth');
+const fs = require('fs');
+const path = require('path');
+
+const PORT = 9710;
+const CACHE_FILE = path.join(__dirname, 'cache', 'data.json');
+
+const app = express();
+
+// Basic auth middleware
+app.use((req, res, next) => {
+  const creds = basicAuth(req);
+  if (!creds || creds.name !== 'admin' || creds.pass !== 'DW2024!') {
+    res.set('WWW-Authenticate', 'Basic realm="GA4 Dashboard"');
+    return res.status(401).send('Unauthorized');
+  }
+  next();
+});
+
+// API: return raw cache as JSON
+app.get('/api/data', (req, res) => {
+  if (!fs.existsSync(CACHE_FILE)) {
+    return res.status(503).json({ error: 'Cache not built yet. Run: python3 etl.py' });
+  }
+  try {
+    const raw = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf8'));
+    res.json(raw);
+  } catch (e) {
+    res.status(500).json({ error: e.message });
+  }
+});
+
+// API: cache freshness check
+app.get('/api/status', (req, res) => {
+  if (!fs.existsSync(CACHE_FILE)) {
+    return res.json({ cache: 'missing', message: 'Run: python3 etl.py' });
+  }
+  const stat = fs.statSync(CACHE_FILE);
+  const raw = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf8'));
+  res.json({
+    cache: 'ready',
+    fetched_at: raw.fetched_at,
+    property_count: raw.property_count,
+    error_count: raw.error_count,
+    file_mtime: stat.mtime,
+    file_size_kb: Math.round(stat.size / 1024),
+  });
+});
+
+// Main dashboard HTML
+app.get('/', (req, res) => {
+  res.send(getDashboardHTML());
+});
+
+app.listen(PORT, '127.0.0.1', () => {
+  console.log(`GA4 Fleet Dashboard running at http://127.0.0.1:${PORT}`);
+  console.log(`Cost: $0 local — no live API calls on page load`);
+  if (!fs.existsSync(CACHE_FILE)) {
+    console.log('WARNING: cache not found. Run: python3 etl.py first');
+  }
+});
+
+function getDashboardHTML() {
+  return `<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<title>GA4 Fleet Traffic Dashboard</title>
+<style>
+  :root {
+    --bg: #0f1117;
+    --surface: #1a1d27;
+    --border: #2a2d3a;
+    --accent: #4f8ef7;
+    --text: #e2e8f0;
+    --text-dim: #8892a4;
+    --green: #34d399;
+    --yellow: #fbbf24;
+    --red: #f87171;
+    --cols: 3;
+  }
+  * { box-sizing: border-box; margin: 0; padding: 0; }
+  body {
+    background: var(--bg);
+    color: var(--text);
+    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
+    font-size: 14px;
+    min-height: 100vh;
+  }
+  header {
+    background: var(--surface);
+    border-bottom: 1px solid var(--border);
+    padding: 14px 20px;
+    display: flex;
+    align-items: center;
+    gap: 16px;
+    flex-wrap: wrap;
+    position: sticky;
+    top: 0;
+    z-index: 100;
+  }
+  header h1 { font-size: 16px; font-weight: 600; color: var(--accent); flex: 1; min-width: 200px; }
+  .meta { font-size: 11px; color: var(--text-dim); }
+  .meta span { color: var(--green); }
+  .controls {
+    display: flex;
+    gap: 10px;
+    align-items: center;
+    flex-wrap: wrap;
+  }
+  .controls label { font-size: 12px; color: var(--text-dim); }
+  select, input[type=text] {
+    background: var(--bg);
+    border: 1px solid var(--border);
+    color: var(--text);
+    padding: 5px 8px;
+    border-radius: 4px;
+    font-size: 12px;
+  }
+  input[type=range] {
+    width: 80px;
+    accent-color: var(--accent);
+  }
+  .badge {
+    background: var(--border);
+    border-radius: 3px;
+    padding: 2px 6px;
+    font-size: 11px;
+    color: var(--text-dim);
+  }
+  .badge.ok { background: #1a3a2a; color: var(--green); }
+  .badge.warn { background: #3a2a1a; color: var(--yellow); }
+  .badge.err { background: #3a1a1a; color: var(--red); }
+
+  #search {
+    width: 200px;
+  }
+
+  main {
+    padding: 16px 20px;
+  }
+  .summary-row {
+    display: flex;
+    gap: 12px;
+    margin-bottom: 16px;
+    flex-wrap: wrap;
+  }
+  .stat-card {
+    background: var(--surface);
+    border: 1px solid var(--border);
+    border-radius: 6px;
+    padding: 12px 16px;
+    min-width: 140px;
+  }
+  .stat-card .label { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
+  .stat-card .val { font-size: 22px; font-weight: 700; color: var(--accent); }
+
+  #grid {
+    display: grid;
+    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
+    gap: 12px;
+  }
+
+  .card {
+    background: var(--surface);
+    border: 1px solid var(--border);
+    border-radius: 8px;
+    padding: 14px;
+    transition: border-color 0.15s;
+    cursor: pointer;
+  }
+  .card:hover { border-color: var(--accent); }
+  .card-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: flex-start;
+    margin-bottom: 8px;
+    gap: 8px;
+  }
+  .card-name {
+    font-weight: 600;
+    font-size: 13px;
+    color: var(--text);
+    flex: 1;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+  }
+  .card-name a {
+    color: inherit;
+    text-decoration: none;
+  }
+  .card-name a:hover { color: var(--accent); text-decoration: underline; }
+  .card-domain {
+    font-size: 11px;
+    color: var(--text-dim);
+    margin-bottom: 8px;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+  }
+  .card-domain a {
+    color: var(--text-dim);
+    text-decoration: none;
+  }
+  .card-domain a:hover { color: var(--accent); }
+
+  .metrics {
+    display: grid;
+    grid-template-columns: 1fr 1fr;
+    gap: 6px;
+    margin-bottom: 8px;
+  }
+  .metric {
+    background: var(--bg);
+    border-radius: 4px;
+    padding: 6px 8px;
+  }
+  .metric .m-label { font-size: 10px; color: var(--text-dim); }
+  .metric .m-val { font-size: 15px; font-weight: 700; color: var(--text); }
+  .metric .m-val a { color: inherit; text-decoration: none; }
+  .metric .m-val a:hover { color: var(--accent); text-decoration: underline; }
+  .metric .m-sub { font-size: 10px; color: var(--text-dim); }
+
+  .card-footer {
+    font-size: 10px;
+    color: var(--text-dim);
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+  }
+  .card-footer a { color: var(--text-dim); text-decoration: none; }
+  .card-footer a:hover { color: var(--accent); text-decoration: underline; }
+
+  .when {
+    font-size: 10px;
+    color: var(--text-dim);
+    margin-top: 6px;
+  }
+
+  #empty { color: var(--text-dim); text-align: center; padding: 40px; }
+  .loading { color: var(--text-dim); text-align: center; padding: 60px; font-size: 16px; }
+
+  .density-label { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
+
+  /* Mode toggle: grid vs table */
+  .mode-btn {
+    background: var(--border);
+    border: none;
+    color: var(--text-dim);
+    padding: 5px 10px;
+    border-radius: 4px;
+    cursor: pointer;
+    font-size: 12px;
+  }
+  .mode-btn.active { background: var(--accent); color: #fff; }
+
+  /* Table mode */
+  #table-wrap { display: none; overflow-x: auto; }
+  table {
+    width: 100%;
+    border-collapse: collapse;
+    font-size: 12px;
+  }
+  th {
+    background: var(--surface);
+    border-bottom: 1px solid var(--border);
+    padding: 8px 10px;
+    text-align: left;
+    color: var(--text-dim);
+    position: sticky;
+    top: 58px;
+    cursor: pointer;
+    white-space: nowrap;
+    user-select: none;
+  }
+  th:hover { color: var(--accent); }
+  th .sort-arrow { opacity: 0.4; }
+  th.sorted .sort-arrow { opacity: 1; color: var(--accent); }
+  td {
+    border-bottom: 1px solid var(--border);
+    padding: 7px 10px;
+    color: var(--text);
+  }
+  tr:hover td { background: var(--surface); }
+  td a { color: var(--accent); text-decoration: none; }
+  td a:hover { text-decoration: underline; }
+  td.num { text-align: right; font-variant-numeric: tabular-nums; }
+  .no-data { color: var(--text-dim); }
+</style>
+</head>
+<body>
+<header>
+  <h1>GA4 Fleet Traffic</h1>
+  <div class="meta" id="meta">Loading...</div>
+  <div class="controls">
+    <input type="text" id="search" placeholder="Filter sites..." oninput="render()">
+
+    <label>Sort:
+      <select id="sort" onchange="render()">
+        <option value="sessions_7d_desc">Sessions 7d (high)</option>
+        <option value="sessions_30d_desc">Sessions 30d (high)</option>
+        <option value="users_7d_desc">Users 7d (high)</option>
+        <option value="pageviews_7d_desc">Pageviews 7d (high)</option>
+        <option value="alpha">Name A→Z</option>
+        <option value="domain">Domain A→Z</option>
+        <option value="created_desc">Created (newest)</option>
+        <option value="created_asc">Created (oldest)</option>
+      </select>
+    </label>
+
+    <label>Window:
+      <select id="window" onchange="render()">
+        <option value="7d">7 days</option>
+        <option value="30d">30 days</option>
+        <option value="both">Both</option>
+      </select>
+    </label>
+
+    <span class="density-label">Density:</span>
+    <input type="range" id="density" min="1" max="6" value="3"
+           oninput="updateDensity(this.value)">
+    <span id="density-val" style="font-size:11px;color:var(--text-dim)">3 col</span>
+
+    <button class="mode-btn active" id="btn-grid" onclick="setMode('grid')">Grid</button>
+    <button class="mode-btn" id="btn-table" onclick="setMode('table')">Table</button>
+  </div>
+</header>
+
+<main>
+  <div class="summary-row" id="summary"></div>
+  <div id="grid"></div>
+  <div id="table-wrap">
+    <table id="tbl">
+      <thead id="thead"></thead>
+      <tbody id="tbody"></tbody>
+    </table>
+  </div>
+  <div id="empty" style="display:none">No matching properties.</div>
+  <p class="loading" id="loading">Loading cache...</p>
+</main>
+
+<script>
+let ALL = [];
+let sortState = { col: null, dir: 1 };
+let viewMode = 'grid';
+
+// Persist preferences in localStorage
+const PREFS_KEY = 'ga4dash_prefs';
+function loadPrefs() {
+  try { return JSON.parse(localStorage.getItem(PREFS_KEY) || '{}'); } catch { return {}; }
+}
+function savePrefs() {
+  const p = { sort: qs('sort').value, window: qs('window').value, density: qs('density').value, mode: viewMode };
+  localStorage.setItem(PREFS_KEY, JSON.stringify(p));
+}
+function applyPrefs() {
+  const p = loadPrefs();
+  if (p.sort) qs('sort').value = p.sort;
+  if (p.window) qs('window').value = p.window;
+  if (p.density) { qs('density').value = p.density; updateDensity(p.density, false); }
+  if (p.mode) setMode(p.mode, false);
+}
+
+function qs(id) { return document.getElementById(id); }
+
+function updateDensity(val, save = true) {
+  document.documentElement.style.setProperty('--cols', val);
+  qs('density-val').textContent = val + ' col';
+  if (save) savePrefs();
+}
+
+function setMode(mode, save = true) {
+  viewMode = mode;
+  qs('btn-grid').classList.toggle('active', mode === 'grid');
+  qs('btn-table').classList.toggle('active', mode === 'table');
+  qs('grid').style.display = mode === 'grid' ? '' : 'none';
+  qs('table-wrap').style.display = mode === 'table' ? '' : 'none';
+  if (save) { savePrefs(); render(); }
+}
+
+function fmtNum(n) {
+  if (!n && n !== 0) return '-';
+  return n.toLocaleString();
+}
+
+function fmtDate(iso) {
+  if (!iso) return '-';
+  return new Date(iso).toLocaleString(undefined, {
+    year: 'numeric', month: 'short', day: 'numeric',
+    hour: 'numeric', minute: '2-digit'
+  });
+}
+
+function ga4ReportUrl(propertyId) {
+  return \`https://analytics.google.com/analytics/web/#/p\${propertyId}/reports/explorer\`;
+}
+
+function sortData(data) {
+  const sortKey = qs('sort').value;
+  return [...data].sort((a, b) => {
+    const s7a = a.stats_7d?.sessions || 0, s7b = b.stats_7d?.sessions || 0;
+    const s30a = a.stats_30d?.sessions || 0, s30b = b.stats_30d?.sessions || 0;
+    const u7a = a.stats_7d?.activeUsers || 0, u7b = b.stats_7d?.activeUsers || 0;
+    const pv7a = a.stats_7d?.screenPageViews || 0, pv7b = b.stats_7d?.screenPageViews || 0;
+    switch (sortKey) {
+      case 'sessions_7d_desc': return s7b - s7a;
+      case 'sessions_30d_desc': return s30b - s30a;
+      case 'users_7d_desc': return u7b - u7a;
+      case 'pageviews_7d_desc': return pv7b - pv7a;
+      case 'alpha': return (a.display_name || '').localeCompare(b.display_name || '');
+      case 'domain': return (a.domain || '').localeCompare(b.domain || '');
+      case 'created_desc': return new Date(b.create_time || 0) - new Date(a.create_time || 0);
+      case 'created_asc': return new Date(a.create_time || 0) - new Date(b.create_time || 0);
+      default: return s7b - s7a;
+    }
+  });
+}
+
+function filterData(data) {
+  const q = qs('search').value.trim().toLowerCase();
+  if (!q) return data;
+  const terms = q.split(' ').filter(Boolean);
+  return data.filter(p => {
+    const haystack = [p.display_name, p.domain, p.property_id, p.measurement_id, p.account_name]
+      .join(' ').toLowerCase();
+    return terms.every(t => haystack.includes(t));
+  });
+}
+
+function renderSummary(data) {
+  const total_7d = data.reduce((s, p) => s + (p.stats_7d?.sessions || 0), 0);
+  const total_30d = data.reduce((s, p) => s + (p.stats_30d?.sessions || 0), 0);
+  const total_users_7d = data.reduce((s, p) => s + (p.stats_7d?.activeUsers || 0), 0);
+  const active_7d = data.filter(p => (p.stats_7d?.sessions || 0) > 0).length;
+  qs('summary').innerHTML = \`
+    <div class="stat-card"><div class="label">Sites</div><div class="val">\${data.length}</div></div>
+    <div class="stat-card"><div class="label">Active (7d)</div><div class="val">\${active_7d}</div></div>
+    <div class="stat-card"><div class="label">Sessions (7d)</div><div class="val">\${fmtNum(total_7d)}</div></div>
+    <div class="stat-card"><div class="label">Users (7d)</div><div class="val">\${fmtNum(total_users_7d)}</div></div>
+    <div class="stat-card"><div class="label">Sessions (30d)</div><div class="val">\${fmtNum(total_30d)}</div></div>
+  \`;
+}
+
+function render() {
+  savePrefs();
+  const win = qs('window').value;
+  const filtered = filterData(sortData(ALL));
+  renderSummary(filtered);
+
+  const empty = qs('empty');
+  empty.style.display = filtered.length === 0 ? '' : 'none';
+
+  if (viewMode === 'grid') {
+    renderGrid(filtered, win);
+  } else {
+    renderTable(filtered, win);
+  }
+}
+
+function renderGrid(data, win) {
+  const grid = qs('grid');
+  grid.innerHTML = data.map(p => {
+    const pid = p.property_id;
+    const s7 = p.stats_7d || {};
+    const s30 = p.stats_30d || {};
+    const reportUrl = ga4ReportUrl(pid);
+    const domainDisplay = p.domain ? p.domain.replace(/^https?:\\/\\//, '') : '-';
+    const domainLink = p.domain ? \`<a href="\${p.domain}" target="_blank" rel="noopener">\${domainDisplay}</a>\` : domainDisplay;
+    const errBadge = p.error ? \`<span class="badge err" title="\${p.error}">ERR</span>\` : '';
+    const hasSessions = (s7.sessions || 0) > 0 || (s30.sessions || 0) > 0;
+
+    let metricsHtml = '';
+    if (win === '7d' || win === 'both') {
+      metricsHtml += \`
+        <div class="metric">
+          <div class="m-label">Sessions (7d)</div>
+          <div class="m-val"><a href="\${reportUrl}" target="_blank" rel="noopener">\${fmtNum(s7.sessions || 0)}</a></div>
+        </div>
+        <div class="metric">
+          <div class="m-label">Users (7d)</div>
+          <div class="m-val"><a href="\${reportUrl}" target="_blank" rel="noopener">\${fmtNum(s7.activeUsers || 0)}</a></div>
+        </div>
+        <div class="metric">
+          <div class="m-label">Pageviews (7d)</div>
+          <div class="m-val"><a href="\${reportUrl}" target="_blank" rel="noopener">\${fmtNum(s7.screenPageViews || 0)}</a></div>
+          <div class="m-sub"></div>
+        </div>\`;
+    }
+    if (win === '30d' || win === 'both') {
+      metricsHtml += \`
+        <div class="metric">
+          <div class="m-label">Sessions (30d)</div>
+          <div class="m-val"><a href="\${reportUrl}" target="_blank" rel="noopener">\${fmtNum(s30.sessions || 0)}</a></div>
+        </div>
+        <div class="metric">
+          <div class="m-label">Users (30d)</div>
+          <div class="m-val"><a href="\${reportUrl}" target="_blank" rel="noopener">\${fmtNum(s30.activeUsers || 0)}</a></div>
+        </div>
+        <div class="metric">
+          <div class="m-label">Pageviews (30d)</div>
+          <div class="m-val"><a href="\${reportUrl}" target="_blank" rel="noopener">\${fmtNum(s30.screenPageViews || 0)}</a></div>
+        </div>\`;
+    }
+
+    const createTs = p.create_time ? new Date(p.create_time).toLocaleString(undefined, {
+      year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit'
+    }) : null;
+
+    return \`
+      <div class="card" onclick="window.open('\${reportUrl}','_blank')">
+        <div class="card-header">
+          <div class="card-name"><a href="\${reportUrl}" target="_blank" rel="noopener" onclick="event.stopPropagation()">\${p.display_name || pid}</a></div>
+          \${errBadge}
+          \${!hasSessions ? '<span class="badge">0 traffic</span>' : ''}
+        </div>
+        <div class="card-domain">\${domainLink}</div>
+        <div class="metrics">\${metricsHtml}</div>
+        <div class="card-footer">
+          <span>\${p.measurement_id || ''}</span>
+          <a href="\${reportUrl}" target="_blank" rel="noopener" onclick="event.stopPropagation()">GA4 Report</a>
+        </div>
+        \${createTs ? \`<div class="when" title="\${p.create_time}">Created \${createTs}</div>\` : ''}
+      </div>\`;
+  }).join('');
+}
+
+function renderTable(data, win) {
+  const thead = qs('thead');
+  const tbody = qs('tbody');
+
+  const cols = [
+    { label: 'Property', key: 'display_name' },
+    { label: 'Domain', key: 'domain' },
+    ...(win !== '30d' ? [
+      { label: 'Sessions 7d', key: 'sessions_7d', num: true },
+      { label: 'Users 7d', key: 'users_7d', num: true },
+      { label: 'PVs 7d', key: 'pvs_7d', num: true },
+    ] : []),
+    ...(win !== '7d' ? [
+      { label: 'Sessions 30d', key: 'sessions_30d', num: true },
+      { label: 'Users 30d', key: 'users_30d', num: true },
+      { label: 'PVs 30d', key: 'pvs_30d', num: true },
+    ] : []),
+    { label: 'Measurement ID', key: 'measurement_id' },
+    { label: 'Created', key: 'create_time' },
+    { label: 'GA4', key: '_link' },
+  ];
+
+  thead.innerHTML = '<tr>' + cols.map(c =>
+    \`<th>\${c.label}</th>\`
+  ).join('') + '</tr>';
+
+  tbody.innerHTML = data.map(p => {
+    const pid = p.property_id;
+    const s7 = p.stats_7d || {};
+    const s30 = p.stats_30d || {};
+    const reportUrl = ga4ReportUrl(pid);
+    const domainDisplay = p.domain ? p.domain.replace(/^https?:\\/\\//, '') : '-';
+    const domainHtml = p.domain ? \`<a href="\${p.domain}" target="_blank" rel="noopener">\${domainDisplay}</a>\` : '-';
+    const createStr = p.create_time ? fmtDate(p.create_time) : '-';
+
+    const cells = [
+      \`<td><a href="\${reportUrl}" target="_blank" rel="noopener">\${p.display_name || pid}</a></td>\`,
+      \`<td>\${domainHtml}</td>\`,
+      ...(win !== '30d' ? [
+        \`<td class="num">\${fmtNum(s7.sessions || 0)}</td>\`,
+        \`<td class="num">\${fmtNum(s7.activeUsers || 0)}</td>\`,
+        \`<td class="num">\${fmtNum(s7.screenPageViews || 0)}</td>\`,
+      ] : []),
+      ...(win !== '7d' ? [
+        \`<td class="num">\${fmtNum(s30.sessions || 0)}</td>\`,
+        \`<td class="num">\${fmtNum(s30.activeUsers || 0)}</td>\`,
+        \`<td class="num">\${fmtNum(s30.screenPageViews || 0)}</td>\`,
+      ] : []),
+      \`<td class="no-data">\${p.measurement_id || '-'}</td>\`,
+      \`<td title="\${p.create_time || ''}">\${createStr}</td>\`,
+      \`<td><a href="\${reportUrl}" target="_blank" rel="noopener">Open</a></td>\`,
+    ];
+    return '<tr>' + cells.join('') + '</tr>';
+  }).join('');
+}
+
+// --- Boot ---
+async function load() {
+  try {
+    const [dataRes, statusRes] = await Promise.all([
+      fetch('/api/data'),
+      fetch('/api/status'),
+    ]);
+    const data = await dataRes.json();
+    const status = await statusRes.json();
+
+    if (data.error) {
+      qs('loading').textContent = 'Error: ' + data.error;
+      return;
+    }
+
+    ALL = data.properties || [];
+    qs('loading').style.display = 'none';
+
+    const age = status.fetched_at
+      ? Math.round((Date.now() - new Date(status.fetched_at)) / 60000) + ' min ago'
+      : 'unknown';
+    qs('meta').innerHTML =
+      \`<span>\${status.property_count}</span> properties | \` +
+      \`cache refreshed <span>\${age}</span> | \` +
+      \`\${status.error_count} errors | $0 cost\`;
+
+    applyPrefs();
+    render();
+  } catch (e) {
+    qs('loading').textContent = 'Failed to load: ' + e.message;
+  }
+}
+
+load();
+</script>
+</body>
+</html>`;
+}

(oldest)  ·  back to Ga4 Dashboard  ·  Fix A: duplicate-domain dedup; Fix B: wire table column sort 464db7f →