You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[`data/store.yaml`](data/store.yaml)| Mobile store listings |
74
74
|[`data/games.yaml`](data/games.yaml), [`data/ai.yaml`](data/ai.yaml), etc. | Hub page content |
75
+
|[`data/tool-rankings.json`](data/tool-rankings.json)| GA4 click rankings for homepage Popular tools (CI-generated; `enabled: false` locally) |
75
76
76
77
## Adding a new hub or browse category
77
78
@@ -120,7 +121,29 @@ When [`data/history.yaml`](data/history.yaml) includes dates for a new year:
120
121
121
122
## Deployment
122
123
123
-
Pushes to `main` trigger [`.github/workflows/hugo.yaml`](.github/workflows/hugo.yaml): install Hugo → `npm run build:css` → `hugo --minify` → deploy `public/` to GitHub Pages.
124
+
Pushes to `main` trigger [`.github/workflows/hugo.yaml`](.github/workflows/hugo.yaml): install Hugo → `npm run build` → `npm run sync:rankings` → `hugo --minify` → deploy `public/` to GitHub Pages.
125
+
126
+
### Popular tools section (GA4)
127
+
128
+
The homepage can show a **Popular tools** block (`#popular-tools`) ranked by real `tool_click` analytics. It is **hidden** unless GitHub Actions successfully syncs GA4 data at build time.
129
+
130
+
**One-time setup:**
131
+
132
+
1. In GA4 Admin → **Custom definitions**, register event parameter `tool_name` as a custom dimension (events already send it from `static/js/analytics.js`).
133
+
2. Copy the **numeric Property ID** from GA4 Admin → Property settings (not the `G-` measurement ID).
134
+
3. In Google Cloud: enable **Google Analytics Data API**, create a service account, download JSON key, add the service account email to the GA4 property as **Viewer**.
135
+
4. In the GitHub repo → **Settings → Secrets and variables → Actions**, add:
136
+
-`GA4_PROPERTY_ID` — numeric property ID
137
+
-`GA4_SERVICE_ACCOUNT_JSON` — full service account key JSON
138
+
139
+
**Behavior:**
140
+
141
+
- CI runs `npm run sync:rankings` before `hugo`, writing [`data/tool-rankings.json`](data/tool-rankings.json).
142
+
- If secrets are missing or the API fails, `enabled` stays `false` and the section is omitted from HTML.
143
+
- Local builds without secrets behave the same (committed stub has `enabled: false`).
144
+
- After deploy, confirm in the Actions log: `[sync:rankings] enabled: N tools, top 5: ...`
145
+
146
+
Optional env: `RANKINGS_WINDOW_DAYS` (default `30`) for the GA4 lookback window.
0 commit comments