WebAnalytics

webanalytics is a Cloudflare Worker that lets a user log in with their own Google account, register the websites they own, and link each one to its GA4 property + GTM container + Search Console site. It then pulls a single cross-source snapshot and produces a business-level read — with an LLM-generated to-do list the user can actually execute.

It is the first product on the platform whose data scope is per-user: every API call to Google is made with the logged-in user's own OAuth grant. No service account, no shared access.

Role in the platform

Property Value
Worker webanalytics
Repo swappsco/webanalytics
Hostname (prod) webanalytics.swapps.workers.dev
Stack Cloudflare Workers + Hono + JSX (server-rendered)
Storage D1 (users, sites, links, recommendations) + KV (sessions, encrypted tokens, OAuth state)
LLM Workers AI — @cf/meta/llama-3.3-70b-instruct-fp8-fast
Identity Per-user Google OAuth 2.0 (PKCE) — see Architecture

What it does

Phase 1 (live) — read-only

  • OAuth onboarding: single Google consent screen requesting six scopes (openid email profile + analytics.readonly + webmasters.readonly + tagmanager.readonly).
  • Site wizard: pill-based picker to bind a domain to its GA4 property, GTM container and SC site.
  • Live dashboard for any selected date range (presets: last 7/28/30/90 days, this/last month, YTD, last 12 months, or custom): KPI cards with previous-period deltas, channel/page/query charts, audience splits, SEO opportunities (queries on positions 8–15, pages with high impressions but low CTR).
  • Setup panel (range-independent): GA4 conversion events configured + GTM tag/trigger/variable inventory.
  • AI analysis: cross-source business read rendered as structured cards — headline, what's working, what's hurting, quick wins, cross-source signals, tracking hygiene — plus a prioritised list of actionable recommendations.
  • To-do workflow: each recommendation has Skip / Start. Starting one opens a workspace with the suggested steps and a comment thread; the user can leave notes and call Ask AI for help to get the next concrete step.

Phase 2 (planned) — writes

  • Add write scopes (analytics.edit, tagmanager.edit.containers) and ship guarded actions: flag a GA4 event as a conversion, draft a GTM variable/trigger/tag, with explicit review before publishing.

See also