Phase 7 part 2: ranked by what converts
Push pages and change candidates are ordered by the sign-ups a page would bring if clicked as usual for its position (impressions × the clicks it misses × its sign-up rate, or the site's), and say so. What ranks flags pages by what they convert: traffic with no sign-ups, and pages that convert but Google hardly shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -243,3 +243,42 @@ func TestDailyGainsAndOutside(t *testing.T) {
|
||||
t.Error("Percent")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRankedByWhatConverts(t *testing.T) {
|
||||
d := openDB(t)
|
||||
const site = "sc-domain:whey.example"
|
||||
// Two pages on page one, shown a lot, hardly clicked: /big/ is shown
|
||||
// more, /sells/ turns its visits into sign-ups.
|
||||
week(t, d, site, "2026-11-13", row{}, []row{
|
||||
{"https://whey.example/big/", "big", 2, 3000, 5},
|
||||
{"https://whey.example/sells/", "sells", 1, 1500, 5},
|
||||
})
|
||||
d.PutJSON(throughKey(site), "2026-11-19")
|
||||
sc := NewScope(site, "https://whey.example/")
|
||||
r, _ := WhatRanks(d, sc)
|
||||
if len(r.Push) != 2 || r.Push[0].Page != "https://whey.example/big/" {
|
||||
t.Fatalf("without conversions, by impressions: %+v", r.Push)
|
||||
}
|
||||
sc.Conv = map[string]PageConv{
|
||||
"/big/": {Visitors: 200, Conversions: 0},
|
||||
"/sells/": {Visitors: 40, Conversions: 8},
|
||||
"/quiet/": {Visitors: 20, Conversions: 4}, // converts, but Google hardly shows it
|
||||
"/other/": {Visitors: 60, Conversions: 1},
|
||||
}
|
||||
r, _ = WhatRanks(d, sc)
|
||||
if r.Push[0].Page != "https://whey.example/sells/" || r.Push[0].Expected < r.Push[1].Expected || r.Push[1].Expected != 0 {
|
||||
t.Errorf("by sign-ups: %+v", r.Push)
|
||||
}
|
||||
if !strings.Contains(r.Push[0].Why, "at its own rate of 20.0% of visits") {
|
||||
t.Errorf("why: %s", r.Push[0].Why)
|
||||
}
|
||||
if r.Flags["/big/"] != FlagNoSignups || r.Flags["/quiet/"] != FlagHidden || r.Flags["/other/"] != "" {
|
||||
t.Errorf("flags: %+v", r.Flags)
|
||||
}
|
||||
if len(r.Flagged) != 2 || r.Flagged[0].Path != "/quiet/" {
|
||||
t.Errorf("flagged: %+v", r.Flagged)
|
||||
}
|
||||
if PathKey("https://www.whey.example/Big") != "/big/" || PathKey("https://whey.example") != "/" {
|
||||
t.Error("PathKey")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user