Phase 2 part 7: the end of the funnel
Posts can be written for a buying signal: the prompt gets its hypothesis and angle, and links carry its campaign tag. Plausible (Stats API v2) is read once a day for visitors on tagged links, recorded per signal as Visited. Stripe (restricted key) is read every hour: $0 checkouts are Signed up, paid invoices and one-time payments are Paid with their value, tied to a signal by the checkout's utm_campaign metadata or the payer's email. The Core's Cal.com has no API, so booking emails from Cal.com in the outreach mailbox count as Booked. New Settings → Website & sales; the signal page lists its posts and tagged links. Schema 11. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -13,6 +14,7 @@ import (
|
||||
"supermarket/internal/ai"
|
||||
"supermarket/internal/api/explee"
|
||||
"supermarket/internal/api/origami"
|
||||
"supermarket/internal/content"
|
||||
"supermarket/internal/discovery"
|
||||
"supermarket/internal/leadsource"
|
||||
"supermarket/internal/profile"
|
||||
@@ -87,6 +89,9 @@ type signalData struct {
|
||||
Events []signals.Event
|
||||
Prospects int // new prospects tagged with it
|
||||
|
||||
Posts []content.Draft // written for it
|
||||
Links []string // the websites, tagged with its campaign
|
||||
|
||||
Runs []discovery.Run
|
||||
Running bool
|
||||
Research string // why Claude can't search, or ""
|
||||
@@ -172,6 +177,17 @@ func (s *Server) renderSignal(w http.ResponseWriter, r *http.Request, sig *signa
|
||||
return
|
||||
}
|
||||
d.Prospects = len(cs) + len(ps)
|
||||
if d.Posts, err = content.ForSignal(s.DB, sig.ID, 20); err != nil {
|
||||
s.serverError(w, err)
|
||||
return
|
||||
}
|
||||
if p, _ := profile.Load(s.DB); p != nil {
|
||||
for _, ws := range p.Websites {
|
||||
if u := tagLink(ws.URL, sig.Slug); u != "" {
|
||||
d.Links = append(d.Links, u)
|
||||
}
|
||||
}
|
||||
}
|
||||
if d.Runs, err = discovery.Runs(s.DB, sig.ID, 8); err != nil {
|
||||
s.serverError(w, err)
|
||||
return
|
||||
@@ -638,3 +654,16 @@ func (s *Server) RunDiscovery(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tagLink is a website's address with a signal's campaign tag, for
|
||||
// landing pages, the shopping cart and links placed by hand.
|
||||
func tagLink(site, slug string) string {
|
||||
u, err := url.Parse(strings.TrimSpace(site))
|
||||
if err != nil || u.Host == "" {
|
||||
return ""
|
||||
}
|
||||
q := u.Query()
|
||||
q.Set("utm_campaign", slug)
|
||||
u.RawQuery = q.Encode()
|
||||
return u.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user