Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
a87f276
Initial commit from Create Next App
ksteffe May 10, 2026
882da52
feat: After Certainty marketing site, tests, and CI
ksteffe May 11, 2026
ee787d6
feat: load books catalog from releases, enrich book pages, unify foot…
ksteffe May 11, 2026
cfbd34f
Match book cover frames to 2:3 source aspect ratio
ksteffe May 14, 2026
e9e7f94
Merge pull request #2 from ksteffe/fix/book-cover-aspect-2-3
ksteffe May 14, 2026
4403b98
Add semantic graph Explore experience and polish entity pages. (#3)
ksteffe May 15, 2026
c716e1c
Explore semantic observatory and browse route group (#4)
ksteffe May 16, 2026
4ff6919
Add mobile and tablet observatory hub with fullscreen graph mode. (#5)
ksteffe May 16, 2026
f06f343
Allowlist social crawlers in robots.txt for Open Graph previews. (#6)
ksteffe May 16, 2026
4680b1c
Strip Range header for social crawlers on OG image route.
ksteffe May 16, 2026
3f63041
Merge pull request #7 from ksteffe/fix/robots-social-crawlers
ksteffe May 16, 2026
77fd26c
Strip Range for social crawlers on all routes, not only OG image. (#8)
ksteffe May 16, 2026
826d90d
Serve static og.png from hero art for reliable Meta link previews. (#9)
ksteffe May 16, 2026
97072aa
Improve OG image and title for WhatsApp and preview tools. (#10)
ksteffe May 16, 2026
efe2086
Show semantic manifest media on explore and WoLTY pages. (#11)
ksteffe May 16, 2026
60951aa
Add purchase and download actions to explore book detail pages.
ksteffe May 17, 2026
a623f50
Merge pull request #12 from ksteffe/feature/explore-book-publication-…
ksteffe May 17, 2026
bedfc03
Retire /books catalog and WoLTY microsite in favor of explore. (#13)
ksteffe May 17, 2026
af81ce2
Add semantic observatory UX for explore graph focus. (#14)
ksteffe May 17, 2026
601a1fe
Add protected route to revalidate podcast, semantic, and books caches…
ksteffe May 21, 2026
cad11dc
Merge pull request #15 from ksteffe/feat/cache-revalidate-route
ksteffe May 21, 2026
8acab63
Prefer published catalog rows when manifest lists duplicate slugs.
ksteffe May 21, 2026
ae01bcf
Dedupe duplicate semantic-manifest book rows on fetch.
ksteffe May 21, 2026
d68f226
Add Vercel Web Analytics integration
vercel[bot] May 23, 2026
ade0884
Merge pull request #16 from ksteffe/vercel/vercel-web-analytics-integ…
ksteffe May 23, 2026
7531528
Install Vercel Speed Insights package
vercel[bot] May 23, 2026
d52b57c
Merge pull request #17 from ksteffe/vercel/install-vercel-speed-insig…
ksteffe May 23, 2026
ea58ebe
Add GA4 with cookie consent and CTA event tracking.
ksteffe May 23, 2026
d86ea71
Merge origin/main into feat/google-analytics-ga4.
ksteffe May 23, 2026
d066a80
chore: re-trigger Vercel preview deploy
ksteffe May 23, 2026
be2f6b8
Merge pull request #18 from ksteffe/feat/google-analytics-ga4
ksteffe May 23, 2026
503d244
Fix GA4 Consent Mode: regional defaults and gtag sync.
ksteffe May 23, 2026
086e9e7
Merge pull request #19 from ksteffe/cursor/consent-mode-regional-defa…
ksteffe May 23, 2026
5eefc1f
Collapsible focus panel for compact observatory (#20)
ksteffe May 23, 2026
94fb931
Add ga-trends Cursor skill for regular GA4 report pulls. (#21)
ksteffe May 23, 2026
fd2b249
Improve observatory navigation for semantic relationships and ontology.
ksteffe May 24, 2026
8be1b92
Merge pull request #22 from ksteffe/feat/observatory-relationship-nav…
ksteffe May 24, 2026
75cf182
Use per-book Open Graph images on explore book pages.
ksteffe May 25, 2026
fddd8c0
Merge pull request #23 from ksteffe/feat/book-open-graph-images
ksteffe May 25, 2026
b8576e3
Add owner vs external traffic estimate to ga-trends skill.
ksteffe May 30, 2026
19cfd44
Merge pull request #24 from ksteffe/feat/ga-trends-owner-traffic-esti…
ksteffe May 30, 2026
8d79522
Accept null coverImage and openGraphImage in semantic manifest valida…
ksteffe Jun 20, 2026
38cd44a
Merge pull request #25 from ksteffe/fix/semantic-manifest-null-cover-…
ksteffe Jun 20, 2026
042a14c
Fix missing PDF download for PDF-only poetry books
cursoragent Jul 2, 2026
172870d
Merge pull request #26 from ksteffe/cursor/fix-pdf-only-book-download…
ksteffe Jul 2, 2026
94feecf
Add JSON-LD structured data from semantic manifest
cursoragent Jul 5, 2026
c3b408c
Fix GraphIndex type in JSON-LD URL helpers for production build
cursoragent Jul 5, 2026
ea644f6
Merge pull request #27 from ksteffe/cursor/json-ld-structured-data-c5b9
ksteffe Jul 5, 2026
8b8e183
Improve JSON-LD for Google rich result eligibility
cursoragent Jul 5, 2026
dcf9e56
Merge pull request #28 from ksteffe/cursor/json-ld-rich-results-impro…
ksteffe Jul 5, 2026
eef3f9c
Add Front Shelf section to Start Here page
cursoragent Jul 5, 2026
1248802
Merge pull request #29 from ksteffe/cursor/start-front-shelf-1bb6
ksteffe Jul 5, 2026
7937ac1
Add concept longDefinition support from semantic manifest
cursoragent Jul 5, 2026
54258b4
Merge pull request #30 from ksteffe/cursor/concept-longdefinition-b43e
ksteffe Jul 5, 2026
af7c20d
Remove short definition from concept detail pages
cursoragent Jul 5, 2026
ba7d6ad
Add fallback to shortDefinition for concepts without longDefinition
cursoragent Jul 5, 2026
4157724
Merge pull request #31 from ksteffe/cursor/remove-short-definition-di…
ksteffe Jul 5, 2026
838b15c
Fix concept index to show portable definitions
cursoragent Jul 5, 2026
4963ffc
Merge pull request #32 from ksteffe/cursor/fix-concept-display-defini…
ksteffe Jul 5, 2026
60bde9e
Add pattern narrative fields for structured JSON-LD
cursoragent Jul 5, 2026
20d8575
Merge pull request #34 from ksteffe/cursor/pattern-narrative-fields-f94d
ksteffe Jul 5, 2026
854e60c
Integrate semantic manifest relationships and enhancements
cursoragent Jul 6, 2026
c6ade36
Fix linter errors: replace require() with ES6 imports
cursoragent Jul 6, 2026
ddc1231
Add pre-commit hooks with husky and lint-staged
cursoragent Jul 6, 2026
68dfd71
Add documentation for pre-commit hooks
cursoragent Jul 6, 2026
f33a01f
Merge pull request #35 from ksteffe/cursor/integrate-semantic-relatio…
ksteffe Jul 6, 2026
6746a3a
feat: add semantic data freshness indicator to footer
cursoragent Jul 6, 2026
5c68b1c
fix: update site-footer tests for async component
cursoragent Jul 6, 2026
9446263
feat: add JSON-LD API endpoints for direct access
cursoragent Jul 6, 2026
c9c30cc
docs: add git workflow rules for mandatory feature branches
cursoragent Jul 6, 2026
a941eca
Merge pull request #36 from ksteffe/cursor/add-workflow-rules-bb0e
ksteffe Jul 6, 2026
9e77280
fix(deps): resolve npm audit vulnerabilities and add CI audit gate
cursoragent Jul 6, 2026
7e66919
Merge pull request #37 from ksteffe/cursor/npm-security-audit-cc89
ksteffe Jul 6, 2026
8e3bbb0
Add Playwright smoke tests for navigation and broken links
cursoragent Jul 6, 2026
f7885ee
Merge pull request #38 from ksteffe/cursor/playwright-smoke-tests-12b1
ksteffe Jul 6, 2026
9dad1f6
feat(graph): accept enriched source metadata in manifest parser
cursoragent Jul 6, 2026
071cc29
Merge pull request #47 from ksteffe/cursor/enriched-source-metadata-76be
ksteffe Jul 6, 2026
07f2c27
feat(graph): derive thinker groupings from enriched sources
cursoragent Jul 6, 2026
25372e1
Merge pull request #48 from ksteffe/cursor/derive-thinkers-from-sourc…
ksteffe Jul 6, 2026
876c791
feat(graph): add top-level thinkers array and resolveThinkers
cursoragent Jul 6, 2026
69e9ecd
Merge pull request #49 from ksteffe/cursor/top-level-thinkers-array-76be
ksteffe Jul 6, 2026
510d9ac
feat(explore): add thinker index and detail pages
cursoragent Jul 6, 2026
9aad05e
Merge pull request #50 from ksteffe/cursor/thinker-index-detail-pages…
ksteffe Jul 6, 2026
155e6ce
chore(data): refresh semantic manifest from upstream release
cursoragent Jul 6, 2026
977b0ce
Merge pull request #51 from ksteffe/cursor/refresh-enriched-manifest-…
ksteffe Jul 6, 2026
4eb8537
feat(explore): split book-page thinkers from research sources
cursoragent Jul 6, 2026
5e376a6
fix(graph): prefer enriched bundled manifest when remote ISR is stale
cursoragent Jul 6, 2026
e9ec3fd
Merge pull request #52 from ksteffe/cursor/split-book-thinkers-source…
ksteffe Jul 6, 2026
ae5655f
feat(explore): surface enriched metadata on source pages
cursoragent Jul 6, 2026
d3f723a
Merge pull request #53 from ksteffe/cursor/enriched-source-pages-76be
ksteffe Jul 6, 2026
1973b56
feat(seo): extend JSON-LD for enriched sources and thinkers
cursoragent Jul 6, 2026
eb99566
Merge pull request #54 from ksteffe/cursor/json-ld-thinkers-sources-76be
ksteffe Jul 6, 2026
31b2a63
feat(explore): split thinkers and sources in navigation
cursoragent Jul 6, 2026
f6cc57e
Merge pull request #55 from ksteffe/cursor/split-nav-thinkers-sources…
ksteffe Jul 6, 2026
5a88d28
docs(skill): update refresh-manifest for thinkers/sources migration
cursoragent Jul 6, 2026
9b4cc04
Merge pull request #56 from ksteffe/cursor/refresh-manifest-skill-upd…
ksteffe Jul 6, 2026
2806245
Update semantic manifest from upstream release
cursoragent Jul 6, 2026
2896599
Merge pull request #57 from ksteffe/cursor/refresh-manifest-76be
ksteffe Jul 6, 2026
5c3da49
fix(graph): prefer bundled thinkers when remote manifest lacks them
cursoragent Jul 6, 2026
81d2215
Merge pull request #58 from ksteffe/cursor/fix-thinker-links-e2e-76be
ksteffe Jul 6, 2026
d89c195
Normalize source type labels for display
cursoragent Jul 6, 2026
756b281
Merge pull request #59 from ksteffe/cursor/normalize-source-type-labe…
ksteffe Jul 6, 2026
eb3a2e4
Add concept-to-thinker navigation and observatory thinker nodes
cursoragent Jul 6, 2026
47591d4
Merge pull request #60 from ksteffe/cursor/concept-thinker-backlink-67b5
ksteffe Jul 6, 2026
87472a7
Add observatory action on thinker detail pages
cursoragent Jul 6, 2026
6465e6b
Merge pull request #61 from ksteffe/cursor/thinker-observatory-button…
ksteffe Jul 6, 2026
c9581f4
Update semantic manifest from upstream release
cursoragent Jul 7, 2026
6d12240
Merge pull request #63 from ksteffe/cursor/refresh-manifest-257b
ksteffe Jul 7, 2026
2449b6e
Linkify http(s) URLs in explore detail descriptions (#64)
ksteffe Jul 15, 2026
ed087b9
Add typeahead search and pagination to explore indexes (#65)
ksteffe Jul 15, 2026
5e7117e
Defensive security assessment and remediations (#66)
ksteffe Jul 17, 2026
064b267
Remove Beehiiv subscribe route and finish security follow-ups.
cursoragent Jul 17, 2026
46e9472
Merge pull request #67 from ksteffe/cursor/remove-beehiiv-route-06f7
ksteffe Jul 17, 2026
4994776
Fix mobile explore card overflow on detail pages (#68)
ksteffe Jul 18, 2026
b32c3e1
Add Dependabot and dependency review for keeping deps secure (#69)
ksteffe Jul 19, 2026
85dca95
ci(deps): bump the github-actions group with 2 updates
dependabot[bot] Jul 19, 2026
1489a59
deps(deps): bump the production-minor-patch group with 2 updates
dependabot[bot] Jul 19, 2026
18bc90a
deps(deps): bump zod from 3.25.76 to 4.4.3
dependabot[bot] Jul 19, 2026
054ef2e
deps(deps-dev): bump @types/node from 20.19.40 to 26.1.1
dependabot[bot] Jul 19, 2026
033099b
deps(deps-dev): bump lint-staged from 16.4.0 to 17.0.8
dependabot[bot] Jul 19, 2026
2ffb53d
Merge pull request #70 from ksteffe/dependabot/github_actions/github-…
ksteffe Jul 19, 2026
e8efa23
Merge pull request #71 from ksteffe/dependabot/npm_and_yarn/productio…
ksteffe Jul 19, 2026
0b347fe
Merge pull request #73 from ksteffe/dependabot/npm_and_yarn/zod-4.4.3
ksteffe Jul 19, 2026
35e6e22
Merge pull request #75 from ksteffe/dependabot/npm_and_yarn/types/nod…
ksteffe Jul 19, 2026
65e3db0
Merge pull request #76 from ksteffe/dependabot/npm_and_yarn/lint-stag…
ksteffe Jul 19, 2026
e4f6a0e
deps(deps-dev): bump the development-minor-patch group across 1 direc…
dependabot[bot] Jul 19, 2026
a76ec04
Merge pull request #72 from ksteffe/dependabot/npm_and_yarn/developme…
ksteffe Jul 19, 2026
6a4506c
deps(deps-dev): bump eslint from 9.39.4 to 10.7.0
dependabot[bot] Jul 19, 2026
2ad3ef5
fix(lint): pin React version for ESLint 10 + eslint-plugin-react
cursoragent Jul 19, 2026
73c2744
Merge pull request #74 from ksteffe/dependabot/npm_and_yarn/eslint-10…
ksteffe Jul 19, 2026
e1a8ca5
chore(deps): ignore TypeScript major upgrades in Dependabot
cursoragent Jul 19, 2026
2861456
Merge pull request #78 from ksteffe/cursor/block-unsupported-ts7-3f78
ksteffe Jul 19, 2026
3999fb7
Add Global Search plan and Phases A–D (#79)
ksteffe Jul 19, 2026
66052b9
Improve global search quality for Phase E. (#80)
ksteffe Jul 19, 2026
95fa548
Add typed situations for Global Search Phase F. (#81)
ksteffe Jul 20, 2026
ef79f46
Add Start with a Question discovery feature (#82)
ksteffe Jul 20, 2026
46a0e44
Add Curated Reading Trails feature (#83)
ksteffe Jul 20, 2026
b391804
Add trail search bridges for Global Search integration (#84)
ksteffe Jul 20, 2026
4edad5d
Expand trail discovery on homepage and entity pages (#85)
ksteffe Jul 20, 2026
5161602
Surface related reading trails on question detail pages (#86)
ksteffe Jul 20, 2026
143acc9
Add upcoming trails UI on index and preview detail pages (#87)
ksteffe Jul 20, 2026
08428fc
Wire Observatory pathways, shared path UI, and local progress (#88)
ksteffe Jul 21, 2026
f22fcb8
Filterable book shelves on semantic-only catalog (#89)
ksteffe Jul 21, 2026
2ac82cf
Canonical status, What’s New, and book overviews (Phases A–H) (#90)
ksteffe Jul 22, 2026
6c571a2
Make after-certainty the discovery source of truth (#91)
ksteffe Jul 22, 2026
b2aa2ed
Accept poetry contentType so remote semantic manifest validates (#92)
ksteffe Jul 23, 2026
def84c7
Stabilize semantic-manifest content types and fallback observability …
ksteffe Jul 23, 2026
2699f9a
Tighten overview↔book concept and pattern link integrity (#94)
ksteffe Jul 23, 2026
c236c62
Enforce canonical-only shelf membership for companions (#95)
ksteffe Jul 23, 2026
890f51a
Retain schema 2.2 chapters and parts for discovery (#96)
ksteffe Jul 23, 2026
59e646e
Align site with semantic-manifest schema 2.3 enrichment (#97)
ksteffe Jul 23, 2026
f4f5178
Import after-certainty-site history under apps/site.
cursoragent Jul 23, 2026
b55163a
Add npm workspaces and thin Turborepo around apps/site.
cursoragent Jul 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ uv.lock.tmp
# Local build outputs (e.g. make generate-books-manifest → build/books-manifest.json)
build/

# Node / Turborepo (site lives under apps/site)
node_modules/
.turbo/
**/.next/
**/out/
apps/site/data/build-manifest-lock.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Portfolio-audit snapshots (regenerate per docs/portfolio-audit/data/README.md)
docs/portfolio-audit/data/books-manifest.json
docs/portfolio-audit/data/semantic-manifest.json
Expand Down
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Workspace installs for apps/site + future packages.
fund=false
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# After Certainty

This repository is the **corpus and publishing** home for After Certainty. It also hosts the public website under [`apps/site/`](apps/site/) (imported from [`ksteffe/after-certainty-site`](https://github.com/ksteffe/after-certainty-site); see the [monorepo migration plan](docs/roadmaps/monorepo-migration-plan.md)).

**Corpus layout is unchanged:** books and semantic YAML stay at the repository root. The site is a workspace app; production still deploys from the standalone site repository until a later migration phase.

## Toolchains

| Area | Tooling | Common commands |
|------|---------|-----------------|
| Corpus / semantic / publishing | Python 3.12+, [uv](https://github.com/astral-sh/uv), Make | `uv sync --frozen` · `make check` · `make generate-semantic-manifest` |
| Website (`apps/site`) | Node 20+, npm workspaces, thin [Turborepo](https://turbo.build) | `npm ci` · `npm run site:dev` · `npm run site:test` · `npm run site:lint` |

From the repo root after both installs:

```bash
uv sync --frozen # corpus
npm ci # site workspace
npm run site:dev # Next.js (still uses remote/fallback semantic manifest in Phase 1)
make generate-semantic-manifest # local corpus artifact under build/
```

Phase notes: [`docs/migrations/monorepo-phase-0/`](docs/migrations/monorepo-phase-0/) · [`docs/migrations/monorepo-phase-1/`](docs/migrations/monorepo-phase-1/).

## Books and publishing

This repository holds **several independent books** as parallel projects under [`books/`](books/): each publishable manuscript folder includes an `index.md` plus a `book.yml` spec. They share **one publishing pipeline**—local Make targets and a GitHub Actions workflow—that assembles each enabled book into **DOCX**, **EPUB**, and **PDF** for distribution.

## Publishing pipeline
Expand Down
96 changes: 96 additions & 0 deletions apps/site/.cursor/rules/git-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Git Workflow Rules

## MANDATORY: Always Use Feature Branches

**NEVER commit directly to `main` branch.**

### Before Making Any Changes

1. **Check current branch:**

```bash
git branch --show-current
```

2. **If on `main`, create a feature branch immediately:**
```bash
git checkout -b cursor/<descriptive-name>-bb0e
```

### Branch Naming Convention

**Required format:** `cursor/<descriptive-name>-bb0e`

**Examples:**

- `cursor/add-json-ld-api-bb0e`
- `cursor/fix-relationship-arrows-bb0e`
- `cursor/update-footer-metadata-bb0e`

**Rules:**

- Prefix: Always start with `cursor/`
- Suffix: Always end with `-bb0e`
- Description: Use kebab-case (lowercase with hyphens)
- Be descriptive: Name should indicate the feature/fix

### Workflow Steps

1. **Create branch** from `main`:

```bash
git checkout main
git pull origin main
git checkout -b cursor/<feature-name>-bb0e
```

2. **Make changes and commit frequently:**

```bash
git add <files>
git commit -m "feat: description"
```

3. **Push to feature branch:**

```bash
git push -u origin cursor/<feature-name>-bb0e
```

4. **Create Pull Request:**
- Use `ManagePullRequest` tool
- Base branch: `main`
- Create as draft by default
- Include detailed description

5. **After approval, merge via GitHub UI**

### Pre-Commit Checklist

Before ANY git commit:

- [ ] Confirm not on `main` branch
- [ ] Branch name follows `cursor/*-bb0e` pattern
- [ ] Changes are tested (tests passing)
- [ ] Build succeeds
- [ ] Commit message follows conventional commits format

### Emergency Direct Commits to Main

**Only allowed for:**

- Critical security hotfixes (with immediate notification)
- Deployment configuration emergencies
- **Must be discussed with team first**

### Enforcement

This rule is enforced by:

1. Cursor agent reading this file before any git operations
2. Manual verification before each commit
3. Branch protection rules on GitHub (if configured)

---

**Last Updated:** 2026-07-06
159 changes: 159 additions & 0 deletions apps/site/.cursor/skills/ga-trends/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
---
name: ga-trends
description: >-
Pulls Google Analytics 4 trend reports for After Certainty via the analytics
MCP (user-analytics-mcp). Use when the user asks for GA trends, traffic
updates, analytics reports, weekly metrics, or to run a regular analytics
check.
---

# GA4 trends (After Certainty)

## Prerequisites

- MCP server: `user-analytics-mcp` (Google `analytics-mcp`)
- Read tool schemas under `mcps/user-analytics-mcp/tools/` before calling
- **Property ID for reports:** `properties/497528828` (not measurement ID `G-H7FSEF4WLW`)
- Timezone in reports: America/Denver

If MCP auth fails, tell the user to run `gcloud auth application-default login` (ADC expires after ~7 days in testing mode).

## When the user runs this skill

1. **Batch all `run_report` / `run_realtime_report` calls in one parallel tool batch** (do not serialize).
2. Use date range **`7daysAgo` → `today`** for weekly trends unless the user asks otherwise.
3. For week-over-week comparison, add a second range **`14daysAgo` → `8daysAgo`** with empty `dimensions` (GA returns a `dateRange` column automatically).
4. If a report returns **zero rows**, retry the same query with `end_date: "today"` (excluding today often yields empty data on low-traffic properties).

## Standard report pack

Run these every time unless the user narrows scope:

| # | Report | Tool | Purpose |
|---|--------|------|---------|
| 1 | Overview + WoW | `run_report` | sessions, users, page views, engagement |
| 2 | Daily trend | `run_report` | `date` dimension |
| 3 | Channels | `run_report` | `sessionDefaultChannelGroup` |
| 4 | Top pages | `run_report` | `pagePath`, limit 15 |
| 5 | Events | `run_report` | `eventName`, limit 25 |
| 6 | Devices | `run_report` | `deviceCategory` |
| 7 | Geography | `run_report` | `country`, limit 10 |
| 8 | Realtime pulse | `run_realtime_report` | active users + top screens |
| 9 | Device OS | `run_report` | `deviceCategory` + `operatingSystem` (you vs not you) |
| 10 | Mobile models | `run_report` | `mobileDeviceBranding` + `mobileDeviceModel` (mobile only) |
| 11 | Session source | `run_report` | `sessionSourceMedium` (Facebook, Vercel, Tag Assistant) |

Exact JSON arguments: [reports.md](reports.md)

## Estimated you vs not you

Run reports **9–11** every time. Compute from **sessions** (not users). This is a **heuristic** until GA4 **internal traffic** (IP) is configured in Admin.

**Owner device profile** (default for After Certainty): Macintosh desktop + iPhone (model often missing; treat `iPhone 13` when present as a strong “you” signal).

### Inputs (from reports)

| Input | How to read |
|-------|-------------|
| `total` | Sessions from overview (Last7Days) |
| `definite_not_you` | Sum sessions where `operatingSystem` is **Android**, **Linux**, or **Windows** (report 9) |
| `mac_ios_pool` | Sum sessions where OS is **Macintosh** or **iOS** (report 9) |
| `social_referral` | Sum sessions where `sessionSourceMedium` contains `facebook.com` or `m.facebook.com` (report 11) |
| `tooling_you` | Sum sessions where source is `vercel.com` or `tagassistant.google.com` (report 11) |
| `iphone13_you` | Sessions with `mobileDeviceModel` = `iPhone 13` (report 10) |
| `macintosh_sessions` | Sessions with `operatingSystem` = `Macintosh` (report 9) |

### Estimates

1. **Floor — definitely not you:** `definite_not_you` (wrong OS for Mac + iPhone).
2. **You signals (additive, cap at `mac_ios_pool`):**
`you_signals = tooling_you + iphone13_you + round(macintosh_sessions × 0.65)`
(`0.65` = default share of Mac desktop sessions attributed to the site owner; not precise.)
3. **Middle — estimated you:** `you_mid = min(mac_ios_pool, you_signals)`
**Middle — estimated not you:** `not_you_mid = total - you_mid`
4. **Range (show all three):**
- **Low not you / high you:** `not_you_low = definite_not_you`, `you_high = total - not_you_low`
- **High not you / low you:** `not_you_high = definite_not_you + social_referral`, `you_low = total - not_you_high`
(Facebook overlap with mobile OS is possible; note in output.)
- **Middle:** use step 3.

Always state that **GA does not label “you”** without internal traffic; recommend **Admin → Data streams → Define internal traffic** for a definitive split.

Call out in the block: generic **iPhone** (no model) may still be the owner; **Nexus 5X** / **Linux** are usually bots or cloud, not readers.

## Custom events to highlight

After consent, the site sends (see `lib/analytics/events.ts`):

| Event | Meaning |
|-------|---------|
| `select_content` | Observatory focus / entity engagement (`content_type`, `item_id`, `method`) |
| `file_download` | Book EPUB/PDF/DOCX |
| `click` | Outbound CTA (`outbound: true`, `location`, `platform`) |
| `generate_lead` | Newsletter (future) |

In the events report, call out whether these appear. Absence usually means low traffic, consent denied, or non-production.

## Optional deep dives (user must ask or say "full")

- **28-day totals:** `28daysAgo` → `today`, no dimensions
- **Explore/Observatory:** filter `pagePath` contains `/explore` or events `select_content`
- **Funnel:** `run_funnel_report` — home → explore → select_content (see reports.md)
- **Conversions:** `run_conversions_report` if key events are marked in GA4 Admin

## Output template

Deliver a single markdown brief:

```markdown
# GA trends — After Certainty
**Property:** properties/497528828 · **Range:** [dates] · **Pulled:** [today]

## Headline
[1–2 sentences: up/down/flat vs prior week, caveats if all traffic is one day]

## Overview
| Metric | This period | Prior period (if any) |
|--------|------------:|----------------------:|

## Daily
| Date | Sessions | Users | Page views |

## Channels / Pages / Events
[tables]

## Estimated you vs not you
Heuristic only (owner devices: Mac + iPhone). Configure internal traffic in GA4 for a definitive split.

| | Sessions | % of total |
|---|----------:|-----------:|
| **Definitely not you** (Android / Linux / Windows) | N | % |
| Mac + iOS pool (mixed) | N | % |
| — Tooling (Vercel, Tag Assistant) | N | |
| — iPhone 13 (model reported) | N | |
| **Estimated you (middle)** | N | % |
| **Estimated not you (middle)** | N | % |

Range: not you **low**–**high** = [definite_not_you] – [definite_not_you + social_referral]; you the complement.

Device/OS table + top `sessionSourceMedium` rows. One-line caveat on overlap and iPhone model masking.

## Realtime
Active users now: N

## Notes
- Consent / custom events / data quality caveats
- Suggested follow-ups (1–3 bullets)
```

## Interpretation guardrails

- **Low volume:** do not over-interpret single-day spikes; say when the entire window is one date.
- **Channel totals** can exceed session counts (attribution quirks); prefer sessions for channel ranking.
- **Unassigned** channel often means missing UTM / direct app traffic — note, don't panic.
- **Engagement rate** near 0 with few sessions is noisy.
- **You vs not you:** never present the middle estimate as exact; show the range and recommend internal-traffic IP filters. iPhone model is often `(not set)` or generic `iPhone` even for the owner's device.

## Property discovery

Only run `get_account_summaries` if property ID is unknown or user asks about accounts. Default to `properties/497528828`.
Loading
Loading