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:
+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
|
||||
|
||||
Reference in New Issue
Block a user