Documentation
¶
Overview ¶
Package coverage is the shared record of where a brand appears, as the brand agent plan's Coverage rework (section 4) asks: the plays that produce an appearance (a link won, press coverage confirmed, a review profile found) write a placement here instead of each module tracking appearances its own way. Opportunities (candidates), placements, publishers and observations keep their own lifecycles; a submission or a pitch accepted is not publication, so a play records a placement only once it has observed the appearance, and the observation goes with it. Uniqueness is the publisher's page and position (URL and inventory), never the domain alone.
Index ¶
- Constants
- Variables
- func AccessOf(l Link) string
- func Action(reason string) string
- func Canonical(raw string) (string, error)
- func Classify(raw string) string
- func EnglishURL(raw string) (string, string)
- func Observe(ctx context.Context, tx pgx.Tx, ws, brand, pageURL, health, source string, ...) error
- func PaidEvidence(pageURL, title, linkURL string, sponsoredRel bool) []string
- func Platform(raw string) bool
- func Record(ctx context.Context, tx pgx.Tx, ws, brand string, in Placement) (string, bool, error)
- func Score(reason, rawURL, kind string, f Factors) (float64, map[string]float64)
- func Suggest(ctx context.Context, tx pgx.Tx, ws, brand string, s Suggestion) (string, bool, error)
- type Factors
- type Link
- type Placement
- type Suggestion
- type Topic
- type Valuation
Constants ¶
const ( // AccessCantBuy is an editorial link on a site that doesn't sell them: // news, a university or government site, Wikipedia, or a strong site // with real readers and no sign of payment. AccessCantBuy = "cant_buy" // AccessEarned is a page a third party chose to write: a review, a // comparison, a roundup, an article or interview. AccessEarned = "earned" // AccessPaid has evidence of a deal: sponsored, affiliate. AccessPaid = "paid" // AccessFree is anything anyone can make for themselves: a profile, a // listing, a forum post, their own upload to a platform. AccessFree = "free" // AccessUnknown is a page the address and numbers say nothing about. AccessUnknown = "unknown" )
How a link is got: the first question when deciding which of a competitor's links to go after.
Variables ¶
var Accesses = []string{AccessCantBuy, AccessEarned, AccessPaid, AccessFree, AccessUnknown}
Accesses are the access values, strongest first.
var ErrNoURL = errors.New("coverage: the placement needs an http(s) URL")
ErrNoURL means the placement's URL is not an http(s) address.
var ErrReason = errors.New("coverage: unknown opportunity reason")
ErrReason means the suggestion's reason is not one of the four.
Functions ¶
func AccessOf ¶ added in v0.87.0
AccessOf says how a link is got, from its address, kind and numbers.
func Action ¶ added in v0.85.0
Action is what to do next for a reason: pitch, request_link or reclaim_link.
func Canonical ¶
Canonical is a placement's URL as coverage keys it: lower-case host, no fragment, no tracking parameters, a path.
func Classify ¶ added in v0.85.0
Classify guesses a found page's placement type from its address alone: a YouTube video, a forum thread, an influencer's post, a review site, an MCP directory, an app store listing, a comparison or a roundup. It returns "" when the address says nothing, so a person picks the type. It never reads the page.
func EnglishURL ¶ added in v0.87.0
EnglishURL returns the English version of a page's address, and the language the address names ("" when it names none). The English version drops the language from the first path segment, a language subdomain and a language query parameter, so every translation of a page has the same English address.
func Observe ¶
func Observe(ctx context.Context, tx pgx.Tx, ws, brand, pageURL, health, source string, evidence map[string]any) error
Observe adds what a play saw on a page the brand has a placement on (a link gone, a page gone), without deciding the placement's stage: the coverage monitor's rules do that from the observations. It does nothing when the page has no placement.
func PaidEvidence ¶ added in v0.85.0
PaidEvidence is why a page looks paid for: the signs in its address, its title or the link it holds. A competitor's placement shows "Likely paid" only with at least one; otherwise its arrangement is unknown, because nobody outside the deal can know for sure.
pageURL and title describe the page; linkURL is where its link points (a competitor's page), when a backlinks read found one. The evidence is short fixed labels, never page text.
func Record ¶
Record keeps an observed appearance as a live placement of the brand, with its publisher (a company record for the page's domain), an observation and its history, in the play's own transaction. A placement the page already has is verified again rather than added twice. It returns the placement and whether it was new.
func Score ¶ added in v0.85.0
Score is a suggestion's leverage from 0 to 100, with each part's points: seo (domain rating and traffic, up to 35), ai (citations in AI answers, up to 35), competitors (how many are there, up to 20) and fit (the kind of page, up to 10). A page the brand already has a relationship with gets up to 10 more, since it is the easiest win.
A page on a platform anyone can post to (google.com, youtube.com) gets no seo points from the platform's numbers, and one that is free to get (a profile, a listing, a forum post: AccessOf) keeps 60% of its score, the same judgement Value makes of a competitor's links.
func Suggest ¶ added in v0.85.0
Suggest keeps a suggestion for the brand in the caller's transaction, or refreshes the one it already has for that page and reason: its evidence, factors and score move, and a dismissed one stays dismissed. One the brand had won opens again. It returns the opportunity's id and whether it was new.
Types ¶
type Factors ¶ added in v0.85.0
type Factors struct {
DomainRating *float64 `json:"domain_rating,omitempty"`
DomainTraffic *float64 `json:"domain_traffic,omitempty"`
// AICitations is how often AI answers to the brand's questions cited
// the site in the last 90 days.
AICitations int `json:"ai_citations"`
// Competitors is how many of the brand's competitors appear there.
Competitors int `json:"competitors"`
}
Factors are the numbers behind a suggestion's score. Unknown numbers stay nil and score nothing.
type Link ¶ added in v0.87.0
type Link struct {
URL, Title, Anchor string
// Kind is a placement type (Classify); "" when unknown.
Kind string
// Paid: there is evidence of a deal (arrangement likely_paid).
Paid bool
Nofollow *bool
DomainRating *float64
URLRating *float64
DomainTraffic *float64
// Competitors is how many of the brand's competitors this page features.
Competitors int
// Topic is the brand's topic (NewTopic); nil scores no relevance.
Topic *Topic
}
Link is what is known about one placement: where it is, what kind of page it is, and the site's and page's numbers when an SEO connection read them.
type Placement ¶
type Placement struct {
// URL of the page it is on; the position on it, when the page holds
// several (a newsletter issue's slots), in Inventory.
URL string
Inventory string
Title string
// Kind from the placement kinds (news, resource, blog, review, partner,
// community, ...), Arrangement earned, paid, exchange, affiliate or
// unknown.
Kind string
Arrangement string
// TargetURL is the brand's page it links to, when a link was expected.
TargetURL string
ExpectedLink bool
// Source names the play's module and SourceID its record (a link
// prospect, a press coverage row, a review page), so the appearance is
// recorded once and discovery never adds it again as a candidate.
Source, SourceID string
// What the play saw: link_present, mention_present, and anything else
// worth keeping as evidence.
Evidence map[string]any
PublishedOn *time.Time
}
Placement is an appearance a play observed.
type Suggestion ¶ added in v0.85.0
type Suggestion struct {
URL, Title string
// Kind is a placement type; "" guesses it from the address.
Kind string
// Reason: competitor_gap, ai_cited, unlinked_mention or link_removed.
Reason string
// Source is the suggesting module: presence, ai_visibility.
Source string
// Evidence: ids and fixed labels only (competitor ids, a placement id,
// a cohort id), never page text.
Evidence map[string]any
Factors Factors
// PlacementID is the brand's placement it is about, for the link
// reasons.
PlacementID string
}
Suggestion is a place worth the team's effort: a page to be included on, a mention to turn into a link, a link to win back. Modules suggest them (Presence from competitor gaps and its own placements, AI visibility from the pages answers cite) and Suggest ranks them by leverage, SEO and AI answers together.
type Topic ¶ added in v0.87.0
type Topic struct {
// contains filtered or unexported fields
}
Topic is what the brand is about, as words from the searches it ranks for, so a page can be judged on topic or not.
type Valuation ¶ added in v0.87.0
type Valuation struct {
Value float64 `json:"value"`
Access string `json:"access"`
Reasons []string `json:"reasons"`
}
Valuation is a link's value to the brand, 0 to 100, how it's got and the reasons, as fixed short phrases a person can read.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package linkorders holds the Coverage-backed records for paid link orders: a donor catalog profile beside each publisher, the brand's approver settings, and the orders themselves.
|
Package linkorders holds the Coverage-backed records for paid link orders: a donor catalog profile beside each publisher, the brand's approver settings, and the orders themselves. |