Phase 5 part 4: landing pages per buying signal

Each signal's page lists its landing pages with their Gitea status, live
address and 30-day visitors from Plausible, and builds a new one. Pages
can be duplicated as variants (B, C…, with their own utm_content), taken
off the site through a pull request that deletes the file, or have their
pull request closed. The scorecard counts live pages. Schema 23.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 14:19:55 -07:00
co-authored by Claude Opus 5.5
parent 11b80b6461
commit 062fcf2e59
17 changed files with 674 additions and 33 deletions
+37
View File
@@ -232,3 +232,40 @@ func plausibleSite(v string) string {
}
return v
}
// SiteID is a website's Plausible site ID: its Plausible site if set, else
// its domain.
func SiteID(w profile.Website) string {
if site := plausibleSite(w.PlausibleSite); site != "" {
return site
}
if u, err := url.Parse(strings.TrimSpace(w.URL)); err == nil {
return strings.TrimPrefix(strings.ToLower(u.Hostname()), "www.")
}
return ""
}
// PageVisitors is each page's visitors over the last 30 days, by path, for
// comparing a landing page with its variants. Counted per page, never per
// person.
func PageVisitors(ctx context.Context, c *plausible.Client, site string, paths []string) (map[string]int, error) {
out := map[string]int{}
if len(paths) == 0 {
return out, nil
}
var ps []any
for _, p := range paths {
ps = append(ps, p)
}
rows, err := c.Run(ctx, plausible.Query{SiteID: site, Metrics: []string{"visitors"}, DateRange: "30d",
Dimensions: []string{"event:page"}, Filters: [][]any{{"is", "event:page", ps}}})
if err != nil {
return nil, err
}
for _, r := range rows {
if len(r.Dimensions) > 0 && len(r.Metrics) > 0 {
out[r.Dimensions[0]] = int(r.Metrics[0])
}
}
return out, nil
}