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:
@@ -139,6 +139,7 @@ func (s *Server) seoChangesSuggest(w http.ResponseWriter, r *http.Request) {
|
||||
if err == nil {
|
||||
ctx, cancel := context.WithTimeout(r.Context(), 5*time.Minute)
|
||||
defer cancel()
|
||||
pr.Conv = s.seoConv(cur.URL)
|
||||
_, err = pr.SuggestChanges(ctx, s.DB, auditKey(*cur), cur.Property, time.Now())
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
+24
-6
@@ -90,8 +90,26 @@ type seoSite struct {
|
||||
Last *seo.SyncResult
|
||||
}
|
||||
|
||||
// scope narrows the site's Search Console property to the website's host.
|
||||
func (st seoSite) scope() seo.Scope { return seo.NewScope(st.Property, st.URL) }
|
||||
// scope narrows the site's Search Console property to the website's host,
|
||||
// with what its pages convert (from Plausible) when that's been read.
|
||||
func (s *Server) scope(st seoSite) seo.Scope {
|
||||
sc := seo.NewScope(st.Property, st.URL)
|
||||
sc.Conv = s.seoConv(st.URL)
|
||||
return sc
|
||||
}
|
||||
|
||||
// seoConv is a website's page conversions for SEO's ranking.
|
||||
func (s *Server) seoConv(siteURL string) map[string]seo.PageConv {
|
||||
pages := s.pageConv(siteURL)
|
||||
if pages == nil {
|
||||
return nil
|
||||
}
|
||||
out := make(map[string]seo.PageConv, len(pages))
|
||||
for p, n := range pages {
|
||||
out[p] = seo.PageConv{Visitors: n.Visitors, Conversions: n.Conversions()}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (s *Server) seoSites() []seoSite {
|
||||
p, _ := profile.Load(s.DB)
|
||||
@@ -296,7 +314,7 @@ func (s *Server) seoPage(w http.ResponseWriter, r *http.Request) {
|
||||
data, cur := s.seoBase(r)
|
||||
data["Path"], data["Days"] = "/seo", seo.RanksDays
|
||||
if cur != nil {
|
||||
ranks, err := seo.WhatRanks(s.DB, cur.scope())
|
||||
ranks, err := seo.WhatRanks(s.DB, s.scope(*cur))
|
||||
if err != nil {
|
||||
s.serverError(w, err)
|
||||
return
|
||||
@@ -360,7 +378,7 @@ func (s *Server) seoCheckPage(w http.ResponseWriter, r *http.Request) {
|
||||
data, cur := s.seoBase(r)
|
||||
data["Path"] = "/seo/check"
|
||||
if cur != nil {
|
||||
c, err := seo.MorningCheck(s.DB, cur.scope(), seo.LoadSettings(s.DB))
|
||||
c, err := seo.MorningCheck(s.DB, s.scope(*cur), seo.LoadSettings(s.DB))
|
||||
if err != nil {
|
||||
s.serverError(w, err)
|
||||
return
|
||||
@@ -429,7 +447,7 @@ func (s *Server) seoReportWrite(w http.ResponseWriter, r *http.Request) {
|
||||
// writeReport builds and stores a site's report, and emails it if the
|
||||
// settings say so (and email is set up).
|
||||
func (s *Server) writeReport(ctx context.Context, site seoSite, email bool) (*seo.Report, error) {
|
||||
rep, err := seo.Weekly(s.DB, site.scope(), time.Now())
|
||||
rep, err := seo.Weekly(s.DB, s.scope(site), time.Now())
|
||||
if err != nil || rep == nil {
|
||||
return rep, err
|
||||
}
|
||||
@@ -485,7 +503,7 @@ func (s *Server) dailyChecks(ctx context.Context) {
|
||||
if site.Property == "" {
|
||||
continue
|
||||
}
|
||||
c, err := seo.MorningCheck(s.DB, site.scope(), set)
|
||||
c, err := seo.MorningCheck(s.DB, s.scope(site), set)
|
||||
if err != nil {
|
||||
s.Log.Warn("seo: the morning check", "site", site.Property, "err", err)
|
||||
continue
|
||||
|
||||
@@ -396,6 +396,7 @@ func (s *Server) loadTemplates() error {
|
||||
"dec1": func(f float64) string { return strconv.FormatFloat(f, 'f', 1, 64) },
|
||||
"pagePath": pagePath,
|
||||
"change": seo.Percent,
|
||||
"flagOf": func(m map[string]string, page string) string { return m[seo.PathKey(page)] },
|
||||
"conv": func(m map[string]tracking.PageNumbers, page string) tracking.PageNumbers {
|
||||
return m[tracking.PathOf(page)]
|
||||
},
|
||||
|
||||
@@ -36,11 +36,27 @@
|
||||
</section>
|
||||
</div>
|
||||
|
||||
{{with .Flagged}}
|
||||
<section class="card">
|
||||
<h2>By what they convert</h2>
|
||||
<p class="help">From the visits that began on each page in the last 90 days and went on to sign up or send a form (what counts is under <a href="/settings/tracking#signups">Settings → Website & sales</a>).</p>
|
||||
<table class="list">
|
||||
<thead><tr><th>Page</th><th></th><th class="num">Visits</th><th class="num">Sign-ups</th><th class="num">Impressions</th><th>What to do</th></tr></thead>
|
||||
<tbody>{{range .}}<tr>
|
||||
<td>{{.Path}}</td>
|
||||
<td><span class="badge {{if eq .Flag "converts, hardly found"}}published{{else}}competitor{{end}}">{{.Flag}}</span></td>
|
||||
<td class="num">{{num .Conv.Visitors}}</td><td class="num">{{num .Conv.Conversions}}</td><td class="num">{{num .Impressions}}</td>
|
||||
<td class="small">{{if eq .Flag "converts, hardly found"}}It turns visits into sign-ups, but Google hardly shows it: link to it from pages that rank, and look for the searches it should rank for.{{else}}Visitors come, nobody signs up: check what the page asks them to do, and where its button leads.{{end}}</td>
|
||||
</tr>{{end}}</tbody>
|
||||
</table>
|
||||
</section>
|
||||
{{end}}
|
||||
|
||||
<h2>Best pages</h2>
|
||||
{{if .Pages}}
|
||||
<table class="list">
|
||||
<thead><tr><th>Page</th><th class="num">Clicks</th><th class="num">Impressions</th><th class="num">Click rate</th><th class="num">Position</th>{{if $d.Conv}}<th class="num" title="Visits that began on the page, from Plausible">Visits</th><th class="num" title="Visits that began on the page and went on to sign up or send a form">Sign-ups</th>{{end}}</tr></thead>
|
||||
<tbody>{{range .Pages}}<tr><td><a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a></td><td class="num">{{num .Clicks}}</td><td class="num">{{num .Impressions}}</td><td class="num">{{dec1 .CTR}}%</td><td class="num">{{dec1 .Position}}</td>{{if $d.Conv}}{{with conv $d.Conv .Page}}<td class="num">{{num .Visitors}}</td><td class="num">{{if .Conversions}}<strong>{{num .Conversions}}</strong>{{else}}<span class="muted">0</span>{{end}}</td>{{end}}{{end}}</tr>{{end}}</tbody>
|
||||
<tbody>{{range .Pages}}<tr><td><a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a>{{with flagOf $d.Ranks.Flags .Page}} <span class="badge {{if eq . "converts, hardly found"}}published{{else}}competitor{{end}}">{{.}}</span>{{end}}</td><td class="num">{{num .Clicks}}</td><td class="num">{{num .Impressions}}</td><td class="num">{{dec1 .CTR}}%</td><td class="num">{{dec1 .Position}}</td>{{if $d.Conv}}{{with conv $d.Conv .Page}}<td class="num">{{num .Visitors}}</td><td class="num">{{if .Conversions}}<strong>{{num .Conversions}}</strong>{{else}}<span class="muted">0</span>{{end}}</td>{{end}}{{end}}</tr>{{end}}</tbody>
|
||||
</table>
|
||||
{{else}}<p class="help">No pages with data yet.</p>{{end}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user